diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index 6b748649b..238999a71 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -126,7 +126,7 @@ module FilesHelper (attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))|| (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)|| attachment.author_id == User.current.id || - attachment.container_type == "OrgSubfield" + (attachment.container_type == "OrgSubfield" and User.current.member_of_org?(attachment.container.organization)) result << attachment end end diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb index 641029bf2..90ae3516d 100644 --- a/app/views/files/_org_subfield_list.html.erb +++ b/app/views/files/_org_subfield_list.html.erb @@ -1,70 +1,72 @@ <% delete_allowed = User.current.admin? %> <% org_subfield_attachments.each do |file| %> -
-
-
- <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %> -
-
-
- <%= link_to file.is_public? ? truncate(file.filename, length: 70) : truncate(file.filename,length: 50, 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 => "linkGrey3 f_14 f_l" %> - <%= 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"} %> - <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %> -
-
-
    -
  • - <% if User.current.logged? %> - <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %> -
      -
    • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
    • -
    • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
    • -
    • - - <%= 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 %> - -
    • -
    • - <%= 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 == org_subfield.id && file.container_type == "OrgSubfield" && file.destroyable %> -
    • -
    - <%else%> -
      -
    • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
    • -
    - <% end %> + <% if file.is_public == 1 or User.current.member_of_org?(file.container.organization) %> +
    +
    +
    + <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %> +
    +
    +
    + <%= link_to file.is_public? ? truncate(file.filename, length: 70) : truncate(file.filename,length: 50, 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 => "linkGrey3 f_14 f_l" %> + <%= 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"} %> + <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %> +
+
+
    +
  • + <% if User.current.logged? %> + <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %> +
      +
    • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
    • +
    • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
    • +
    • + + <%= 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 %> + +
    • +
    • + <%= 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 == org_subfield.id && file.container_type == "OrgSubfield" && file.destroyable %> +
    • +
    + <%else%> +
      +
    • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
    • +
    + <% end %> + <% end %> +
  • +
+
+
+
-
-
- + <% end %> <% end %> <% if org_subfield_attachments.count == 10 %> diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb index 6531aa96b..7fb9e2e0a 100644 --- a/app/views/files/_subfield_files.html.erb +++ b/app/views/files/_subfield_files.html.erb @@ -54,7 +54,7 @@ <%= render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @tag_name}%>
-

共有 <%= @all_attachments.count %> 个资源

+

共有 <%= User.current.member_of_org?(@org_subfield.organization) ? @all_attachments.count : @all_attachments.select{|attach| attach.is_public == 1 }.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"} %> /