Upload control selector changed

This commit is contained in:
Karel Picman 2016-03-10 13:43:14 +01:00
parent 0a824117e1
commit 0258264dff
13 changed files with 83 additions and 117 deletions

View File

@ -24,46 +24,36 @@
<div class="box">
<%= form_tag({:controller => 'dmsf_upload', :action => 'upload_files', :id => @project, :folder_id => @folder},
:id => 'uploadform', :method=>:post, :multipart => true) do %>
<% if Setting.attachment_max_size.to_i >= 102400 %>
<div class="upload_select">
<%= l(:label_file_size) %>:
<select id="uploader_select">
<option value="1">
&lt; <%= "#{@ajax_upload_size}" %> MB
</option>
<option value="2">
> <%= "#{@ajax_upload_size}" %> MB
</option>
</select>
</div>
<% end %>
<h3><%= l(:heading_file_upload) %></h3>
<div style="padding-bottom: 6px; line-height: 1.4em; font-size: 0.9em;">
<span>
<% max_file_upload = Setting.plugin_redmine_dmsf['dmsf_max_file_upload'].to_i %>
<%= l(:note_uploaded_maximum_files_at_once, :number => max_file_upload) if max_file_upload > 0 %>
<%= l(:note_upload_files_greater_than_two_gb) if Setting.attachment_max_size.to_i >= 2097151 %>
</span>
</div>
:id => 'uploadform', :method => :post, :multipart => true) do %>
<div class="upload_select">
<select id="uploader_select">
<option value="1">
<%= l(:label_drag_drop) %>
</option>
<option value="2">
<%= l(:label_classic) %>
</option>
</select>
</div>
<h3><%= l(:label_upload) %></h3>
<div id="uploader">
<p>
<label><%=l(:label_attachment_plural)%></label>
<label><%= l(:label_attachment_plural) %></label>
<%= render :partial => 'attachments/form' %>
</p>
<%= submit_tag(l(:submit_upload_files)) %>
<%= submit_tag l(:label_upload) %>
</div>
<% end %>
</div>
<script type="text/javascript">
var originalUploaderContent;
var uploader = jQuery('#uploader');
var uploader = $('#uploader');
originalUploaderContent = uploader.html();
jQuery('#uploader_select').change(function() {
if(jQuery(this).val() == 2) {
$('#uploader_select').change(function() {
if($(this).val() === '2') {
uploader.html(originalUploaderContent);
} else {
initPlUploader(uploader);
@ -84,7 +74,7 @@
<script type="text/javascript">
function initPlUploader(uploader) {
uploader.html('<div></div>');
uploader = jQuery('div', uploader);
uploader = $('div', uploader);
uploader.plupload({
runtimes : 'html5,flash,silverlight,html4',
url : '<%= url_for({:controller => 'dmsf_upload', :action => 'upload_file', :id => @project}) %>',
@ -111,28 +101,28 @@
// Silverlight settings
silverlight_xap_url : '<%= plugin_asset_path(:redmine_dmsf, 'javascripts', 'plupload/js/Moxie.xap') %>'
});
jQuery('.plupload_scroll',uploader).resizable({
$('.plupload_scroll',uploader).resizable({
handles: 's'
});
var pluploader = uploader.plupload('getUploader');
pluploader.bind('FileUploaded', function(pluploader, file, response) {
var responseObject = jQuery.parseJSON(response.response);
var responseObject = $.parseJSON(response.response);
if (responseObject == null) { //Bug: on Firefox folders entries act unexpectedly.
file.status = plupload.FAILED;
pluploader.trigger('UploadProgress', file);
pluploader.trigger('QueueChanged');
} else {
if (responseObject.error == null) {
var disk_filename_input = jQuery('<input/>').attr('type', 'hidden')
var disk_filename_input = $('<input/>').attr('type', 'hidden')
.attr('name', 'uploaded[' + dmsfFileFieldCount + '][disk_filename]')
.val(responseObject.disk_filename);
uploader.append(disk_filename_input);
var content_type_input = jQuery('<input/>').attr('type', 'hidden')
var content_type_input = $('<input/>').attr('type', 'hidden')
.attr('name', 'uploaded[' + dmsfFileFieldCount + '][content_type]')
.val(responseObject.content_type);
uploader.append(content_type_input);
var original_filename_input = jQuery('<input/>').attr('type', 'hidden')
var original_filename_input = $('<input/>').attr('type', 'hidden')
.attr('name', 'uploaded[' + dmsfFileFieldCount + '][original_filename]')
.val(responseObject.original_filename);
uploader.append(original_filename_input);
@ -143,7 +133,7 @@
}
}
if(pluploader.total.uploaded == pluploader.files.length) jQuery('#uploadform').submit();
else if((pluploader.total.uploaded + pluploader.total.failed) == pluploader.files.length) setTimeout(function() {jQuery('#uploadform').submit();}, 2000);
else if((pluploader.total.uploaded + pluploader.total.failed) == pluploader.files.length) setTimeout(function() {$('#uploadform').submit();}, 2000);
else dmsfFileFieldCount++;
return true;
});

View File

@ -93,12 +93,8 @@ cs:
label_email_documents: Documenty
label_email_body: Obsah
label_email_send: Odesláno
title_notifications_active: Notifikace jsou aktivní
label_file_size: Velikost souboru
heading_file_upload: Nahrát
note_uploaded_maximum_files_at_once: "Maximálně může být nahráno %{number} souborů najednou."
note_upload_files_greater_than_two_gb: Nahrání souborů větších než 2GB vyžaduje 64b prohlížeč.
submit_upload_files: Nahrání
title_notifications_active: Notifikace jsou aktivní
label_upload_upload: Nahrát
heading_new_folder: Nová složka
label_title: Název
label_description: Popis
@ -332,4 +328,6 @@ cs:
open_approvals: Procesy ke schválení
label_maximum_ajax_upload_filesize: Maximální velikost souboru nahratelná přes AJAX
note_maximum_ajax_upload_filesize: Omezuje velikost souboru, který může být nahrán přes standardní rozhraní AJAX, jinak se použije standarní rozhraní Redminu. Číslo je MB.
note_maximum_ajax_upload_filesize: Omezuje velikost souboru, který může být nahrán přes standardní rozhraní AJAX, jinak se použije standardní rozhraní Redminu. Číslo je v MB.
label_classic: Klasický
label_drag_drop: "Drag&Drop"

View File

@ -93,12 +93,8 @@ de:
label_email_documents: Dateien
label_email_body: Text
label_email_send: Senden
title_notifications_active: Benachrichtigungen sind aktiv
label_file_size: Dateigröße
heading_file_upload: Upload
note_uploaded_maximum_files_at_once: "Es können maximal %{number} Dateien auf einmal hochgeladen werden."
note_upload_files_greater_than_two_gb: Um Dateien größer 2GB hochzuladen, brauchst du einen 64bit-Browser.
submit_upload_files: Upload
title_notifications_active: Benachrichtigungen sind aktiv
label_upload: Upload
heading_new_folder: Neuer Ordner
label_title: Titel
label_description: Beschreibung
@ -332,4 +328,6 @@ de:
open_approvals: Offene Genehmigungs-Workflows
label_maximum_ajax_upload_filesize: Maximale Dateigröße für den Upload via AJAX
note_maximum_ajax_upload_filesize: Maximale Dateigröße für den Upload über die AJAX-Schnittstelle. Für größere Dateien muss der Standard-Uploader von Redmine verwendet werden. Angabe in MB.
note_maximum_ajax_upload_filesize: Maximale Dateigröße für den Upload über die AJAX-Schnittstelle. Für größere Dateien muss der Standard-Uploader von Redmine verwendet werden. Angabe in MB.
label_classic: Klassisch
label_drag_drop: "Drag&Drop"

View File

@ -93,12 +93,8 @@ en:
label_email_documents: Documents
label_email_body: Body
label_email_send: Send
title_notifications_active: Notifications active
label_file_size: File size
heading_file_upload: Upload
note_uploaded_maximum_files_at_once: "There can be uploaded maximum of %{number} files at once."
note_upload_files_greater_than_two_gb: To upload files greater than 2GB you must have 64b browser.
submit_upload_files: Upload
title_notifications_active: Notifications active
label_upload: Upload
heading_new_folder: New Folder
label_title: Title
label_description: Description
@ -332,4 +328,6 @@ en:
openap_provals: Open approvals
label_maximum_ajax_upload_filesize: Maximum file size uploadable via AJAX
note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB.
note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB.
label_classic: Classic
label_drag_drop: "Drag&Drop"

View File

@ -93,12 +93,8 @@ es:
label_email_documents: Documentos
label_email_body: Cuerpo de Mensaje
label_email_send: Enviar
title_notifications_active: Activar Notificaciones
label_file_size: Tamaño de Archivo
heading_file_upload: Subir
note_uploaded_maximum_files_at_once: "El número máximo de una subida de archivos es %{number}."
note_upload_files_greater_than_two_gb: Para subir archivos mayores a 2GB debe tener un navegador web de 64bits.
submit_upload_files: Subir
title_notifications_active: Activar Notificaciones
label_upload: Subir
heading_new_folder: Nuevo directorio
label_title: Título
label_description: Descripción
@ -332,4 +328,6 @@ es:
open_approvals: Aprobaciones abiertas
label_maximum_ajax_upload_filesize: "El máximo tamaño de archivo para subir por AJAX"
note_maximum_ajax_upload_filesize: "El límite máximo de tamaño de archivo que puede ser subido por la interfaz AJAX estandar, de lo contrario se debe utilizar el formulario estandar de Redmine. El número es en MB."
note_maximum_ajax_upload_filesize: "El límite máximo de tamaño de archivo que puede ser subido por la interfaz AJAX estandar, de lo contrario se debe utilizar el formulario estandar de Redmine. El número es en MB."
label_classic: Classic
label_drag_drop: "Drag&Drop"

View File

@ -93,12 +93,8 @@ fr:
label_email_documents: Fichiers
label_email_body: Message
label_email_send: Envoyer
title_notifications_active: Notifications actives
label_file_size: Taille du fichier
heading_file_upload: Déposer des fichiers
note_uploaded_maximum_files_at_once: "Seulement %{number} fichiers peuvent être déposés à la fois."
note_upload_files_greater_than_two_gb: "Afin de transmettre des fichiers de plus de 2Go, l'utilisation d'un navigateur de 64Bits est nécessaire."
submit_upload_files: Transmission
title_notifications_active: Notifications actives
label_upload: Transmission
heading_new_folder: Nouveau Dossier
label_title: Titre
label_description: Description
@ -332,4 +328,6 @@ fr:
open_approvals: Approbations en attente
label_maximum_ajax_upload_filesize: Taille maximale de fichier pour téléversement via AJAX
note_maximum_ajax_upload_filesize: "Taille maximale, en méga octets, de fichier pour téléversement via l'interface standard AJAX. Sinon l'interface standard de Redmine doit être utilisée."
note_maximum_ajax_upload_filesize: "Taille maximale, en méga octets, de fichier pour téléversement via l'interface standard AJAX. Sinon l'interface standard de Redmine doit être utilisée."
label_classic: Classic
label_drag_drop: "Drag&Drop"

View File

@ -93,12 +93,8 @@ ja:
label_email_documents: 文書
label_email_body: 本文
label_email_send: 送信
title_notifications_active: 通知は有効です
label_file_size: ファイルサイズ
heading_file_upload: アップロード
note_uploaded_maximum_files_at_once: "最大 %{number} ファイルを一度にアップロードすることができます。"
note_upload_files_greater_than_two_gb: 2GB より大きいファイルをアップロードするには 64bit 対応ブラウザが必要です。
submit_upload_files: アップロード
title_notifications_active: 通知は有効です
label_upload: アップロード
heading_new_folder: 新規フォルダ
label_title: タイトル
label_description: 説明
@ -332,4 +328,6 @@ ja:
open_approvals: 未承認
label_maximum_ajax_upload_filesize: アップロードファイルサイズ上限
note_maximum_ajax_upload_filesize: アップロード可能なファイルサイズの上限。AjaxおよびRedmineの仕様に制限される2ギガバイト程度までは確認済み単位はMB。
note_maximum_ajax_upload_filesize: アップロード可能なファイルサイズの上限。AjaxおよびRedmineの仕様に制限される2ギガバイト程度までは確認済み単位はMB。
label_classic: Classic
label_drag_drop: "Drag&Drop"

View File

@ -93,12 +93,8 @@ pl:
label_email_documents: Dokumenty
label_email_body: Treść
label_email_send: Wyślij
title_notifications_active: Powiadomienia aktywne
label_file_size: Rozmiar pliku
heading_file_upload: Prześlij
note_uploaded_maximum_files_at_once: "Można przesłać maksymalnie %{number} plików jednocześnie."
note_upload_files_greater_than_two_gb: Aby przesyłać pliki większe niż 2GB musisz posiadać 64bitową przeglądarkę.
submit_upload_files: Prześlij
title_notifications_active: Powiadomienia aktywne
label_upload: Prześlij
heading_new_folder: Nowy Folder
label_title: Tytuł
label_description: Opis
@ -332,4 +328,6 @@ pl:
openap_provals: Otwarte procesy akceptacji
label_maximum_ajax_upload_filesize: Maximum file size uploadable via AJAX
note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB.
note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB.
label_classic: Classic
label_drag_drop: "Drag&Drop"

View File

@ -93,12 +93,8 @@ pt-BR:
label_email_documents: DMSF
label_email_body: Descrição
label_email_send: Enviar
title_notifications_active: Notificações Ativas
label_file_size: Tamanho do Arquivo
heading_file_upload: Envio
note_uploaded_maximum_files_at_once: "Não pode ser carregado o máximo de %{number} arquivo de apenas uma vez."
note_upload_files_greater_than_two_gb: Para fazer o upload maiores que 2GB você deve possuir sistema 64b.
submit_upload_files: Envio
title_notifications_active: Notificações Ativas
label_upload: Envio
heading_new_folder: Nova Pasta
label_title: Taxonomia
label_description: Descrição
@ -332,4 +328,6 @@ pt-BR:
open_approvals: Aprovações abertas
label_maximum_ajax_upload_filesize: Maximum file size uploadable via AJAX
note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB.
note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB.
label_classic: Classic
label_drag_drop: "Drag&Drop"

View File

@ -93,12 +93,8 @@ ru:
label_email_documents: Документы
label_email_body: Содержание
label_email_send: Отправить
title_notifications_active: Уведомления активны
label_file_size: Размер файла
heading_file_upload: Закачать
note_uploaded_maximum_files_at_once: "За один раз можно загрузить только %{number} файлов."
note_upload_files_greater_than_two_gb: Чтобы загружать файлы размером больше чем 2 Гб у вас должен быть 64-битный браузер.
submit_upload_files: Загрузить
title_notifications_active: Уведомления активны
label_upload: Закачать
heading_new_folder: Новая папка
label_title: Заголовок
label_description: Описание
@ -333,3 +329,5 @@ ru:
label_maximum_ajax_upload_filesize: Максимальный размер файла, загружаемого посредством AJAX
note_maximum_ajax_upload_filesize: Превышает максимальный размер файла, загружаемого посредством интерфейса AJAX, для загрузки можно использовать стандартную форму Redmine. Размер указан в MB.
label_classic: Classic
label_drag_drop: "Drag&Drop"

View File

@ -93,12 +93,8 @@ sl:
label_email_documents: Priloge
label_email_body: Vsebina
label_email_send: Pošlji
title_notifications_active: Obveščanje aktivno
label_file_size: Velikost datoteke
heading_file_upload: Naloži
note_uploaded_maximum_files_at_once: "Naenkrat lahko prenesete največ %{number} datotek."
note_upload_files_greater_than_two_gb: Za datoteke večje od 2GB rabite 64bitni brskalnik.
submit_upload_files: Naloži
title_notifications_active: Obveščanje aktivno
label_upload: Naloži
heading_new_folder: Nova mapa
label_title: Naziv mape
label_description: Opis
@ -332,4 +328,6 @@ sl:
open_approvals: Open approvals
label_maximum_ajax_upload_filesize: Maximum file size uploadable via AJAX
note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB.
note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB.
label_classic: Classic
label_drag_drop: "Drag&Drop"

View File

@ -93,12 +93,8 @@ zh-TW:
label_email_documents: 附加檔案
label_email_body: 郵件內容
label_email_send: 寄信囉
title_notifications_active: 通知處於啟用中
label_file_size: 檔案大小
heading_file_upload: 上傳
note_uploaded_maximum_files_at_once: "一次最多,只能上傳%{number}個檔案。"
note_upload_files_greater_than_two_gb: 為了上傳大於 2GB 的檔案您需要使用64位元版本的瀏覽器。
submit_upload_files: 上傳
title_notifications_active: 通知處於啟用中
label_upload: 上傳
heading_new_folder: 新增資料夾
label_title: 標題
label_description: 描述
@ -332,4 +328,6 @@ zh-TW:
open_approvals: Open approvals
label_maximum_ajax_upload_filesize: Maximum file size uploadable via AJAX
note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB.
note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB.
label_classic: Classic
label_drag_drop: "Drag&Drop"

View File

@ -93,12 +93,8 @@ zh:
label_email_documents: 文档
label_email_body: 正文
label_email_send: 发送
title_notifications_active: 通知处于有效状态
label_file_size: 文件大小
heading_file_upload: 上传
note_uploaded_maximum_files_at_once: "一次最多上传%{number}个文件."
note_upload_files_greater_than_two_gb: 为了上传大于2GB文件您需要64位版本的浏览器.
submit_upload_files: 上传
title_notifications_active: 通知处于有效状态
label_upload: 上传
heading_new_folder: 新建文件夹
label_title: 标题
label_description: 描述
@ -332,4 +328,6 @@ zh:
open_approvals: Open approvals
label_maximum_ajax_upload_filesize: Maximum file size uploadable via AJAX
note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB.
note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB.
label_classic: Classic
label_drag_drop: "Drag&Drop"