<%= stylesheet_link_tag 'courses'%>
<script>
    function searchone4reload(fileid){
        var url = "<%= searchone4reload_org_subfield_files_path(@org_subfield)%>";
        var data = {};data.fileid=fileid;
        $.ajax({
            url:url,dataType:'text',data:data,success:function(text){
                var container_file_div = $("#container_files_"+fileid);
                container_file_div.after(text);
                container_file_div.remove();
            }
        });
    }

    function closeModal()
    {
        hideModal($("#popbox_upload"));
    }
</script>

<div class="homepageRight mt0 ml0">
  <div class="homepageRightBanner" style="margin-top:<%= User.current.logged? ? '0px':'10px' %>">
    <div class="NewsBannerName"><%= org_subfield.name %></div>
    <ul class="resourcesSelect">
      <ul class="resourcesSelect">
        <li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
          <ul class="resourcesType">
            <li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield)%>','','<%= @q%>','<%= org_subfield.id%>');" class="resourcesTypeAll resourcesGrey">全部</a></li>
            <li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield)%>','软件','<%= @q%>','<%= org_subfield.id%>');" class="softwareIcon postTypeGrey">软件</a></li>
            <li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield)%>','媒体','<%= @q%>','<%= org_subfield.id%>');" class="mediaIcon resourcesGrey">媒体</a></li>
            <li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield)%>','代码','<%= @q%>','<%= org_subfield.id%>');" class="codeIcon resourcesGrey">代码</a></li>
            <li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield,:other=>true)%>','其他','<%= @q%>','<%= org_subfield.id%>');" class="othersIcon resourcesGrey">其它</a></li>
          </ul>
        </li>
      </ul>
    </ul>
  </div>
  <div class="resources mt10" style="padding-bottom:5px;">
    <div class="reTop mb5">
      <%= form_tag( search_files_in_subfield_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search",:remote=>true) do %>
          <%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%>
          <%= submit_tag "栏目内搜索", :class => "blueBtn mr5 fl",:style => 'width:72px;',:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %>
          <%#= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
          <% if User.current.member_of_org?(org_subfield.organization) %>
              <input class="blueBtn fr mr5" value="上传资源" onclick="org_upload_files(<%= org_subfield.id %>);">
              <%= link_to("导入资源", import_resources_user_path(User.current, :type => 6, :subfield_file_id => @org_subfield.id), :class => "blue-btn fr mr5", :remote => true) %>
          <% end %>
      <% end %>
    </div><!---re_top end-->
    <div class="cl"></div>

    <div>
      <div class="re_con_top">
        <div class="files_tag" id="files_tag">
          <%= render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @tag_name}%>
        </div>
        <div class="cl"></div>
        <p class="f_l  fontBlue f_b f_14">共有&nbsp;<span id="attachment_count"><%= User.current.member_of_org?(@org_subfield.organization) ? @all_attachments.count : @all_attachments.select{|attach| attach.is_public == 1 }.count %></span>&nbsp;个资源</p>
        <p class="f_r" style="color: #808080" id="org_sort">
          <%= render :partial => 'files/org_order_filter', :locals => {:order => @order, :sort => @sort, :tag_name => @tag_name, :search_name => nil} %>
        </p>
      </div>
      <div class="cl"></div>
    </div>
  </div>
  <div id="org_subfield_list">
    <%= render :partial => 'files/org_subfield_list',:locals => {org_subfield: @org_subfield,all_attachments: @all_attachments,sort:@sort,order:@order,org_subfield_attachments:@obj_attachments}  %>
  </div><!---re_con end-->

</div>
<%# html_title(l(:label_attachment_plural)) -%>
<script>
  function org_upload_files(org_subfield_id){
      $.ajax({
          url :"/org_subfields/" + org_subfield_id + "/files/subfield_upload_file",
          type :'post'
      });
  }
</script>