95 lines
3.3 KiB
Plaintext
95 lines
3.3 KiB
Plaintext
<%
|
|
# encoding: utf-8
|
|
#
|
|
# Redmine plugin for Document Management System "Features"
|
|
#
|
|
# Copyright © 2011 Vít Jonáš <vit.jonas@gmail.com>
|
|
# Copyright © 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
|
# Copyright © 2011-20 Karel Pičman <karel.picman@kontron.com>
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License
|
|
# as published by the Free Software Foundation; either version 2
|
|
# of the License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
%>
|
|
|
|
<div id="dmsf_uploader_header">
|
|
<% unless @rlf %>
|
|
<div class="dmsf_upload_select">
|
|
<select id="uploader_select">
|
|
<option value="1">
|
|
<%= l(:label_drag_drop) %>
|
|
</option>
|
|
<option value="2">
|
|
<%= l(:label_classic) %>
|
|
</option>
|
|
</select>
|
|
</div>
|
|
<% end %>
|
|
|
|
<h3><%= l(:label_upload) %></h3>
|
|
</div>
|
|
<%= form_tag({ controller: 'dmsf_upload', action: 'upload_files', id: @project, folder_id: @folder },
|
|
id: 'uploadform', method: :post, multipart: true) do %>
|
|
<div id="dmsf_uploader">
|
|
<span class="dmsf_uploader">
|
|
<%= render partial: 'dmsf_upload/form',
|
|
locals: { multiple: true, container: nil, description: true, awf: false } %>
|
|
</span>
|
|
<%= submit_tag l(:label_upload) %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% unless @rlf %>
|
|
<%
|
|
form_url = url_for({:controller => 'dmsf_upload', :action => 'upload_file', :id => @project})
|
|
max_file_size = "#{@ajax_upload_size}mb"
|
|
max_file_count = Setting.plugin_redmine_dmsf['dmsf_max_file_upload'].to_i if Setting.plugin_redmine_dmsf['dmsf_max_file_upload'].to_i > 0
|
|
flash_url = plugin_asset_path(:redmine_dmsf, 'javascripts', 'plupload/js/Moxie.swf')
|
|
%>
|
|
|
|
<%= late_javascript_tag do %>
|
|
var originalUploaderContent;
|
|
var uploader = $('#dmsf_uploader');
|
|
originalUploaderContent = uploader.html();
|
|
$('#uploader_select').change(function() {
|
|
if($(this).val() === '2') {
|
|
uploader.html(originalUploaderContent);
|
|
dmsfSetupFileDrop();
|
|
} else {
|
|
initPlUploader(
|
|
uploader,
|
|
'<%= form_url %>',
|
|
'<%= max_file_size %>',
|
|
'<%= max_file_count %>',
|
|
'<%= flash_url %>'
|
|
);
|
|
}
|
|
});
|
|
initPlUploader(
|
|
uploader,
|
|
'<%= form_url %>',
|
|
'<%= max_file_size %>',
|
|
'<%= max_file_count %>',
|
|
'<%= flash_url %>'
|
|
);
|
|
window.dmsfFileFieldCount = 1;
|
|
<% end %>
|
|
|
|
<% content_for :header_tags do %>
|
|
<%= stylesheet_link_tag 'plupload/jquery.ui.plupload.css', :plugin => :redmine_dmsf %>
|
|
<%= javascript_include_tag 'plupload/js/plupload.full.min.js', :plugin => :redmine_dmsf, defer: true %>
|
|
<%= javascript_include_tag 'plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', :plugin => :redmine_dmsf, defer: true %>
|
|
<%= javascript_include_tag(js_url, :plugin => :redmine_dmsf, defer: true) %>
|
|
<% end %>
|
|
<% end %>
|