Merge branch 'alan_develop' into develop
Conflicts: app/views/users/_resource_share_for_orgs.html.erb app/views/users/_resource_share_for_project_popup.html.erb app/views/users/_resource_share_popup.html.erb app/views/users/search_user_course.js.erb app/views/users/search_user_org.js.erb app/views/users/search_user_project.js.erb
This commit is contained in:
commit
eb1c6ccf85
|
@ -1618,8 +1618,10 @@ class UsersController < ApplicationController
|
|||
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
|
||||
end
|
||||
end
|
||||
|
||||
@status = params[:status]
|
||||
@type = params[:type]
|
||||
@path = user_resource_user_path(User.current, :type => @type)
|
||||
@limit = 25
|
||||
@is_remote = true
|
||||
@atta_count = @attachments.count
|
||||
|
@ -1677,6 +1679,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
@status = params[:status]
|
||||
@type = params[:type]
|
||||
@path = user_resource_user_path(User.current, :type => @type)
|
||||
@limit = 25
|
||||
@is_remote = true
|
||||
@atta_count = @attachments.count
|
||||
|
@ -1701,6 +1704,7 @@ class UsersController < ApplicationController
|
|||
.select { |course| @user.allowed_to?(:as_teacher,course) and course.is_delete == 0 }
|
||||
end
|
||||
@search = params[:search]
|
||||
@type = params[:type]
|
||||
#这里仅仅是传递需要发送的资源id
|
||||
@send_id = params[:send_id]
|
||||
@send_ids = params[:checkbox1] || params[:send_ids]
|
||||
|
@ -1719,6 +1723,7 @@ class UsersController < ApplicationController
|
|||
@projects = @user.projects.visible
|
||||
end
|
||||
@search = params[:search]
|
||||
@type = params[:type]
|
||||
#这里仅仅是传递需要发送的资源id
|
||||
@send_id = params[:send_id]
|
||||
@send_ids = params[:checkbox1] || params[:send_ids] #搜索的时候 和 直接 用表格提交的时候的send_ids
|
||||
|
@ -1820,6 +1825,7 @@ class UsersController < ApplicationController
|
|||
"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
|
||||
@path = user_resource_user_path(User.current, :type => @type)
|
||||
@user = User.current
|
||||
@is_remote = true
|
||||
@atta_count = @attachments.count
|
||||
|
@ -1931,6 +1937,7 @@ class UsersController < ApplicationController
|
|||
"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
|
||||
@path = user_resource_user_path(User.current, :type => @type)
|
||||
@user = User.current
|
||||
@is_remote = true
|
||||
@atta_count = @attachments.count
|
||||
|
@ -2029,6 +2036,7 @@ class UsersController < ApplicationController
|
|||
"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
|
||||
@path = user_resource_user_path(User.current, :type => @type)
|
||||
@user = User.current
|
||||
@is_remote = true
|
||||
@atta_count = @attachments.count
|
||||
|
@ -2721,6 +2729,7 @@ class UsersController < ApplicationController
|
|||
name = "%"+name+"%"
|
||||
@orgs = User.current.organizations.where("name like ?", name)
|
||||
@user = User.current
|
||||
@type = params[:type]
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'static_base'}
|
||||
format.js
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= form_tag add_exist_file_to_course_user_path(user),:remote=>true,:id=>'course_list_form' do %>
|
||||
<%= form_tag add_exist_file_to_course_user_path(user, :type => type),:remote=>true,:id=>'course_list_form' do %>
|
||||
<div>
|
||||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= form_tag add_exist_file_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %>
|
||||
<%= form_tag add_exist_file_to_org_user_path(user, :type => type),:remote=>true,:id=>'orgs_list_form' do %>
|
||||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
<div class="sectionWrap fl mr15">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= form_tag add_exist_file_to_project_user_path(user), :remote => true, :id => 'projects_list_form' %>
|
||||
<%= form_tag add_exist_file_to_project_user_path(user, :type => type), :remote => true, :id => 'projects_list_form' %>
|
||||
<div>
|
||||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
|
|
|
@ -19,5 +19,5 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<div id="org_file_form">
|
||||
<%= render :partial => 'users/org_file_form', :locals => {:user => user, :orgs => @orgs, :send_id => send_id, :send_ids => send_ids} %>
|
||||
</div>
|
||||
<%= render :partial => 'users/org_file_form', :locals => {:user => user, :orgs => @orgs, :send_id => send_id, :send_ids => send_ids, :type => type} %>
|
||||
</div>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div id="project_file_form">
|
||||
<%= render :partial => 'users/project_file_form', :locals => {:user => user, :projects => projects, :send_id => send_id, :send_ids => send_ids} %>
|
||||
<%= render :partial => 'users/project_file_form', :locals => {:user => user, :projects => projects, :send_id => send_id, :send_ids => send_ids, :type => type} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div id="course_file_form">
|
||||
<%= render :partial => "users/course_file_form", :locals => {:user => user, :send_id => send_id, :send_ids => send_ids, :courses => courses} %>
|
||||
<%= render :partial => "users/course_file_form", :locals => {:user => user, :send_id => send_id, :send_ids => send_ids, :courses => courses, :type => type} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -27,165 +27,7 @@
|
|||
<% end %>
|
||||
|
||||
<script>
|
||||
var pageX = 0;
|
||||
var pageY = 0;
|
||||
//当前选中的行
|
||||
var line;
|
||||
//已经选中的行,和当前选中的行的区别是:右键选中为line,换一行右键后,line变为last_line,line变为换行后的line
|
||||
var last_line;
|
||||
//资源名称
|
||||
var res_name;
|
||||
//资源名称的链接
|
||||
var res_link;
|
||||
var id; //资源id
|
||||
var sendType = '1'; //发送到课程 1 发送到项目 2
|
||||
var lastSendType; //保存上次发送的发送类型
|
||||
$("#resources_list").mousedown(function(e) {
|
||||
//如果是右键的话
|
||||
if (3 == e.which) {
|
||||
if( $("#res_name").length != 0 || $("#ajax-indicator").is(":hidden") == false){ //其他ajax在执行的时候阻止操作
|
||||
e.preventDefault();
|
||||
return ;
|
||||
}
|
||||
document.oncontextmenu = function() {return false;}
|
||||
pageX = e.clientX;
|
||||
pageY = e.clientY;
|
||||
$("#contextMenu").hide();
|
||||
$("#contextMenu").attr("style","display: block; position: fixed; top:"
|
||||
+ pageY
|
||||
+ "px; left:"
|
||||
+ pageX
|
||||
+ "px; width: 80px;");
|
||||
$("#contextMenu").show();
|
||||
//当前光标所在的对象
|
||||
|
||||
var ele = document.elementFromPoint(pageX,pageY);
|
||||
//转换为jquery对象
|
||||
line = $(ele).parent();
|
||||
//如果上一条存在被选中,那么将上一条的背景色改为白色
|
||||
if(last_line != null){
|
||||
last_line.children().css("background-color", 'white');
|
||||
restore();
|
||||
last_line == null;
|
||||
}
|
||||
//如果当前的tag是li,那么还要li的父级元素
|
||||
if(line.get(0).tagName === 'LI'){
|
||||
line = line.parent();
|
||||
}
|
||||
//将当前的元素的所有子元素的背景色改为蓝色
|
||||
line.children().css("background-color", '#e1e1e1');
|
||||
//将当前元素赋给 上一个对象 保存起来。
|
||||
last_line = line;
|
||||
}
|
||||
});
|
||||
//元素包含关系计算
|
||||
var contains = function(root, el) {
|
||||
if (root.compareDocumentPosition)
|
||||
return root === el || !!(root.compareDocumentPosition(el) & 16);
|
||||
if (root.contains && el.nodeType === 1){
|
||||
return root.contains(el) && root !== el;
|
||||
}
|
||||
while ((el = el.parentNode))
|
||||
if (el === root) return true;
|
||||
return false;
|
||||
}
|
||||
$(document.body).click(function(e) {
|
||||
//在列表上的任何单击事件都要恢复原来的样子
|
||||
//隐藏右键菜单
|
||||
//e.preventDefault();
|
||||
$("#contextMenu").hide();
|
||||
if( $("#ajax-indicator").is(":hidden") == false && $("#res_name").length != 0 ){ //其他ajax在执行的时候或者res_name仍然存在阻止操作
|
||||
return ;
|
||||
}
|
||||
document.oncontextmenu = function() {return true;}
|
||||
//如果当前行为空,那么要将当前行的拿到
|
||||
var ele;
|
||||
if(line == null){
|
||||
ele = document.elementFromPoint(e.clientX, e.clientY);
|
||||
line = $(ele).parent();
|
||||
//如果是在li上点击事件,那么要获得父组件
|
||||
if(line.get(0).tagName === 'LI'){
|
||||
line = line.parent();
|
||||
}
|
||||
|
||||
}
|
||||
//如果当前对象在表格里,将当前行改变为白色,这里主要是防止点击页面的其他链接的时候,那个链接背景色变白了
|
||||
if( contains($("#resources_list").get(0),line.get(0))){
|
||||
line.children().css("background-color", 'white');
|
||||
}
|
||||
|
||||
//当前行恢复编辑状态到链接状态
|
||||
if(ele && ele.nodeName != 'INPUT') {
|
||||
restore();
|
||||
}
|
||||
line = null;
|
||||
});
|
||||
//只要有一个选中了就是true
|
||||
function checkboxSelected(){
|
||||
selected = false;
|
||||
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
||||
if($(this).attr('checked') == true){
|
||||
selected = true;
|
||||
}
|
||||
});
|
||||
return selected;
|
||||
}
|
||||
//只有全选才是true
|
||||
function checkboxAllSelected(){
|
||||
allSelected = true;
|
||||
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
||||
if($(this).attr('checked') == undefined){
|
||||
allSelected = false;
|
||||
}
|
||||
});
|
||||
return allSelected;
|
||||
}
|
||||
//只有全部不选才是true
|
||||
function checkboxAllDeselected(){
|
||||
allDeselected = true;
|
||||
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
||||
if($(this).attr('checked') == 'checked'){
|
||||
allDeselected = false;
|
||||
}
|
||||
});
|
||||
return allDeselected;
|
||||
}
|
||||
//查看所有的checkbox状态,并且按情况更改$("#checkboxAll")的状态
|
||||
function checkAllBox(checkbox){
|
||||
//只有选中当前checkbox且这个时候所有的checkbox都被选中了,$("#checkboxAll")才是被选中状态,其余都是非选中状态
|
||||
if(checkbox.attr('checked') == 'checked' && checkboxAllSelected()){
|
||||
$("#checkboxAll").attr('checked',true);
|
||||
}else{
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
}
|
||||
$("#res_count").html(getCheckBoxSeletedCount());
|
||||
|
||||
}
|
||||
//获取当前checkbox选中的数目
|
||||
function getCheckBoxSeletedCount(){
|
||||
var i = 0;
|
||||
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
||||
if($(this).attr('checked') == 'checked'){
|
||||
i ++;
|
||||
}
|
||||
});
|
||||
return i;
|
||||
}
|
||||
//全选反选
|
||||
function all_select(){
|
||||
|
||||
if($("#checkboxAll").attr('checked')){
|
||||
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
||||
$(this).attr('checked',true);
|
||||
});
|
||||
$("#res_count").html(getCheckBoxSeletedCount());
|
||||
}else{
|
||||
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
||||
$(this).attr('checked',false);
|
||||
});
|
||||
$("#res_count").html(0);
|
||||
}
|
||||
}
|
||||
|
||||
function show_upload(){
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'upload_resource' ,:locals => {:user=>User.current.id,:type=>@type,:status=>@status})%>');
|
||||
|
@ -221,7 +63,7 @@
|
|||
|
||||
|
||||
|
||||
function show_send_(){
|
||||
function show_send(){
|
||||
$("#contextMenu").hide();
|
||||
document.oncontextmenu = function() {return true;}
|
||||
line.children().css("background-color",'white');
|
||||
|
@ -229,13 +71,13 @@
|
|||
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(User.current.id)%>' + '?send_id=' + id,
|
||||
url: '<%= search_user_project_user_path(User.current.id) %>' + "?send_id=" + id + "&type=<%= @type %>",
|
||||
data:{send_type:'file'}
|
||||
});
|
||||
}else{
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current.id)%>' + '?send_id=' + id,
|
||||
url: '<%= search_user_course_user_path(User.current.id)%>' + "?send_id=" + id + "&type=<%= @type %>",
|
||||
data:{send_type:'file'}
|
||||
});
|
||||
}
|
||||
|
@ -249,13 +91,13 @@
|
|||
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(User.current.id)%>' + '?' + $("#resources_list_form").serialize(),
|
||||
url: '<%= search_user_project_user_path(User.current.id)%>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type%>",
|
||||
data:{send_type:'file'}
|
||||
});
|
||||
}else{
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize(),
|
||||
url: '<%= search_user_course_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize() + "&type=<%= @type%>",
|
||||
data:{send_type:'file'}
|
||||
});
|
||||
|
||||
|
@ -273,27 +115,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
function rename(){
|
||||
$("#contextMenu").hide();
|
||||
document.oncontextmenu = function() {return true;}
|
||||
line.children().css("background-color",'white');
|
||||
id = line.children().last().html();
|
||||
user_id = line.children().eq(5).html();
|
||||
if(user_id === '<%= User.current.id %>') {
|
||||
res_name = line.children().eq(1).children().attr('title');
|
||||
res_link = line.children().eq(1).html();
|
||||
line.children().eq(1).html(
|
||||
'<input name="res_name" id="res_name" ' +
|
||||
'style="height: 2em;line-height: 2em;overflow: hidden;" onblur="restore();" ' +
|
||||
' onkeypress="if(event.keyCode==13){event.preventDefault();this.blur();}" ' +
|
||||
'value="'+res_name+
|
||||
'"/> <input type="hidden" id ="res_id" name="res_id" value="'+id+'"/>');
|
||||
$("#res_name").focus();
|
||||
$("html,body").animate({scrollTop:$("#res_name").offset().top},1000)
|
||||
}else{
|
||||
alert('您无法修改此资源!')
|
||||
}
|
||||
}
|
||||
|
||||
String.prototype.trim = function() {
|
||||
var str = this,
|
||||
str = str.replace(/^\s\s*/, ''),
|
||||
|
@ -370,5 +192,4 @@
|
|||
alert('您无法删除此资源!')
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -42,7 +42,190 @@
|
|||
<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?%>)show_send();" onfocus="this.blur()" >发送</a></li>
|
||||
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)delete_file();" onfocus="this.blur()">删除</a></li>
|
||||
</ul>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<script>
|
||||
var pageX = 0;
|
||||
var pageY = 0;
|
||||
//当前选中的行
|
||||
var line;
|
||||
//已经选中的行,和当前选中的行的区别是:右键选中为line,换一行右键后,line变为last_line,line变为换行后的line
|
||||
var last_line;
|
||||
//资源名称
|
||||
var res_name;
|
||||
//资源名称的链接
|
||||
var res_link;
|
||||
var id; //资源id
|
||||
var sendType = '1'; //发送到课程 1 发送到项目 2
|
||||
var lastSendType; //保存上次发送的发送类型
|
||||
$("#resources_list").mousedown(function(e) {
|
||||
//如果是右键的话
|
||||
if (3 == e.which) {
|
||||
if( $("#res_name").length != 0 || $("#ajax-indicator").is(":hidden") == false){ //其他ajax在执行的时候阻止操作
|
||||
e.preventDefault();
|
||||
return ;
|
||||
}
|
||||
document.oncontextmenu = function() {return false;}
|
||||
pageX = e.clientX;
|
||||
pageY = e.clientY;
|
||||
$("#contextMenu").hide();
|
||||
$("#contextMenu").attr("style","display: block; position: fixed; top:"
|
||||
+ pageY
|
||||
+ "px; left:"
|
||||
+ pageX
|
||||
+ "px; width: 80px;");
|
||||
$("#contextMenu").show();
|
||||
//当前光标所在的对象
|
||||
|
||||
var ele = document.elementFromPoint(pageX,pageY);
|
||||
//转换为jquery对象
|
||||
line = $(ele).parent();
|
||||
//如果上一条存在被选中,那么将上一条的背景色改为白色
|
||||
if(last_line != null){
|
||||
last_line.children().css("background-color", 'white');
|
||||
restore();
|
||||
last_line == null;
|
||||
}
|
||||
//如果当前的tag是li,那么还要li的父级元素
|
||||
if(line.get(0).tagName === 'LI'){
|
||||
line = line.parent();
|
||||
}
|
||||
//将当前的元素的所有子元素的背景色改为蓝色
|
||||
line.children().css("background-color", '#e1e1e1');
|
||||
//将当前元素赋给 上一个对象 保存起来。
|
||||
last_line = line;
|
||||
}
|
||||
});
|
||||
//元素包含关系计算
|
||||
var contains = function(root, el) {
|
||||
if (root.compareDocumentPosition)
|
||||
return root === el || !!(root.compareDocumentPosition(el) & 16);
|
||||
if (root.contains && el.nodeType === 1){
|
||||
return root.contains(el) && root !== el;
|
||||
}
|
||||
while ((el = el.parentNode))
|
||||
if (el === root) return true;
|
||||
return false;
|
||||
}
|
||||
$(document.body).click(function(e) {
|
||||
//在列表上的任何单击事件都要恢复原来的样子
|
||||
//隐藏右键菜单
|
||||
//e.preventDefault();
|
||||
$("#contextMenu").hide();
|
||||
if( $("#ajax-indicator").is(":hidden") == false && $("#res_name").length != 0 ){ //其他ajax在执行的时候或者res_name仍然存在阻止操作
|
||||
return ;
|
||||
}
|
||||
document.oncontextmenu = function() {return true;}
|
||||
//如果当前行为空,那么要将当前行的拿到
|
||||
var ele;
|
||||
if(line == null){
|
||||
ele = document.elementFromPoint(e.clientX, e.clientY);
|
||||
line = $(ele).parent();
|
||||
//如果是在li上点击事件,那么要获得父组件
|
||||
if(line.get(0).tagName === 'LI'){
|
||||
line = line.parent();
|
||||
}
|
||||
|
||||
}
|
||||
//如果当前对象在表格里,将当前行改变为白色,这里主要是防止点击页面的其他链接的时候,那个链接背景色变白了
|
||||
if( contains($("#resources_list").get(0),line.get(0))){
|
||||
line.children().css("background-color", 'white');
|
||||
}
|
||||
|
||||
//当前行恢复编辑状态到链接状态
|
||||
if(ele && ele.nodeName != 'INPUT') {
|
||||
restore();
|
||||
}
|
||||
line = null;
|
||||
});
|
||||
//只要有一个选中了就是true
|
||||
function checkboxSelected(){
|
||||
selected = false;
|
||||
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
||||
if($(this).attr('checked') == true){
|
||||
selected = true;
|
||||
}
|
||||
});
|
||||
return selected;
|
||||
}
|
||||
//只有全选才是true
|
||||
function checkboxAllSelected(){
|
||||
allSelected = true;
|
||||
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
||||
if($(this).attr('checked') == undefined){
|
||||
allSelected = false;
|
||||
}
|
||||
});
|
||||
return allSelected;
|
||||
}
|
||||
//只有全部不选才是true
|
||||
function checkboxAllDeselected(){
|
||||
allDeselected = true;
|
||||
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
||||
if($(this).attr('checked') == 'checked'){
|
||||
allDeselected = false;
|
||||
}
|
||||
});
|
||||
return allDeselected;
|
||||
}
|
||||
//查看所有的checkbox状态,并且按情况更改$("#checkboxAll")的状态
|
||||
function checkAllBox(checkbox){
|
||||
//只有选中当前checkbox且这个时候所有的checkbox都被选中了,$("#checkboxAll")才是被选中状态,其余都是非选中状态
|
||||
if(checkbox.attr('checked') == 'checked' && checkboxAllSelected()){
|
||||
$("#checkboxAll").attr('checked',true);
|
||||
}else{
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
}
|
||||
$("#res_count").html(getCheckBoxSeletedCount());
|
||||
|
||||
}
|
||||
//获取当前checkbox选中的数目
|
||||
function getCheckBoxSeletedCount(){
|
||||
var i = 0;
|
||||
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
||||
if($(this).attr('checked') == 'checked'){
|
||||
i ++;
|
||||
}
|
||||
});
|
||||
return i;
|
||||
}
|
||||
//全选反选
|
||||
function all_select(){
|
||||
|
||||
if($("#checkboxAll").attr('checked')){
|
||||
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
||||
$(this).attr('checked',true);
|
||||
});
|
||||
$("#res_count").html(getCheckBoxSeletedCount());
|
||||
}else{
|
||||
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
||||
$(this).attr('checked',false);
|
||||
});
|
||||
$("#res_count").html(0);
|
||||
}
|
||||
}
|
||||
function rename(){
|
||||
$("#contextMenu").hide();
|
||||
document.oncontextmenu = function() {return true;}
|
||||
line.children().css("background-color",'white');
|
||||
id = line.children().last().html();
|
||||
user_id = line.children().eq(5).html();
|
||||
if(user_id === '<%= User.current.id %>') {
|
||||
res_name = line.children().eq(1).children().attr('title');
|
||||
res_link = line.children().eq(1).html();
|
||||
line.children().eq(1).html(
|
||||
'<input name="res_name" id="res_name" ' +
|
||||
'style="height: 2em;line-height: 2em;overflow: hidden;" onblur="restore();" ' +
|
||||
' onkeypress="if(event.keyCode==13){event.preventDefault();this.blur();}" ' +
|
||||
'value="'+res_name+
|
||||
'"/> <input type="hidden" id ="res_id" name="res_id" value="'+id+'"/>');
|
||||
$("#res_name").focus();
|
||||
$("html,body").animate({scrollTop:$("#res_name").offset().top},1000)
|
||||
}else{
|
||||
alert('您无法修改此资源!')
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,6 +1,7 @@
|
|||
<% 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})%>');
|
||||
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>');
|
||||
$("#res_count").html(0);
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<% 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})%>');
|
||||
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>');
|
||||
$("#res_count").html(0);
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<% 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})%>');
|
||||
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>');
|
||||
$("#res_count").html(0);
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<% if params[:send_type].present? && params[:send_type] == 'news' %>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_course' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
|
||||
<% elsif params[:send_type] == 'file' %>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/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, :type=>@type}) %>');
|
||||
<% elsif params[:send_type] == 'message' %>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_course' ,:locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
|
||||
<% end %>
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
<% if params[:is_observe].nil? %>
|
||||
<% if params[:send_type].present? && params[:send_type] == 'news' %>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
|
||||
<% elsif params[:send_type] == 'file' %>
|
||||
$("#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})%>');
|
||||
$("#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, :type => @type})%>');
|
||||
<% elsif params[:send_type] == 'message' %>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
|
||||
<% end %>
|
||||
|
@ -14,12 +13,3 @@ $('#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);
|
||||
<% else %>
|
||||
<% if params[:send_type] == 'news' %>
|
||||
$("#org_news_form").html("<%= escape_javascript(render :partial => 'users/org_news_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>");
|
||||
<% elsif params[:send_type] == 'file' %>
|
||||
$("#org_file_form").html("<%= escape_javascript(render :partial => 'users/org_file_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>");
|
||||
<% elsif params[:send_type] == 'message' %>
|
||||
$("#org_message_form").html("<%= escape_javascript(render :partial => 'users/org_message_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>");
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -1,8 +1,7 @@
|
|||
<% if params[:is_observe].nil? %>
|
||||
<% if params[:send_type].present? && params[:send_type] == 'news' %>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
|
||||
<% elsif params[:send_type] == 'file' %>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids, :type => @type}) %>');
|
||||
<% elsif params[:send_type] == 'message' %>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
|
||||
<% end %>
|
||||
|
@ -15,12 +14,3 @@ $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
|||
//$("#search_project_input").focus();
|
||||
var val = $("#search_project_input").val();
|
||||
$("#search_project_input").val("").focus().val(val);
|
||||
<% else %>
|
||||
<% if params[:send_type] == 'news' %>
|
||||
$("#project_news_form").html("<%= escape_javascript(render :partial => 'users/project_news_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>");
|
||||
<% elsif params[:send_type] == 'file' %>
|
||||
$("#project_file_form").html("<%= escape_javascript(render :partial => 'users/project_file_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>");
|
||||
<% elsif params[:send_type] == 'message' %>
|
||||
$("#project_message_form").html("<%= escape_javascript(render :partial => 'users/project_message_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>");
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
closeModal();
|
||||
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
|
||||
$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>');
|
||||
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
$("#res_count").html(0);
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
//更新状态
|
||||
$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>');
|
||||
$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>');
|
||||
$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>');
|
||||
$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>');
|
||||
$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>');
|
||||
$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>');
|
||||
closeModal();
|
||||
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
|
||||
$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>');
|
||||
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>');
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
$("#res_count").html(0);
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
//更新状态
|
||||
$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>');
|
||||
$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>');
|
||||
$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>');
|
||||
$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>');
|
||||
$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>');
|
||||
$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>');
|
||||
$("#resource_type_file").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 4, :search => @switch_search) %>');
|
|
@ -1,14 +1,14 @@
|
|||
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
|
||||
$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>');
|
||||
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
$("#res_count").html(0);
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
//更新状态
|
||||
$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>');
|
||||
$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>');
|
||||
$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>');
|
||||
$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>');
|
||||
$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>');
|
||||
$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>');
|
||||
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
|
||||
$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>');
|
||||
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>');
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
$("#res_count").html(0);
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
//更新状态
|
||||
$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>');
|
||||
$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>');
|
||||
$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>');
|
||||
$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>');
|
||||
$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>');
|
||||
$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>');
|
||||
$("#resource_type_file").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 4, :search => @switch_search) %>');
|
|
@ -163,11 +163,17 @@ module Redmine
|
|||
# :per_page_links if set to false, the "Per page" links are not rendered
|
||||
#
|
||||
def pagination_links_full(*args)
|
||||
page = ""
|
||||
pagination_links_each(*args) do |text, parameters, options|
|
||||
if block_given?
|
||||
yield text, parameters, options
|
||||
else
|
||||
link_to text, params.merge(parameters), options
|
||||
if args[2][:path].nil?
|
||||
link_to text, params.merge(parameters), options
|
||||
else
|
||||
page = "&page" + parameters[:page].to_s unless parameters[:page].nil?
|
||||
link_to text, args[2][:path].to_s + page, options
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue