redmine_dmsf/app/views/dmsf/show.html.erb
vit.jonas@gmail.com c27ff4008a * file list styling
git-svn-id: http://redmine-dmsf.googlecode.com/svn/trunk/redmine_dmsf@171 5e329b0b-a2ee-ea63-e329-299493fc886d
2011-06-17 13:12:23 +00:00

253 lines
11 KiB
Plaintext

<% html_title(l(:dmsf)) %>
<div class="contextual">
<% if User.current.allowed_to?(:folder_manipulation, @project) %>
<% if @folder.nil? %>
<%= link_to("", {:action => "edit_root", :id => @project},
:title => l(:link_edit, :title => l(:link_documents)), :class => "icon icon-edit") %> &nbsp;
<% else @folder.nil? %>
<%= link_to("", {:action => "edit", :id => @project, :folder_id => @folder },
:title => l(:link_edit, :title => h(@folder.title)), :class => "icon icon-edit") %> &nbsp;
<% end %>
<%= link_to("", {:action => "new", :id => @project, :parent_id => @folder },
:title => l(:link_create_folder), :class => "icon icon-add") %>
<% end %>
</div>
<% path = @folder.nil? ? [] : @folder.dmsf_path %>
<h2>
<%= render(:partial => 'path', :locals => {:path => path}) %>
</h2>
<div class="wiki">
<%= textilizable(@folder.nil? ? @project.dmsf_description : @folder.description) %>
</div>
<%
form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder}, :method => :post,
:class => "dmfs_entries", :id => "entries_form") do
%>
<%= hidden_field_tag("action") %>
<table class="display entries" id="browser">
<thead>
<tr id="root">
<th class="check">
<input id="check_all_entries" title="<%= l(:title_check_uncheck_all_for_zip_download_or_email) %>" type="checkbox" />
</th>
<th><%= l(:link_title) %></th>
<th><%= l(:link_size) %></th>
<th><%= l(:link_modified) %></th>
<th><%= l(:link_ver) %></th>
<th><%= l(:link_author) %></th>
<th></th>
<th class="hidden"></th>
<th class="hidden"></th>
</tr>
</thead>
<tbody>
<% @subfolders.each do |subfolder| %>
<tr class="dir">
<td class="check"><%= check_box_tag("subfolders[]", subfolder.id, false, :title => l(:title_check_for_zip_download_or_email)) %></td>
<td class="title">
<%= link_to(h(subfolder.title),
{:action => "show", :id => @project, :folder_id => subfolder},
:class => "icon icon-folder") %>
<div class="filename" title="<%= l(:title_number_of_files_in_directory)%>">[<%= subfolder.deep_file_count %>]</div>
</td>
<td class="size">-</td>
<td class="modified">-</td>
<td class="version">-</td>
<td class="author">-</td>
<td class="actions">
<% if User.current.allowed_to?(:file_approval, @project) %>
<div class="right_icon_box">
<% if subfolder.notification %>
<%= link_to(image_tag("notify.png", :plugin => "redmine_dmsf"),
{:action => "notify_deactivate", :id => @project,
:folder_id => subfolder}, :title => l(:title_notifications_active_deactivate)) %>
<% else %>
<%= link_to(image_tag("notifynot.png", :plugin => "redmine_dmsf"),
{:action => "notify_activate", :id => @project,
:folder_id => subfolder}, :title => l(:title_notifications_not_active_activate)) %>
<% end %>
</div>
<% end %>
<div class="right_icon_box" style="width: 70px;">
<% if User.current.allowed_to?(:folder_manipulation, @project) %>
<div style="float: left">
<%= link_to(image_tag("edit.png", :class =>"detail_icon"),
{:action => "edit", :id => @project, :folder_id => subfolder },
:title => l(:link_edit, :title => h(subfolder.title))) %>
</div>
<% end %>
<div style="float: right">
<%= link_to(image_tag("delete.png", :plugin => "redmine_dmsf"),
{:action => "delete", :id => @project,
:folder_id => @folder, :delete_folder_id => subfolder}, :class => "delete-link",
:title => l(:title_delete)) if User.current.allowed_to?(:folder_manipulation, @project) %>
</div>
</div>
<br class="clear" />
</td>
<td class="hidden">0</td>
<td class="hidden"><%= subfolder.deep_file_count %></td>
</tr>
<% end %>
<% @files.each do |file| %>
<tr class="file">
<td class="check"><%= check_box_tag("files[]", file.id, false, :title => l(:title_check_for_zip_download_or_email)) %></td>
<td class="title">
<%= link_to(h(file.last_revision.display_title),
{:controller => :dmsf_files, :action => "show", :id => file, :download => ""},
:class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}",
:title => l(:title_title_version_version_download, :title => h(file.title), :version => file.version)) %>
<div class="filename" title="<%= l(:title_filename_for_download)%>"><%= h(file.display_name) %></div>
</td>
<td class="size"><%= number_to_human_size(file.last_revision.size) unless file.last_revision.nil? %></td>
<td class="modified">
<%= file.last_revision.updated_at.strftime("%Y-%m-%d %H:%M") unless file.last_revision.nil? %>
<% if file.locked_for_user? %>
<%= link_to(image_tag("locked.png", :plugin => "redmine_dmsf"),
{:controller => "users", :action => "show", :id => file.locks[0].user },
:title => l(:title_locked_by_user, :user => file.locks[0].user.to_s)) %>
<% else
if file.locked? %>
<%= image_tag("lockedbycurrent.png", :title => l(:title_locked_by_you), :plugin => "redmine_dmsf") %>
<% end %>
<% end %>
</td>
<td class="version">
<%= file.last_revision.version unless file.last_revision.nil? %>
<% case file.last_revision.workflow
when 1 then %><%= image_tag("waitingforapproval.png", :title => l(:title_waiting_for_approval),
:plugin => "redmine_dmsf") %>
<% when 2 then %><%= image_tag("approved.png", :title => l(:title_approved),
:plugin => "redmine_dmsf") %>
<% end %>
</td>
<td class="author"><%= h(file.last_revision.user) unless file.last_revision.nil? %></td>
<td class="actions">
<% if User.current.allowed_to?(:file_approval, @project) %>
<div class="right_icon_box">
<% if file.notification %>
<%= link_to(image_tag("notify.png", :plugin => "redmine_dmsf"),
{:controller => "dmsf_files", :action => "notify_deactivate", :id => file},
:title => l(:title_notifications_active_deactivate)) %>
<% else %>
<%= link_to(image_tag("notifynot.png", :plugin => "redmine_dmsf"),
{:controller => "dmsf_files", :action => "notify_activate", :id => file},
:title => l(:title_notifications_not_active_activate)) %>
<% end %>
</div>
<% end %>
<div class="right_icon_box" style="width: 70px;">
<div style="float: left">
<%= link_to(image_tag("filedetails.png", :plugin => "redmine_dmsf", :class =>"detail_icon"),
{:controller => "dmsf_files", :action => :show, :id => file },
:title => l(:link_details, :title =>h(file.last_revision.title))) %>
</div>
<div style="float: right; width: 44px;">
<% unless file.locked_for_user? && !User.current.allowed_to?(:force_file_unlock, @project)%>
<% if file.locked? %>
<%= link_to(image_tag("unlock.png", :plugin => "redmine_dmsf"),
{:controller => "dmsf_files", :action => "unlock", :id => file },
:title => l(:title_unlock_file)) %>
<% else %>
<%= link_to(image_tag("lock.png", :plugin => "redmine_dmsf"),
{:controller => "dmsf_files", :action => "lock", :id => file },
:title => l(:title_lock_file)) %>
<% end %>
&nbsp;
<% end %>
<% if User.current.allowed_to?(:file_manipulation, @project) && !file.locked_for_user? %>
<%= link_to(image_tag("delete.png", :plugin => "redmine_dmsf"),
{:controller => "dmsf_files", :action => "delete", :id => file},
:class => "delete-link", :title => l(:title_delete)) %>
<% end %>
</div>
</div>
<br class="clear" />
</td>
<td class="hidden">1</td>
<td class="hidden"><%=file.last_revision.size%></td>
</tr>
<% end %>
</tbody>
</table>
<div class="controls" style="float: left">
<%= submit_tag(l(:submit_download), :title => l(:title_download_checked), :name => "download_entries") %>
<%= submit_tag(l(:submit_email), :title => l(:title_send_checked_by_email), :name => "email_entries") %>
<% if User.current.allowed_to?(:file_manipulation, @project) %>
<button type="button" id="entries_delete_button" title="<%=l(:title_delete_checked)%>"><%=l(:button_delete)%></button>
<% end %>
</div>
<br />
<% end %>
<script type="text/javascript">
jQuery("a.delete-link").click(function(event) {
if(!window.confirm("<%= l(:question_do_you_really_want_to_delete_this_entry) %>")) event.preventDefault();
})
jQuery("#entries_delete_button").click(function(event) {
if(window.confirm("<%= l(:question_do_you_really_want_to_delete_entries) %>")) {
jQuery("#entries_form").attr("action", "<%= url_for(:action => 'delete_entries', :id => @project, :folder_id => @folder) %>");
jQuery("#entries_form").submit();
}
})
jQuery("#check_all_entries").click(function(event) {
var $this = jQuery(this);
if($this.prop("checked")) {
jQuery("input[type=checkbox]", jQuery("#browser > tbody")).prop("checked", true);
} else {
jQuery("input[type=checkbox]", jQuery("#browser > tbody")).prop("checked", false);
}
})
</script>
<%
sUrl = "jquery.dataTables/en.json"
sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !I18n.locale.to_s.match(/^en.*/)
%>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "jquery-ui/jquery-ui-1.8.13.css", :plugin => "redmine_dmsf" %>
<%= stylesheet_link_tag "plupload/jquery.ui.plupload.css", :plugin => "redmine_dmsf" %>
<%= stylesheet_link_tag "jquery.dataTables/jquery-ui.dataTables.css", :plugin => "redmine_dmsf" %>
<%= stylesheet_link_tag "dmsf", :plugin => "redmine_dmsf" %>
<%= javascript_include_tag "jquery-1.6.1.min.js", :plugin => "redmine_dmsf" %>
<%= javascript_include_tag "jquery-ui-1.8.13.min.js", :plugin => "redmine_dmsf" %>
<%= javascript_include_tag "jquery.dataTables/jquery.dataTables.min.js", :plugin => "redmine_dmsf" %>
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function() {
jQuery("#browser").dataTable({
"bJQueryUI": true,
"oLanguage": {
'sUrl': '<%= Engines::RailsExtensions::AssetHelpers.plugin_asset_path("redmine_dmsf", "javascripts", sUrl) %>'
},
"bAutoWidth": false,
"bPaginate": false,
"aaSorting": [[1,'asc']],
"aaSortingFixed": [[7,'asc']],
"aoColumnDefs": [
{ "bSearchable": false, "aTargets": [0, 6, 7, 8] },
{ "bSortable": false, "aTargets": [0, 6, 7] },
{ "iDataSort": 8, "aTargets": [ 2 ] }
],
"fnInitComplete": function() {
jQuery("div.controls").prependTo(jQuery("#browser_wrapper div.fg-toolbar")[0]);
},
"fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
return "<%= l(:label_number_of_folders)%>: <%= @subfolders.length %>, <%= l(:label_number_of_documents)%>: <%= @files.length %>";
}
});
});
</script>
<% end %>
<%= render(:partial => "multi_upload") if User.current.allowed_to?(:file_manipulation, @project) %>
<br />