栏目增加资源类型,可以添加文件、删除文件、显示文件等
This commit is contained in:
parent
a9510f4869
commit
e98338bf22
|
@ -418,6 +418,8 @@ class ApplicationController < ActionController::Base
|
||||||
@project = Project.find(params[:project_id])
|
@project = Project.find(params[:project_id])
|
||||||
elsif params[:course_id]
|
elsif params[:course_id]
|
||||||
@course = Course.find(params[:course_id])
|
@course = Course.find(params[:course_id])
|
||||||
|
elsif params[:org_subfield_id]
|
||||||
|
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
|
||||||
end
|
end
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render_404
|
render_404
|
||||||
|
|
|
@ -240,6 +240,8 @@ class AttachmentsController < ApplicationController
|
||||||
format.html { redirect_to_referer_or respond_path(@attachment.container) }
|
format.html { redirect_to_referer_or respond_path(@attachment.container) }
|
||||||
elsif !@attachment.container.nil? && @attachment.container.is_a?(PhoneAppVersion)
|
elsif !@attachment.container.nil? && @attachment.container.is_a?(PhoneAppVersion)
|
||||||
format.html { redirect_to_referer_or mobile_version_path }
|
format.html { redirect_to_referer_or mobile_version_path }
|
||||||
|
elsif !@attachment.container.nil? && @attachment.container.is_a?(OrgSubfield)
|
||||||
|
format.html {redirect_to_referer_or org_subfield_files_path(@attachment.container)}
|
||||||
else
|
else
|
||||||
if @project.nil?
|
if @project.nil?
|
||||||
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
|
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
|
||||||
|
|
|
@ -299,6 +299,10 @@ class FilesController < ApplicationController
|
||||||
render :layout => 'base_courses'
|
render :layout => 'base_courses'
|
||||||
elsif params[:org_subfield_id]
|
elsif params[:org_subfield_id]
|
||||||
@container_type = 2
|
@container_type = 2
|
||||||
|
@organization = Organization.find(params[:organization_id])
|
||||||
|
@containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)]
|
||||||
|
show_attachments @containers
|
||||||
|
render :layout => 'base_org'
|
||||||
# @subfield = params[:org_subfield_id]
|
# @subfield = params[:org_subfield_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -424,8 +428,39 @@ class FilesController < ApplicationController
|
||||||
redirect_to course_files_url(@course)
|
redirect_to course_files_url(@course)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
elsif @org_subfield
|
||||||
|
@addTag=false
|
||||||
|
# if params[:in_org_subfield_toolbar]
|
||||||
|
# @in_org_subfield_toolbar = params[:in_org_subfield_toolbar]
|
||||||
|
# end
|
||||||
|
attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type])
|
||||||
|
|
||||||
|
# if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||||
|
# Mailer.run.attachments_added(attachments[:files])
|
||||||
|
# end
|
||||||
|
|
||||||
|
# TODO: 临时用 nyan
|
||||||
|
sort_init 'created_on', 'desc'
|
||||||
|
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
||||||
|
'filename' => "#{Attachment.table_name}.filename",
|
||||||
|
'size' => "#{Attachment.table_name}.filesize",
|
||||||
|
'downloads' => "#{Attachment.table_name}.downloads"
|
||||||
|
|
||||||
|
@containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)] #modify by Long Jun
|
||||||
|
# @containers += @org_subfield.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
|
||||||
|
|
||||||
|
show_attachments @containers
|
||||||
|
|
||||||
|
@attachtype = 0
|
||||||
|
@contenttype = 0
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
format.html {
|
||||||
|
redirect_to org_subfield_files_url(@org_subfield)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -17,4 +17,8 @@ class OrgSubfieldsController < ApplicationController
|
||||||
@organization = Organization.find(@subfield.organization_id)
|
@organization = Organization.find(@subfield.organization_id)
|
||||||
@subfield.update_attributes(:name => params[:name])
|
@subfield.update_attributes(:name => params[:name])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -113,7 +113,8 @@ module FilesHelper
|
||||||
if attachment.is_public? ||
|
if attachment.is_public? ||
|
||||||
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
|
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
|
||||||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))||
|
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))||
|
||||||
attachment.author_id == User.current.id
|
attachment.author_id == User.current.id ||
|
||||||
|
attachment.container_type == "OrgSubfield"
|
||||||
result << attachment
|
result << attachment
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,6 +22,7 @@ class Attachment < ActiveRecord::Base
|
||||||
belongs_to :container, :polymorphic => true
|
belongs_to :container, :polymorphic => true
|
||||||
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
|
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
|
||||||
belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'"
|
belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'"
|
||||||
|
belongs_to :org_subfield, foreign_key: 'container_id', conditions: "attachements.container_type = 'OrgSubfield'"
|
||||||
belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'"
|
belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'"
|
||||||
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
|
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
|
||||||
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
|
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
class OrgSubfield < ActiveRecord::Base
|
class OrgSubfield < ActiveRecord::Base
|
||||||
belongs_to :organization, :foreign_key => :organization_id
|
belongs_to :organization, :foreign_key => :organization_id
|
||||||
has_many :org_document_comments, :dependent => :destroy
|
has_many :org_document_comments, :dependent => :destroy
|
||||||
|
has_many :files
|
||||||
|
acts_as_attachable
|
||||||
|
|
||||||
|
def project
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -20,6 +20,25 @@
|
||||||
:lebel_file_uploding => l(:lebel_file_uploding),
|
:lebel_file_uploding => l(:lebel_file_uploding),
|
||||||
:delete_all_files => l(:text_are_you_sure_all)
|
:delete_all_files => l(:text_are_you_sure_all)
|
||||||
} %>
|
} %>
|
||||||
|
<% elsif @project %>
|
||||||
|
<%= file_field_tag 'attachments[dummy][file]',
|
||||||
|
:id => '_file',
|
||||||
|
:class => ie8? ? '':'file_selector',
|
||||||
|
:multiple => true,
|
||||||
|
:onchange => 'addInputFiles(this);',
|
||||||
|
:style => ie8? ? '': 'display:none',
|
||||||
|
:data => {
|
||||||
|
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||||
|
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||||
|
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||||
|
:upload_path => uploads_path(:format => 'js'),
|
||||||
|
:description_placeholder => l(:label_optional_description),
|
||||||
|
:field_is_public => l(:field_is_public),
|
||||||
|
:are_you_sure => l(:text_are_you_sure),
|
||||||
|
:file_count => l(:label_file_count),
|
||||||
|
:lebel_file_uploding => l(:lebel_file_uploding),
|
||||||
|
:delete_all_files => l(:text_are_you_sure_all)
|
||||||
|
} %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= file_field_tag 'attachments[dummy][file]',
|
<%= file_field_tag 'attachments[dummy][file]',
|
||||||
:id => '_file',
|
:id => '_file',
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
<% delete_allowed = User.current.admin? %>
|
||||||
|
<div class="re_con_top">
|
||||||
|
<p class="f_l c_blue f_b f_14">共有 <%= all_attachments.count%> 个资源</p>
|
||||||
|
<p class="f_r" style="color: #808080">
|
||||||
|
<% 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"} %> /
|
||||||
|
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||||
|
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||||
|
<% else %>
|
||||||
|
按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||||
|
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||||
|
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||||
|
<% end %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<!--<div class="files_tag" id="files_tag">-->
|
||||||
|
<!--<%#= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%>-->
|
||||||
|
<!--</div>-->
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<div class="for_img_thumbnails">
|
||||||
|
<% org_subfield_attachments.each do |file| %>
|
||||||
|
<% if 1 %>
|
||||||
|
<div class="re_con_box" id="container_files_<%= file.id %>">
|
||||||
|
<div class="">
|
||||||
|
<%= link_to truncate(file.filename,length: 35, 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 => "c_dblue f_14 f_b f_l" %>
|
||||||
|
<% if User.current.logged? %>
|
||||||
|
<%= file_preview_tag(file, class: 'f_l re_open', style:'text-align: center;') %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="mt5">
|
||||||
|
<p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||||
|
<%= link_to( l(:button_delete), attachment_path(file),
|
||||||
|
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @org_subfield.id && file.container_type == "OrgSubfield"%>
|
||||||
|
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<!--<div class="tag_h">-->
|
||||||
|
<!--<!– container_type = 1 代表是课程里的资源 –>-->
|
||||||
|
<!--<%#= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>-->
|
||||||
|
<!--<%#= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>-->
|
||||||
|
<!--</div>-->
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div><!---re_con_box end-->
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<ul class="wlist">
|
||||||
|
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||||
|
</ul>
|
||||||
|
<div class="cl"></div>
|
|
@ -0,0 +1,97 @@
|
||||||
|
<%= 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 show_upload(obj)
|
||||||
|
{
|
||||||
|
switch(obj)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>');
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 2}) %>');
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 3}) %>');
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 4}) %>');
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 6}) %>');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 5}) %>');
|
||||||
|
}
|
||||||
|
showModal('ajax-modal', '513px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||||
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
|
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeModal()
|
||||||
|
{
|
||||||
|
hideModal($("#popbox_upload"));
|
||||||
|
}
|
||||||
|
|
||||||
|
function presscss(id)
|
||||||
|
{
|
||||||
|
if(id == "inorg_subfield")
|
||||||
|
{
|
||||||
|
$('#inorg_subfield').attr("class", "re_schbtn b_dblue");
|
||||||
|
$('#insite').attr("class", "re_schbtn b_lblue");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#inorg_subfield').attr("class", "re_schbtn b_lblue");
|
||||||
|
$('#insite').attr("class", "re_schbtn b_dblue");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function buttoncss()
|
||||||
|
{
|
||||||
|
$('#inorg_subfield').attr("class", "re_schbtn b_lblue");
|
||||||
|
$('#insite').attr("class", "re_schbtn b_lblue");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="resources"><!--资源库内容开始--->
|
||||||
|
<div class="re_top" style="width:710px;">
|
||||||
|
<%= form_tag( search_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search f_l",:remote=>true) do %>
|
||||||
|
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
|
||||||
|
<%= submit_tag "栏目内搜索", :class => "re_schbtn b_lblue",:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %>
|
||||||
|
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||||
|
<% end %>
|
||||||
|
<%# if is_org_subfield_teacher(User.current,@org_subfield) || (@org_subfield.publish_resource==1 && User.current.member_of_org_subfield?(@org_subfield) ) %> <!-- show_window('light','fade','20%','35%')-->
|
||||||
|
<!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>-->
|
||||||
|
<p class="c_grey fr mt10 mr5">
|
||||||
|
上传:
|
||||||
|
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(1);">课件</a> |
|
||||||
|
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(2);">软件</a> |
|
||||||
|
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(3);">媒体</a> |
|
||||||
|
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(4);">代码</a> |
|
||||||
|
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(6);">论文</a> |
|
||||||
|
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(5);">其他</a>
|
||||||
|
</p>
|
||||||
|
<%# end %>
|
||||||
|
</div><!---re_top end-->
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<div class="re_con" id="org_subfield_list">
|
||||||
|
<%= render :partial => '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>
|
||||||
|
</div>
|
||||||
|
<% html_title(l(:label_attachment_plural)) -%>
|
|
@ -0,0 +1,55 @@
|
||||||
|
<% delete_allowed = User.current.admin? %>
|
||||||
|
<div class="re_con_top">
|
||||||
|
<p class="f_l c_blue f_b f_14">共有 <%= all_attachments.count%> 个资源</p>
|
||||||
|
<p class="f_r" style="color: #808080">
|
||||||
|
<% 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"} %> /
|
||||||
|
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||||
|
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||||
|
<% else %>
|
||||||
|
按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||||
|
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||||
|
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||||
|
<% end %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<div class="files_tag" id="files_tag">
|
||||||
|
<%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<div class="for_img_thumbnails">
|
||||||
|
<% curse_attachments.each do |file| %>
|
||||||
|
<% if file.is_public? || User.current.admin? %>
|
||||||
|
<div class="re_con_box" id="container_files_<%= file.id %>">
|
||||||
|
<div class="">
|
||||||
|
<%= link_to truncate(file.filename,length: 35, 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 => "c_dblue f_14 f_b f_l" %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="mt5">
|
||||||
|
<p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||||
|
<%= link_to( l(:button_delete), attachment_path(file),
|
||||||
|
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @org_subfield.id && file.container_type == "OrgSubfield"%>
|
||||||
|
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="tag_h">
|
||||||
|
<!-- container_type = 1 代表是课程里的资源 -->
|
||||||
|
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||||
|
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div><!---re_con_box end-->
|
||||||
|
<% else %>
|
||||||
|
<div class="re_con_box"><span class='fr mr10 pr_join_span '><%= file.filename %>是私有资源</span></div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<ul class="wlist">
|
||||||
|
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||||
|
</ul>
|
||||||
|
<div class="cl"></div>
|
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
<div id="popbox_upload" class="mb10" style="margin-top: -30px;color:#15bccf; font-size:16px;">
|
||||||
|
<div class="upload_con">
|
||||||
|
<h2 style="text-align: center"><%= l(:label_upload_files)%></h2>
|
||||||
|
<div class="upload_box">
|
||||||
|
<%= error_messages_for 'attachment' %>
|
||||||
|
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
|
||||||
|
|
||||||
|
<%= form_tag(org_subfield_files_path(org_subfield), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
|
||||||
|
<!-- <label style="margin-top:3px;"><#%= l(:label_file_upload)%></label> -->
|
||||||
|
<!--<input type="hidden" name="in_org_subfield_toolbar" value="Y">-->
|
||||||
|
<input type="hidden" name="org_subfield_attachment_type" value="<%= org_subfield_attachment_type%>">
|
||||||
|
<%= render :partial => 'files/attachement_list',:locals => {:org_subfield => org_subfield} %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||||
|
<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<% content_for :header_tags do %>
|
||||||
|
<%= javascript_include_tag 'attachments' %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function submit_resource()
|
||||||
|
{
|
||||||
|
$('#submit_resource').parent().submit();
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -52,6 +52,17 @@ $('#upload_file_div').slideToggle('slow');
|
||||||
setTimeout( function(){div.remove();},3000)
|
setTimeout( function(){div.remove();},3000)
|
||||||
<% end %>
|
<% end %>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
<% elsif @org_subfield %>
|
||||||
|
hideModal();
|
||||||
|
$("#resource_list").html('<%= j(render partial: "subfield_files" ,locals: {org_subfield: @org_subfield}) %>');
|
||||||
|
// $("#courses_files_count_info").html("<%#= @all_attachments.count%>");
|
||||||
|
// $("#courses_files_count_nav").html("(<%#= @all_attachments.count%>)")
|
||||||
|
// 添加文件上传成功提示,
|
||||||
|
<% unless params[:attachments].nil? %>
|
||||||
|
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
|
||||||
|
$("#org_subfield_list").prepend(div);
|
||||||
|
setTimeout( function(){div.remove();},3000)
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
$(document).ready(img_thumbnails);
|
$(document).ready(img_thumbnails);
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
<div id="resource_list">
|
<div id="resource_list">
|
||||||
<% if @isproject %>
|
<% if @container_type == 0 %>
|
||||||
<%= render :partial => 'project_file_new', locals: {project: @project} %>
|
<%= render :partial => 'project_file_new', locals: {project: @project} %>
|
||||||
<% else %>
|
<% elsif @container_type == 1 %>
|
||||||
<%= render :partial => 'course_file', locals: {course: @course} %>
|
<%= render :partial => 'course_file', locals: {course: @course} %>
|
||||||
|
<% elsif @container_type == 2 %>
|
||||||
|
<%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
<script>
|
||||||
|
function searchone4reload(fileid){
|
||||||
|
var url = "<%= searchone4reload_course_files_path(@course)%>";
|
||||||
|
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 show_upload(obj)
|
||||||
|
{
|
||||||
|
switch(obj)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 1}) %>');
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 2}) %>');
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 3}) %>');
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 4}) %>');
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 6}) %>');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 5}) %>');
|
||||||
|
}
|
||||||
|
showModal('ajax-modal', '513px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||||
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
|
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeModal()
|
||||||
|
{
|
||||||
|
hideModal($("#popbox_upload"));
|
||||||
|
}
|
||||||
|
|
||||||
|
function presscss(id)
|
||||||
|
{
|
||||||
|
if(id == "incourse")
|
||||||
|
{
|
||||||
|
$('#incourse').attr("class", "re_schbtn b_dblue");
|
||||||
|
$('#insite').attr("class", "re_schbtn b_lblue");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#incourse').attr("class", "re_schbtn b_lblue");
|
||||||
|
$('#insite').attr("class", "re_schbtn b_dblue");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function buttoncss()
|
||||||
|
{
|
||||||
|
$('#incourse').attr("class", "re_schbtn b_lblue");
|
||||||
|
$('#insite').attr("class", "re_schbtn b_lblue");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="resource"><!--资源库内容开始--->
|
||||||
|
<div class="re_top">
|
||||||
|
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %>
|
||||||
|
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
|
||||||
|
<%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %>
|
||||||
|
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||||
|
<% end %>
|
||||||
|
<% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %> <!-- show_window('light','fade','20%','35%')-->
|
||||||
|
<!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>-->
|
||||||
|
<p class="c_grey fr mt10 mr5">
|
||||||
|
上传:
|
||||||
|
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(1);">课件</a> |
|
||||||
|
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(2);">软件</a> |
|
||||||
|
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(3);">媒体</a> |
|
||||||
|
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(4);">代码</a> |
|
||||||
|
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(6);">论文</a> |
|
||||||
|
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(5);">其他</a>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</div><!---re_top end-->
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<div class="re_con" id="course_list">
|
||||||
|
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
|
||||||
|
</div><!---re_con end-->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% html_title(l(:label_attachment_plural)) -%>
|
|
@ -29,7 +29,7 @@
|
||||||
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %>
|
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %>
|
||||||
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%>
|
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%#= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %>
|
<%= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="homepageLeftMenuCourses" id="homepageLeftMenuField_<%= field.id %>" style="display:none;">
|
<div class="homepageLeftMenuCourses" id="homepageLeftMenuField_<%= field.id %>" style="display:none;">
|
||||||
|
|
|
@ -72,7 +72,17 @@ RedmineApp::Application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :org_subfields do
|
resources :org_subfields do
|
||||||
|
resources :files, :only => [:index, :new, :create] do
|
||||||
|
collection do
|
||||||
|
match "getattachtype", :via => [:get, :post]
|
||||||
|
match "search",:via => [:post,:get]
|
||||||
|
match "searchone4reload",:via => [:post,:get]
|
||||||
|
match "search_tag_attachment", :via => [:post,:get]
|
||||||
|
end
|
||||||
|
member do
|
||||||
|
match "quote_resource_show", :via => [:get]
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :org_document_comments do
|
resources :org_document_comments do
|
||||||
|
|
|
@ -1214,3 +1214,7 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat;
|
||||||
.mb10 {margin-bottom: 10px}
|
.mb10 {margin-bottom: 10px}
|
||||||
.mb15 {margin-bottom: 15px}
|
.mb15 {margin-bottom: 15px}
|
||||||
div.disable_link {background-color: #c1c1c1 !important;}
|
div.disable_link {background-color: #c1c1c1 !important;}
|
||||||
|
|
||||||
|
/*新课程资源库*/
|
||||||
|
.reCon{ margin:5px; width:710px;}
|
||||||
|
.reTop{width:710px; height:40px; background:#eaeaea; padding:5px;}
|
|
@ -71,3 +71,16 @@ a.linkGrey8:hover {color:#585858;}
|
||||||
#orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;}
|
#orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;}
|
||||||
|
|
||||||
.orgListStatus {width:55px; float:left;}
|
.orgListStatus {width:55px; float:left;}
|
||||||
|
.reCon{ margin:5px; width:710px;}
|
||||||
|
.retop{width:710px; height:40px; background:#eaeaea; padding:5px;}
|
||||||
|
.resources {width:718px; background-color:#ffffff; padding:15px; border:1px solid #dddddd;float: right}
|
||||||
|
.re_search{ margin-top:7px; margin-left:5px;}
|
||||||
|
.re_search{ margin-top:7px; margin-left:5px;}
|
||||||
|
.re_schbox{ width:240px; height:24px; border:1px solid #64bdd9; color:#666666;}
|
||||||
|
.re_schbtn{ width:60px; height:26px; color:#fff; margin-right:5px; border:none; margin-left:0px;padding-left: 0px;}
|
||||||
|
.b_lblue{ background:#64bdd9;}
|
||||||
|
.c_grey{ color:#888888;}
|
||||||
|
.re_con{ margin:5px; width:665px;}
|
||||||
|
.re_con_top{color:#494949; }
|
||||||
|
.re_con_top span{ color:#999999; font-weight:bold;}
|
||||||
|
ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
|
Loading…
Reference in New Issue