Created hack, when entries were selected and downloaded (by pressing download button) and after that downloading of other selected files couldn't be achieved without page reload (simply pressing download button does nothing).

This commit is contained in:
Назар Вінничук 2012-10-24 17:38:34 +03:00
parent 9260bb2a7a
commit f0f61e859b

View File

@ -43,7 +43,7 @@
</div>
<%= render "custom_fields", :object => @folder %>
</div>
<%= form_tag({:action => :entries_operation, :id => @project, :folder_id => @folder}, :method => :post,
<%= form_tag({:action => :entries_operation, :id => @project, :folder_id => @folder}, :method => :post,
:class => "dmfs_entries", :id => "entries_form") do %>
<%= hidden_field_tag("action") %>
<div class="controls" style="float: left">
@ -52,7 +52,7 @@
<% if User.current.allowed_to?(:file_manipulation, @project) && (!@folder.nil? && !@folder.locked_for_user?) %>
<button type="button" id="entries_delete_button" title="<%=l(:title_delete_checked)%>"><%=l(:button_delete)%></button>
<% end %>
</div>
</div>
<table class="display entries" id="browser">
<thead>
<tr id="root">
@ -101,7 +101,7 @@
:title => l(:title_notifications_active_deactivate)) %>
<% else %>
<%= link_to_function(image_tag("notifynot.png", :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:action => 'notify_activate', :id => @project, :folder_id => subfolder)}')",
"manipulation_link('#{url_for(:action => 'notify_activate', :id => @project, :folder_id => subfolder)}')",
:title => l(:title_notifications_not_active_activate)) %>
<% end %>
</div>
@ -109,7 +109,7 @@
<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"),
<%= link_to(image_tag("edit.png", :class =>"detail_icon"),
{:action => "edit", :id => @project, :folder_id => subfolder },
:title => l(:link_edit, :title => h(subfolder.title))) unless subfolder.locked_for_user? %>
</div>
@ -119,7 +119,7 @@
<% if subfolder.locked? %>
<% if subfolder.unlockable? %>
<%= link_to_function(image_tag("unlock.png", :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:controller => "dmsf", :action => 'unlock',
"manipulation_link('#{url_for(:controller => "dmsf", :action => 'unlock',
:id => @project, :folder_id => subfolder)}')",
:title => l(:title_unlock_file))%>
<% else %>
@ -127,14 +127,14 @@
<% end %>
<% else %>
<%= link_to_function(image_tag("lock.png", :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:controller => "dmsf", :action => 'lock',
"manipulation_link('#{url_for(:controller => "dmsf", :action => 'lock',
:id => @project, :folder_id => subfolder)}')",
:title => l(:title_lock_file)) %>
<% end %>
&nbsp;
<% end %>
<%= link_to_function(image_tag("delete.png", :plugin => :redmine_dmsf),
"confirmation_link('#{url_for(:action => 'delete', :id => @project, :folder_id => @folder, :delete_folder_id => subfolder)}')",
"confirmation_link('#{url_for(:action => 'delete', :id => @project, :folder_id => @folder, :delete_folder_id => subfolder)}')",
:title => l(:title_delete)) unless (subfolder.locked_for_user?)%>
</div>
</div>
@ -161,7 +161,7 @@
<td class="modified">
<%= format_time(file.last_revision.updated_at) %>
<% if file.locked_for_user? %>
<%= link_to(image_tag("locked.png", :plugin => :redmine_dmsf),
<%= link_to(image_tag("locked.png", :plugin => :redmine_dmsf),
{:controller => "users", :action => "show", :id => file.lock.reverse[0].user },
:title => l(:title_locked_by_user, :user => file.lock.reverse[0].user.to_s)) %>
<% elsif file.locked? %>
@ -194,7 +194,7 @@
<% 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"),
<%= 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>
@ -212,7 +212,7 @@
<%= link_to_function(image_tag("lock.png", :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:controller => "dmsf_files", :action => 'lock', :id => file)}')",
:title => l(:title_lock_file)) %>
<% end %>
<% end %>
&nbsp;
<% end %>
<% if User.current.allowed_to?(:file_manipulation, @project) && !file.locked_for_user? %>
@ -240,7 +240,7 @@
jQuery("#entries_form").submit();
}
})
jQuery("#check_all_entries").click(function(event) {
var $this = jQuery(this);
if($this.prop("checked")) {
@ -248,7 +248,7 @@
} else {
jQuery("input[type=checkbox]", jQuery("#browser > tbody")).prop("checked", false);
}
})
})
</script>
<%
@ -261,7 +261,7 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !
<%= 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" %>
@ -289,7 +289,7 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !
return "<%= l(:label_number_of_folders)%>: <%= @subfolders.length %>, <%= l(:label_number_of_documents)%>: <%= @files.length %>";
}
});
jQuery("[data-downloadurl]").each(function() {
var url = this.getAttribute("data-downloadurl");
if (this.addEventListener) {
@ -300,13 +300,17 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !
},false);
}
});
jQuery("#entries_form").submit(function () {
jQuery(this).removeAttr('data-submitted');
});
});
function manipulation_link(action) {
jQuery("#entries_form").attr("action", action);
jQuery("#entries_form").submit();
};
function confirmation_link(action) {
if(!window.confirm("<%= l(:question_do_you_really_want_to_delete_this_entry) %>")) return;
jQuery("#entries_form").attr("action", action);
@ -315,6 +319,6 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !
</script>
<% end %>
<%= render(:partial => "multi_upload") if (User.current.allowed_to?(:file_manipulation, @project) &&
<%= render(:partial => "multi_upload") if (User.current.allowed_to?(:file_manipulation, @project) &&
( @folder.nil? || (!@folder.nil? &&!@folder.locked_for_user?) ) ) %>
<br />