diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f885c5c1c..efe968d3b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/views/users/_course_file_form.html.erb b/app/views/users/_course_file_form.html.erb index 2743ed159..b3eec5288 100644 --- a/app/views/users/_course_file_form.html.erb +++ b/app/views/users/_course_file_form.html.erb @@ -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 %>
<%= hidden_field_tag(:send_id, send_id) %> <%= hidden_field_tag(:send_ids, send_ids) %> diff --git a/app/views/users/_org_file_form.html.erb b/app/views/users/_org_file_form.html.erb index 8d8332297..8b6c24e50 100644 --- a/app/views/users/_org_file_form.html.erb +++ b/app/views/users/_org_file_form.html.erb @@ -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) %>
diff --git a/app/views/users/_project_file_form.html.erb b/app/views/users/_project_file_form.html.erb index d56402407..2b4772124 100644 --- a/app/views/users/_project_file_form.html.erb +++ b/app/views/users/_project_file_form.html.erb @@ -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' %>
<%= hidden_field_tag(:send_id, send_id) %> <%= hidden_field_tag(:send_ids, send_ids) %> diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index 2438727a3..54ff83684 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -19,5 +19,5 @@
- <%= render :partial => 'users/org_file_form', :locals => {:user => user, :orgs => @orgs, :send_id => send_id, :send_ids => send_ids} %> -
\ No newline at end of file + <%= render :partial => 'users/org_file_form', :locals => {:user => user, :orgs => @orgs, :send_id => send_id, :send_ids => send_ids, :type => type} %> +
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 219db4ffc..2e6d0987b 100644 --- a/app/views/users/_resource_share_for_project_popup.html.erb +++ b/app/views/users/_resource_share_for_project_popup.html.erb @@ -25,7 +25,7 @@ <% end %>
- <%= 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} %>
diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb index 13494758c..3895446f1 100644 --- a/app/views/users/_resource_share_popup.html.erb +++ b/app/views/users/_resource_share_popup.html.erb @@ -27,7 +27,7 @@ <% end %>
- <%= 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} %>
diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index a545038f1..b8551f7c5 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -27,165 +27,7 @@ <% end %> diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb index bea78130a..a3bc45481 100644 --- a/app/views/users/_user_resource_info.html.erb +++ b/app/views/users/_user_resource_info.html.erb @@ -42,7 +42,190 @@
  • 预览
  • 重命名
  • -
  • 发送
  • +
  • 发送
  • 删除
  • - \ No newline at end of file + + + \ No newline at end of file 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 c05a2ebd0..8db83aefc 100644 --- a/app/views/users/add_exist_file_to_course.js.erb +++ b/app/views/users/add_exist_file_to_course.js.erb @@ -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%>); diff --git a/app/views/users/add_exist_file_to_org.js.erb b/app/views/users/add_exist_file_to_org.js.erb index 9bfe1230a..c6e7f4011 100644 --- a/app/views/users/add_exist_file_to_org.js.erb +++ b/app/views/users/add_exist_file_to_org.js.erb @@ -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%>); 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 ed38fa066..4c24f4932 100644 --- a/app/views/users/add_exist_file_to_project.js.erb +++ b/app/views/users/add_exist_file_to_project.js.erb @@ -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%>); diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb index c191d8c4c..f30970dc4 100644 --- a/app/views/users/search_user_course.js.erb +++ b/app/views/users/search_user_course.js.erb @@ -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 %> diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb index 044f93be5..6e31c5326 100644 --- a/app/views/users/search_user_org.js.erb +++ b/app/views/users/search_user_org.js.erb @@ -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 %> \ 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 b431af716..cc0f5cc09 100644 --- a/app/views/users/search_user_project.js.erb +++ b/app/views/users/search_user_project.js.erb @@ -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 %> diff --git a/app/views/users/user_resource_create.js.erb b/app/views/users/user_resource_create.js.erb index e818f2870..d28898e0a 100644 --- a/app/views/users/user_resource_create.js.erb +++ b/app/views/users/user_resource_create.js.erb @@ -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) %>'); \ No newline at end of file diff --git a/app/views/users/user_resource_delete.js.erb b/app/views/users/user_resource_delete.js.erb index 9583274c6..ffb056e28 100644 --- a/app/views/users/user_resource_delete.js.erb +++ b/app/views/users/user_resource_delete.js.erb @@ -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) %>'); \ No newline at end of file diff --git a/lib/redmine/pagination.rb b/lib/redmine/pagination.rb index 41702e2ce..4f1e8ac46 100644 --- a/lib/redmine/pagination.rb +++ b/lib/redmine/pagination.rb @@ -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