|
|
|
@ -6,55 +6,20 @@
|
|
|
|
|
<% attachments.each do |attach| %>
|
|
|
|
|
<ul class="resource-list" onmouseover="if($('#contextMenu').css('display') != 'block')$(this).children().css('background-color', '#e1e1e1')" onmouseout=" if($('#contextMenu').css('display') == 'none')$(this).children().css('background-color', 'white')">
|
|
|
|
|
<li class="resource-list-checkbox fl">
|
|
|
|
|
<% if private_attachment_allow(attach.id) && (@type == "6" || @type == "2") %>
|
|
|
|
|
<input name="checkbox1[]" type="checkbox" disabled="disabled" data-has-history="<%= attach.attachment_histories.count == 0 ? 'N' : 'Y' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
|
|
|
|
|
<% else %>
|
|
|
|
|
<input name="checkbox1[]" type="checkbox" data-has-history="<%= attach.attachment_histories.count == 0 ? 'N' : 'Y' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
|
|
|
|
|
<% end %>
|
|
|
|
|
<input name="checkbox1[]" type="checkbox" data-has-history="<%= attach.attachment_histories.count == 0 ? 'N' : 'Y' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
|
|
|
|
|
<!--<input name="checkbox2" type="checkbox" value="" class="resourcesCheckbox" />-->
|
|
|
|
|
</li>
|
|
|
|
|
<li class="resource-list-name fl">
|
|
|
|
|
<% if private_attachment_allow(attach.id) %>
|
|
|
|
|
<a style="cursor: default" class = "resourcesBlack resource-list-middle hidden mw280" title="<%= attach.filename %>"><%= attach.filename %> </a>
|
|
|
|
|
<% else %>
|
|
|
|
|
<%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename, :class => 'resourcesBlack resource-list-middle hidden mw280' %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if private_attachment_allow(attach.id) && (@type == "6" || @type == "2") %>
|
|
|
|
|
<img src="/images/locked.png" alt="私有" title="私有" class="resource-list-middle" height="16" width="16">
|
|
|
|
|
<% end %>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="resource-list-apply fr" id="resource_apply_status_<%=attach.id %>">
|
|
|
|
|
<% if private_attachment_allow(attach.id) && (@type == "6" || @type == "2") %>
|
|
|
|
|
<% ah = attach.get_status_by_attach(User.current.id) %>
|
|
|
|
|
<% if ah.nil? %>
|
|
|
|
|
<%= link_to("请求分享", apply_resource_user_path(User.current.id, :attachment_id => attach.id), :class => 'green_btn_share c_white', :remote => true) %>
|
|
|
|
|
<% elsif ah == 1 %>
|
|
|
|
|
等待回复
|
|
|
|
|
<% elsif ah == 2 %>
|
|
|
|
|
可引用
|
|
|
|
|
<% elsif ah == 3 %>
|
|
|
|
|
已拒绝
|
|
|
|
|
<% end %>
|
|
|
|
|
<% else %>
|
|
|
|
|
<% ah = attach.get_status_by_attach(User.current.id) %>
|
|
|
|
|
<% if ah == 2 %>
|
|
|
|
|
可引用
|
|
|
|
|
<% else %>
|
|
|
|
|
--
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename, :class => 'resourcesBlack resource-list-middle hidden mw280' %>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="resource-list-time fr"><%= format_date(attach.created_on) %></li>
|
|
|
|
|
<li class="resource-list-quote fr"><%= attach.quotes.nil? ? 0 : attach.quotes %></li>
|
|
|
|
|
<li class="resource-list-download fr"><%= attach.downloads %></li>
|
|
|
|
|
<li style="display: none"><%= attach.author_id %></li>
|
|
|
|
|
<li class="resource-list-size fr"><%= (number_to_human_size(attach.filesize)).gsub("ytes", "") %></li>
|
|
|
|
|
<li class="resource-list-uploader fr hidden"><%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %></li>
|
|
|
|
|
<li class="resource-list-uploader fr hidden"><%= User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %></li>
|
|
|
|
|
<li class="resource-list-type fr"><%= get_resource_type(attach.container_type)%></li>
|
|
|
|
|
<li class="resource-list-from fr hidden" title="<%= get_resource_origin(attach) %>"><%= get_resource_origin(attach) %></li>
|
|
|
|
|
<li style="display: none"><%= private_attachment_allow(attach.id) %></li>
|
|
|
|
|
<li style="display: none"><%= attach.get_apply_resource_status(attach.id, User.current.id) %></li>
|
|
|
|
|
<li style="display: none"><%= private_attachment_allow(attach.id) ? 0 : 1 %></li>
|
|
|
|
|
<li style="display: none"><%= attach.id %></li>
|
|
|
|
|
</ul>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
@ -104,7 +69,7 @@
|
|
|
|
|
document.oncontextmenu = function() {return true;}
|
|
|
|
|
line.children().css("background-color",'white');
|
|
|
|
|
id = line.children().last().html();
|
|
|
|
|
user_id = line.children().eq(6).html();
|
|
|
|
|
user_id = line.children().eq(5).html();
|
|
|
|
|
allow = line.children().eq(13).html();
|
|
|
|
|
if( allow == 0){
|
|
|
|
|
alert('您无权发送私有资源')
|
|
|
|
@ -219,7 +184,7 @@
|
|
|
|
|
}
|
|
|
|
|
line.children().css("background-color", 'white');
|
|
|
|
|
id = line.children().last().html();
|
|
|
|
|
user_id = line.children().eq(6).html();
|
|
|
|
|
user_id = line.children().eq(5).html();
|
|
|
|
|
if(user_id === '<%= User.current.id%>') {
|
|
|
|
|
if(line.children().first().children().data('hasHistory') == 'Y'){
|
|
|
|
|
alert('该资源存在历史版本,不能删除');
|
|
|
|
@ -228,7 +193,7 @@
|
|
|
|
|
if (confirm('确定要删除资源"' + line.children().eq(1).children().attr('title').trim() + '"么?')) {
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'post',
|
|
|
|
|
url: '<%= user_resource_delete_user_path(User.current.id)%>' + '?resource_id=' + id + '&type=<%=@type %>&status=<%=@status %>'
|
|
|
|
|
url: '<%= user_resource_delete_user_path(User.current.id) %>' + '?resource_id=' + id + '&type=<%= @type %>&status=<%= @status %>'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|