#1080 Upload control
This commit is contained in:
parent
6ba154d868
commit
bc742c3166
@ -598,7 +598,7 @@ class DmsfController < ApplicationController
|
||||
end
|
||||
|
||||
def get_display_params
|
||||
@rlf = cookies[:dmsf_switch_rlf]
|
||||
@rlf = cookies[:dmsf_switch_rlf] == 'true'
|
||||
@system_folder = @folder && @folder.system
|
||||
@folder_manipulation_allowed = User.current.allowed_to?(:folder_manipulation, @project)
|
||||
@file_manipulation_allowed = User.current.allowed_to?(:file_manipulation, @project)
|
||||
|
||||
@ -27,56 +27,58 @@
|
||||
<%= link_to(l(:button_switch), switch_rlf_dmsf_path(id: @project, rlf: @rlf),
|
||||
title: l(:label_switch_rlf),
|
||||
class: 'icon icon-plugins') %>
|
||||
<% if @folder_manipulation_allowed && !@system_folder %>
|
||||
<% if @folder.nil? %>
|
||||
<%= link_to(l(:button_edit), edit_root_dmsf_path(:id => @project),
|
||||
:title => l(:link_edit, :title => l(:link_documents)),
|
||||
:class => 'icon icon-edit') %>
|
||||
<% elsif !@locked_for_user %>
|
||||
<%= link_to(l(:button_edit),
|
||||
edit_dmsf_path(id: @project, folder_id: @folder, redirect_to_folder_id: @folder.id),
|
||||
title: l(:link_edit, title: h(@folder.title)),
|
||||
class: 'icon icon-edit') %>
|
||||
<% end %>
|
||||
<% if @folder && (!@locked_for_user || User.current.allowed_to?(:force_file_unlock, @project)) %>
|
||||
<% if @folder.locked? %>
|
||||
<%= link_to_if(@folder.unlockable?, l(:button_unlock),
|
||||
unlock_dmsf_path(:id => @project, :folder_id => @folder, :current => request.url),
|
||||
:title => l(:title_unlock_folder), :class => 'icon icon-unlock') %>
|
||||
<% else %>
|
||||
<%= link_to(l(:button_lock),
|
||||
lock_dmsf_path(:id => @project, :folder_id => @folder, :current => request.url),
|
||||
:title => l(:title_lock_folder), :class => 'icon icon-lock') %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if !@locked_for_user && ((@folder && @folder.notification) || (!@folder && @project.dmsf_notification)) %>
|
||||
<%= link_to(l(:label_notifications_off),
|
||||
notify_deactivate_dmsf_path(:id => @project, :folder_id => @folder),
|
||||
:title => l(:title_notifications_active_deactivate),
|
||||
:class => 'icon icon-email') %>
|
||||
<% else %>
|
||||
<%= link_to(l(:label_notifications_on),
|
||||
notify_activate_dmsf_path(:id => @project, :folder_id => @folder),
|
||||
:title => l(:title_notifications_not_active_activate),
|
||||
:class => 'icon icon-email-add') %>
|
||||
<% end %>
|
||||
<% if @file_manipulation_allowed && !@locked_for_user %>
|
||||
<%= link_to(l(:label_link_from),
|
||||
new_dmsf_link_path(:project_id => @project.id, :dmsf_folder_id => @folder ? @folder.id : @folder,
|
||||
:type => 'link_from'), :title => l(:title_create_link),
|
||||
:class => 'icon icon-link') %>
|
||||
<% end %>
|
||||
<%= link_to(l(:link_create_folder),
|
||||
new_dmsf_path(:id => @project, :parent_id => @folder),
|
||||
:title => l(:link_create_folder),
|
||||
:class => 'icon icon-add') unless @locked_for_user %>
|
||||
<% end %>
|
||||
<% if @trash_enabled %>
|
||||
<%= link_to l(:link_trash_bin), trash_dmsf_path(@project), title: l(:link_trash_bin), class: 'icon icon-del' %>
|
||||
<% else %>
|
||||
<span class="icon icon-del">
|
||||
<%= l(:link_trash_bin) %>
|
||||
</span>
|
||||
<%= actions_dropdown do %>
|
||||
<% if @folder_manipulation_allowed && !@system_folder %>
|
||||
<% if @folder.nil? %>
|
||||
<%= link_to(l(:button_edit), edit_root_dmsf_path(:id => @project),
|
||||
:title => l(:link_edit, :title => l(:link_documents)),
|
||||
:class => 'icon icon-edit') %>
|
||||
<% elsif !@locked_for_user %>
|
||||
<%= link_to(l(:button_edit),
|
||||
edit_dmsf_path(id: @project, folder_id: @folder, redirect_to_folder_id: @folder.id),
|
||||
title: l(:link_edit, title: h(@folder.title)),
|
||||
class: 'icon icon-edit') %>
|
||||
<% end %>
|
||||
<% if @folder && (!@locked_for_user || User.current.allowed_to?(:force_file_unlock, @project)) %>
|
||||
<% if @folder.locked? %>
|
||||
<%= link_to_if(@folder.unlockable?, l(:button_unlock),
|
||||
unlock_dmsf_path(:id => @project, :folder_id => @folder, :current => request.url),
|
||||
:title => l(:title_unlock_folder), :class => 'icon icon-unlock') %>
|
||||
<% else %>
|
||||
<%= link_to(l(:button_lock),
|
||||
lock_dmsf_path(:id => @project, :folder_id => @folder, :current => request.url),
|
||||
:title => l(:title_lock_folder), :class => 'icon icon-lock') %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if !@locked_for_user && ((@folder && @folder.notification) || (!@folder && @project.dmsf_notification)) %>
|
||||
<%= link_to(l(:label_notifications_off),
|
||||
notify_deactivate_dmsf_path(:id => @project, :folder_id => @folder),
|
||||
:title => l(:title_notifications_active_deactivate),
|
||||
:class => 'icon icon-email') %>
|
||||
<% else %>
|
||||
<%= link_to(l(:label_notifications_on),
|
||||
notify_activate_dmsf_path(:id => @project, :folder_id => @folder),
|
||||
:title => l(:title_notifications_not_active_activate),
|
||||
:class => 'icon icon-email-add') %>
|
||||
<% end %>
|
||||
<% if @file_manipulation_allowed && !@locked_for_user %>
|
||||
<%= link_to(l(:label_link_from),
|
||||
new_dmsf_link_path(:project_id => @project.id, :dmsf_folder_id => @folder ? @folder.id : @folder,
|
||||
:type => 'link_from'), :title => l(:title_create_link),
|
||||
:class => 'icon icon-link') %>
|
||||
<% end %>
|
||||
<%= link_to(l(:link_create_folder),
|
||||
new_dmsf_path(:id => @project, :parent_id => @folder),
|
||||
:title => l(:link_create_folder),
|
||||
:class => 'icon icon-add') unless @locked_for_user %>
|
||||
<% end %>
|
||||
<% if @trash_enabled %>
|
||||
<%= link_to l(:link_trash_bin), trash_dmsf_path(@project), title: l(:link_trash_bin), class: 'icon icon-del' %>
|
||||
<% else %>
|
||||
<span class="icon icon-del">
|
||||
<%= l(:link_trash_bin) %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@ -228,7 +230,7 @@
|
||||
<% end %>
|
||||
|
||||
<% if @file_manipulation_allowed && !@locked_for_user && !@system_folder %>
|
||||
<%= render(:partial => 'dmsf_upload/multi_upload', :local => { :lbl => true }) %>
|
||||
<%= render(:partial => 'dmsf_upload/multi_upload', local: { rlf: @rlf }) %>
|
||||
<% end %>
|
||||
|
||||
<% unless @system_folder %>
|
||||
|
||||
@ -23,68 +23,72 @@
|
||||
%>
|
||||
|
||||
<div id="dmsf_uploader_header">
|
||||
<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>
|
||||
<% 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 %>
|
||||
<%= 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 } %>
|
||||
<%= render partial: 'dmsf_upload/form',
|
||||
locals: { multiple: true, container: nil, description: true, awf: false } %>
|
||||
</span>
|
||||
<%= submit_tag l(:label_upload) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%
|
||||
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')
|
||||
%>
|
||||
<% 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 %>
|
||||
<%= 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) %>
|
||||
<% 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 %>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user