Merge pull request #61 from ux/master
Improved compatibility with XSendFile apache2 module and Redmine 2.x
This commit is contained in:
commit
1987a6a0b8
@ -43,7 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<%= render "custom_fields", :object => @folder %>
|
<%= render "custom_fields", :object => @folder %>
|
||||||
</div>
|
</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 %>
|
:class => "dmfs_entries", :id => "entries_form") do %>
|
||||||
<%= hidden_field_tag("action") %>
|
<%= hidden_field_tag("action") %>
|
||||||
<div class="controls" style="float: left">
|
<div class="controls" style="float: left">
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<% if User.current.allowed_to?(:file_manipulation, @project) && (!@folder.nil? && !@folder.locked_for_user?) %>
|
<% 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>
|
<button type="button" id="entries_delete_button" title="<%=l(:title_delete_checked)%>"><%=l(:button_delete)%></button>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<table class="display entries" id="browser">
|
<table class="display entries" id="browser">
|
||||||
<thead>
|
<thead>
|
||||||
<tr id="root">
|
<tr id="root">
|
||||||
@ -101,7 +101,7 @@
|
|||||||
:title => l(:title_notifications_active_deactivate)) %>
|
:title => l(:title_notifications_active_deactivate)) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to_function(image_tag("notifynot.png", :plugin => :redmine_dmsf),
|
<%= 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)) %>
|
:title => l(:title_notifications_not_active_activate)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@ -109,7 +109,7 @@
|
|||||||
<div class="right_icon_box" style="width: 70px;">
|
<div class="right_icon_box" style="width: 70px;">
|
||||||
<% if User.current.allowed_to?(:folder_manipulation, @project) %>
|
<% if User.current.allowed_to?(:folder_manipulation, @project) %>
|
||||||
<div style="float: left">
|
<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 },
|
{:action => "edit", :id => @project, :folder_id => subfolder },
|
||||||
:title => l(:link_edit, :title => h(subfolder.title))) unless subfolder.locked_for_user? %>
|
:title => l(:link_edit, :title => h(subfolder.title))) unless subfolder.locked_for_user? %>
|
||||||
</div>
|
</div>
|
||||||
@ -119,7 +119,7 @@
|
|||||||
<% if subfolder.locked? %>
|
<% if subfolder.locked? %>
|
||||||
<% if subfolder.unlockable? %>
|
<% if subfolder.unlockable? %>
|
||||||
<%= link_to_function(image_tag("unlock.png", :plugin => :redmine_dmsf),
|
<%= 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)}')",
|
:id => @project, :folder_id => subfolder)}')",
|
||||||
:title => l(:title_unlock_file))%>
|
:title => l(:title_unlock_file))%>
|
||||||
<% else %>
|
<% else %>
|
||||||
@ -127,14 +127,14 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to_function(image_tag("lock.png", :plugin => :redmine_dmsf),
|
<%= 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)}')",
|
:id => @project, :folder_id => subfolder)}')",
|
||||||
:title => l(:title_lock_file)) %>
|
:title => l(:title_lock_file)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to_function(image_tag("delete.png", :plugin => :redmine_dmsf),
|
<%= 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?)%>
|
:title => l(:title_delete)) unless (subfolder.locked_for_user?)%>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -161,7 +161,7 @@
|
|||||||
<td class="modified">
|
<td class="modified">
|
||||||
<%= format_time(file.last_revision.updated_at) %>
|
<%= format_time(file.last_revision.updated_at) %>
|
||||||
<% if file.locked_for_user? %>
|
<% 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 },
|
{:controller => "users", :action => "show", :id => file.lock.reverse[0].user },
|
||||||
:title => l(:title_locked_by_user, :user => file.lock.reverse[0].user.to_s)) %>
|
:title => l(:title_locked_by_user, :user => file.lock.reverse[0].user.to_s)) %>
|
||||||
<% elsif file.locked? %>
|
<% elsif file.locked? %>
|
||||||
@ -194,7 +194,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<div class="right_icon_box" style="width: 70px;">
|
<div class="right_icon_box" style="width: 70px;">
|
||||||
<div style="float: left">
|
<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 },
|
{:controller => "dmsf_files", :action => :show, :id => file },
|
||||||
:title => l(:link_details, :title =>h(file.last_revision.title))) %>
|
:title => l(:link_details, :title =>h(file.last_revision.title))) %>
|
||||||
</div>
|
</div>
|
||||||
@ -212,7 +212,7 @@
|
|||||||
<%= link_to_function(image_tag("lock.png", :plugin => :redmine_dmsf),
|
<%= link_to_function(image_tag("lock.png", :plugin => :redmine_dmsf),
|
||||||
"manipulation_link('#{url_for(:controller => "dmsf_files", :action => 'lock', :id => file)}')",
|
"manipulation_link('#{url_for(:controller => "dmsf_files", :action => 'lock', :id => file)}')",
|
||||||
:title => l(:title_lock_file)) %>
|
:title => l(:title_lock_file)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if User.current.allowed_to?(:file_manipulation, @project) && !file.locked_for_user? %>
|
<% if User.current.allowed_to?(:file_manipulation, @project) && !file.locked_for_user? %>
|
||||||
@ -240,7 +240,7 @@
|
|||||||
jQuery("#entries_form").submit();
|
jQuery("#entries_form").submit();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
jQuery("#check_all_entries").click(function(event) {
|
jQuery("#check_all_entries").click(function(event) {
|
||||||
var $this = jQuery(this);
|
var $this = jQuery(this);
|
||||||
if($this.prop("checked")) {
|
if($this.prop("checked")) {
|
||||||
@ -248,7 +248,7 @@
|
|||||||
} else {
|
} else {
|
||||||
jQuery("input[type=checkbox]", jQuery("#browser > tbody")).prop("checked", false);
|
jQuery("input[type=checkbox]", jQuery("#browser > tbody")).prop("checked", false);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</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 "plupload/jquery.ui.plupload.css", :plugin => "redmine_dmsf" %>
|
||||||
<%= stylesheet_link_tag "jquery.dataTables/jquery-ui.dataTables.css", :plugin => "redmine_dmsf" %>
|
<%= stylesheet_link_tag "jquery.dataTables/jquery-ui.dataTables.css", :plugin => "redmine_dmsf" %>
|
||||||
<%= stylesheet_link_tag "dmsf", :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-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-ui-1.8.13.min.js", :plugin => "redmine_dmsf" %>
|
||||||
<%= javascript_include_tag "jquery.dataTables/jquery.dataTables.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 %>";
|
return "<%= l(:label_number_of_folders)%>: <%= @subfolders.length %>, <%= l(:label_number_of_documents)%>: <%= @files.length %>";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery("[data-downloadurl]").each(function() {
|
jQuery("[data-downloadurl]").each(function() {
|
||||||
var url = this.getAttribute("data-downloadurl");
|
var url = this.getAttribute("data-downloadurl");
|
||||||
if (this.addEventListener) {
|
if (this.addEventListener) {
|
||||||
@ -300,13 +300,17 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !
|
|||||||
},false);
|
},false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
jQuery("#entries_form").submit(function () {
|
||||||
|
jQuery(this).removeAttr('data-submitted');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function manipulation_link(action) {
|
function manipulation_link(action) {
|
||||||
jQuery("#entries_form").attr("action", action);
|
jQuery("#entries_form").attr("action", action);
|
||||||
jQuery("#entries_form").submit();
|
jQuery("#entries_form").submit();
|
||||||
};
|
};
|
||||||
|
|
||||||
function confirmation_link(action) {
|
function confirmation_link(action) {
|
||||||
if(!window.confirm("<%= l(:question_do_you_really_want_to_delete_this_entry) %>")) return;
|
if(!window.confirm("<%= l(:question_do_you_really_want_to_delete_this_entry) %>")) return;
|
||||||
jQuery("#entries_form").attr("action", action);
|
jQuery("#entries_form").attr("action", action);
|
||||||
@ -315,6 +319,6 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !
|
|||||||
</script>
|
</script>
|
||||||
<% end %>
|
<% 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?) ) ) %>
|
( @folder.nil? || (!@folder.nil? &&!@folder.locked_for_user?) ) ) %>
|
||||||
<br />
|
<br />
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
<h2>
|
<h2>
|
||||||
<%= render(:partial => "/dmsf/path", :locals => {:path => path}) %>
|
<%= render(:partial => "/dmsf/path", :locals => {:path => path}) %>
|
||||||
/
|
/
|
||||||
<%= link_to(h(@file.title), {:controller => "dmsf_files", :action => "show", :id=> @file}) %>
|
<%= link_to(h(@file.title), {:controller => "dmsf_files", :action => "show", :id=> @file}) %>
|
||||||
<%= image_tag("notify.png", :plugin => "redmine_dmsf", :title => l(:title_notifications_active)) if @file.notification %>
|
<%= image_tag("notify.png", :plugin => "redmine_dmsf", :title => l(:title_notifications_active)) if @file.notification %>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
@ -17,21 +17,17 @@
|
|||||||
<p>
|
<p>
|
||||||
<label for="target_project_id"><%=l(:label_target_project)%>:</label>
|
<label for="target_project_id"><%=l(:label_target_project)%>:</label>
|
||||||
<%= select_tag("target_project_id",
|
<%= select_tag("target_project_id",
|
||||||
project_tree_options_for_select(DmsfFile.allowed_target_projects_on_copy, :selected => @target_project),
|
project_tree_options_for_select(DmsfFile.allowed_target_projects_on_copy, :selected => @target_project)) %>
|
||||||
:onchange => remote_function(:url => { :action => 'new' },
|
|
||||||
:method => :get,
|
|
||||||
:update => 'content',
|
|
||||||
:with => "Form.serialize('copyForm')")) %>
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<%= label_tag("target_folder_id", l(:label_target_folder) + ":") %>
|
<%= label_tag("target_folder_id", l(:label_target_folder) + ":") %>
|
||||||
<%= select_tag("target_folder_id",
|
<%= select_tag("target_folder_id",
|
||||||
options_for_select(DmsfFolder.directory_tree(@target_project),
|
options_for_select(DmsfFolder.directory_tree(@target_project),
|
||||||
:selected => (@target_folder.id unless @target_folder.nil?))) %>
|
:selected => (@target_folder.id unless @target_folder.nil?))) %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<%= submit_tag(l(:button_copy)) %>
|
<%= submit_tag(l(:button_copy)) %>
|
||||||
<% if User.current.allowed_to?(:file_manipulation, @project) %>
|
<% if User.current.allowed_to?(:file_manipulation, @project) %>
|
||||||
<button type="button" id="move_button" title="<%=l(:button_move)%>"><%=l(:button_move)%></button>
|
<button type="button" id="move_button" title="<%=l(:button_move)%>"><%=l(:button_move)%></button>
|
||||||
@ -44,6 +40,10 @@
|
|||||||
jQuery("#copyForm").attr("action", "<%= url_for(:action => 'move', :id => @file) %>");
|
jQuery("#copyForm").attr("action", "<%= url_for(:action => 'move', :id => @file) %>");
|
||||||
jQuery("#copyForm").submit();
|
jQuery("#copyForm").submit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
jQuery("#target_project_id").change(function () {
|
||||||
|
jQuery("#content").load("<%= url_for(:action => 'new') %>", jQuery("#copyForm").serialize());
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
|
|||||||
@ -11,24 +11,26 @@
|
|||||||
<p>
|
<p>
|
||||||
<label for="target_project_id"><%=l(:label_target_project)%>:</label>
|
<label for="target_project_id"><%=l(:label_target_project)%>:</label>
|
||||||
<%= select_tag("target_project_id",
|
<%= select_tag("target_project_id",
|
||||||
project_tree_options_for_select(DmsfFolder.allowed_target_projects_on_copy, :selected => @target_project),
|
project_tree_options_for_select(DmsfFolder.allowed_target_projects_on_copy, :selected => @target_project)) %>
|
||||||
:onchange => remote_function(:url => { :action => 'new' },
|
|
||||||
:method => :get,
|
|
||||||
:update => 'content',
|
|
||||||
:with => "Form.serialize('copyForm')")) %>
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<%= label_tag("target_folder_id", l(:label_target_folder) + ":") %>
|
<%= label_tag("target_folder_id", l(:label_target_folder) + ":") %>
|
||||||
<%= select_tag("target_folder_id",
|
<%= select_tag("target_folder_id",
|
||||||
options_for_select(DmsfFolder.directory_tree(@target_project, @folder),
|
options_for_select(DmsfFolder.directory_tree(@target_project, @folder),
|
||||||
:selected => (@target_folder.id unless @target_folder.nil?))) %>
|
:selected => (@target_folder.id unless @target_folder.nil?))) %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= submit_tag(l(:button_copy)) %>
|
<%= submit_tag(l(:button_copy)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
jQuery("#target_project_id").change(function () {
|
||||||
|
jQuery("#content").load("<%= url_for(:action => 'new') %>", jQuery("#copyForm").serialize());
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= stylesheet_link_tag "dmsf", :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-1.6.1.min.js", :plugin => "redmine_dmsf" %>
|
||||||
|
|||||||
151
lib/dmsf_zip.rb
151
lib/dmsf_zip.rb
@ -1,75 +1,76 @@
|
|||||||
# Redmine plugin for Document Management System "Features"
|
# Redmine plugin for Document Management System "Features"
|
||||||
#
|
#
|
||||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
# as published by the Free Software Foundation; either version 2
|
# as published by the Free Software Foundation; either version 2
|
||||||
# of the License, or (at your option) any later version.
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
require 'zip/zip'
|
require 'zip/zip'
|
||||||
require 'zip/zipfilesystem'
|
require 'zip/zipfilesystem'
|
||||||
require 'iconv'
|
require 'iconv'
|
||||||
|
|
||||||
class DmsfZip
|
class DmsfZip
|
||||||
|
|
||||||
attr_reader :files
|
attr_reader :files
|
||||||
|
|
||||||
def initialize()
|
def initialize()
|
||||||
@zip = Tempfile.new(["dmsf_zip",".zip"])
|
@zip = Tempfile.new(["dmsf_zip",".zip"])
|
||||||
@zip_file = Zip::ZipOutputStream.new(@zip.path)
|
@zip.chmod(0644)
|
||||||
@files = []
|
@zip_file = Zip::ZipOutputStream.new(@zip.path)
|
||||||
end
|
@files = []
|
||||||
|
end
|
||||||
def finish
|
|
||||||
@zip_file.close unless @zip_file.nil?
|
def finish
|
||||||
@zip.path unless @zip.nil?
|
@zip_file.close unless @zip_file.nil?
|
||||||
end
|
@zip.path unless @zip.nil?
|
||||||
|
end
|
||||||
def close
|
|
||||||
@zip_file.close unless @zip_file.nil?
|
def close
|
||||||
@zip.close unless @zip.nil?
|
@zip_file.close unless @zip_file.nil?
|
||||||
end
|
@zip.close unless @zip.nil?
|
||||||
|
end
|
||||||
def add_file(file, root_path = nil)
|
|
||||||
string_path = file.folder.nil? ? "" : file.folder.dmsf_path_str + "/"
|
def add_file(file, root_path = nil)
|
||||||
string_path = string_path[(root_path.length + 1) .. string_path.length] if root_path
|
string_path = file.folder.nil? ? "" : file.folder.dmsf_path_str + "/"
|
||||||
string_path += file.name
|
string_path = string_path[(root_path.length + 1) .. string_path.length] if root_path
|
||||||
#TODO: somewhat ugly conversion problems handling bellow
|
string_path += file.name
|
||||||
begin
|
#TODO: somewhat ugly conversion problems handling bellow
|
||||||
string_path = Iconv.conv(Setting.plugin_redmine_dmsf["dmsf_zip_encoding"], "utf-8", string_path)
|
begin
|
||||||
rescue
|
string_path = Iconv.conv(Setting.plugin_redmine_dmsf["dmsf_zip_encoding"], "utf-8", string_path)
|
||||||
end
|
rescue
|
||||||
@zip_file.put_next_entry(string_path)
|
end
|
||||||
File.open(file.last_revision.disk_file, "rb") do |f|
|
@zip_file.put_next_entry(string_path)
|
||||||
buffer = ""
|
File.open(file.last_revision.disk_file, "rb") do |f|
|
||||||
while (buffer = f.read(8192))
|
buffer = ""
|
||||||
@zip_file.write(buffer)
|
while (buffer = f.read(8192))
|
||||||
end
|
@zip_file.write(buffer)
|
||||||
end
|
end
|
||||||
@files << file
|
end
|
||||||
end
|
@files << file
|
||||||
|
end
|
||||||
def add_folder(folder, root_path = nil)
|
|
||||||
string_path = folder.dmsf_path_str + "/"
|
def add_folder(folder, root_path = nil)
|
||||||
string_path = string_path[(root_path.length + 1) .. string_path.length] if root_path
|
string_path = folder.dmsf_path_str + "/"
|
||||||
#TODO: somewhat ugly conversion problems handling bellow
|
string_path = string_path[(root_path.length + 1) .. string_path.length] if root_path
|
||||||
begin
|
#TODO: somewhat ugly conversion problems handling bellow
|
||||||
string_path = Iconv.conv(Setting.plugin_redmine_dmsf["dmsf_zip_encoding"], "utf-8", string_path)
|
begin
|
||||||
rescue
|
string_path = Iconv.conv(Setting.plugin_redmine_dmsf["dmsf_zip_encoding"], "utf-8", string_path)
|
||||||
end
|
rescue
|
||||||
@zip_file.put_next_entry(string_path)
|
end
|
||||||
folder.subfolders.visible.each { |subfolder| self.add_folder(subfolder, root_path) }
|
@zip_file.put_next_entry(string_path)
|
||||||
folder.files.visible.each { |file| self.add_file(file, root_path) }
|
folder.subfolders.visible.each { |subfolder| self.add_folder(subfolder, root_path) }
|
||||||
end
|
folder.files.visible.each { |file| self.add_file(file, root_path) }
|
||||||
|
end
|
||||||
end
|
|
||||||
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user