Merge 3.7

This commit is contained in:
Romain Neutron
2012-09-06 14:30:55 +02:00
22 changed files with 50027 additions and 41599 deletions

View File

@@ -79,7 +79,13 @@
{% if module == "prod" %}
{% if user.ACL.has_access_to_module('upload') %}
<li>
<a href="/prod/upload/" class="dialog full-dialog" title="{% trans 'Upload' %}">
{% set link = '/prod/upload/' %}
{% if not browser.supportFileAPI() %}
{% set link = '/prod/upload/flash-version/' %}
{% endif %}
<a href="{{ link }}" class="dialog full-dialog" title="{% trans 'Upload' %}">
<span>
{% trans 'admin::monitor: module upload' %}
</span>

View File

@@ -20,25 +20,28 @@
<div id="tab-upload">
<form id="fileupload" enctype="multipart/form-data" method="POST" action="/prod/upload/">
<div id="uploadBoxLeft" class="well ">
<div id="uploadBoxLeft" class="well">
{# <h5 style="margin-top: 10px;">{% trans 'Choose files to add' %} :</h5> #}
{# action bar #}
<div id="addFileList">
<div class="btn-toolbar">
<span id="spanSWFUploadButton" class="span2"></span>
<br />
<span>
<a href="/prod/upload/" class="dialog full-dialog" title="{% trans 'Upload' %}"><span class="label label-info"><i>{% trans 'Switch to html5 uploader' %}</i></span></a>
</span>
<br />
<span class="comment">
({% trans %} maximum : {{ maxFileSizeReadable }} {% endtrans %})
</span>
{# <button type="button" class="upload-submitter btn btn-inverse input-medium">{% trans 'Send' %}</button> #}
</div>
</div>
<table id="addFileList">
<tr>
<td class='uploader-button'>
<span id="spanSWFUploadButton" class="span2"></span>
<br />
<span class="comment">
({% trans %} maximum : {{ maxFileSizeReadable }} {% endtrans %})
</span>
</td>
<td class='uploader-icon'>
<img src='/skins/icons/logo-flash.png' width="32px" heigh="32px" title="{% trans 'You are using the Flash uploader'%}"/>
</td>
<td class='uploader-info'>
<p>{% trans 'This version does not allow you to access all the features offered by the HTML5 uploader' %}</p>
<a href="/prod/upload/" class="dialog full-dialog">{% trans 'Use the HTML5 uploader' %}</a>
</td>
</tr>
</table>
{# settings box #}
<div class='settings-box'>
<h5>{% trans 'upload:: Destination (collection) :' %} :</h5>
@@ -105,6 +108,7 @@
</div>
<div id="uploadBoxRight" class="well">
<h5 style="margin-top: 10px;">{% trans 'Transmited files' %} : </h5>
<div class='well-small'>
<button id="cancel-all" class="btn disabled" type="button" disabled="disabled">
{% trans "Cancel all" %}
@@ -188,7 +192,9 @@
button_action : SWFUpload.BUTTON_ACTION.SELECT_FILES,
file_queued_handler : function(file) {
var $this = this;
UploaderManager.getUploadBox().closest('.upload-box').show();
if ( ! UploaderManager.getUploadBox().is(':visible')) {
UploaderManager.getUploadBox().closest('.upload-box').show();
}
var formatedFile = {
id: file.id,
@@ -208,35 +214,39 @@
});
},
file_queue_error_handler : function(file, errorCode, message) {
if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
alert(" {% trans "You have attempted to queue too many files" %}");
return false;
if ( ! UploaderManager.getUploadBox().is(':visible')) {
UploaderManager.getUploadBox().closest('.upload-box').show();
}
if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
alert(" {% trans "You have attempted to queue too many files" %}");
return false;
}
var error = "{% trans "Unknow Error" %}";
switch (errorCode) {
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
error = language.errorFileApiTooBig;
break;
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
error = "{% trans "Cannot upload Zero Byte files" %}";
break;
case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
error = "{% trans "Invalid file type" %}";
break;
default:
if (file !== null) {
error = "{% trans "Unhandled Error" %}";
}
break;
}
var error = "{% trans "Unknow Error" %}";
switch (errorCode) {
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
error = language.errorFileApiTooBig;
break;
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
error = "{% trans "Cannot upload Zero Byte files" %}";
break;
case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
error = "{% trans "Invalid file type" %}";
break;
default:
if (file !== null) {
error = "{% trans "Unhandled Error" %}";
}
break;
}
var params = $.extend({}, file, {error: error, language: language});
p4.Mustache.Render('Upload-Items-Error', params, function(html){
UploaderManager.getUploadBox().append(html);
$("#"+file.id, UploaderManager.getDownloadBox()).find('.canva-wrapper').remove();
});
var params = $.extend({}, file, {error: error, language: language});
p4.Mustache.Render('Upload-Items-Error', params, function(html){
UploaderManager.getUploadBox().append(html);
$("#"+file.id, UploaderManager.getDownloadBox()).find('.canva-wrapper').remove();
});
},
file_dialog_complete_handler : function(numFilesSelected, numFilesQueued) {
if (numFilesQueued > 0) {
@@ -297,7 +307,6 @@
$("#"+file.id, UploaderManager.getDownloadBox()).find('p.error').append(html).show();
});
return false;
},
upload_success_handler : function(file, response) {
var response = $.parseJSON(response);
@@ -354,6 +363,9 @@
}
});
var nbElements = $(".upload-box-addedfiles ul:first li.upload-valid > div").length;
var elementChecked = 0;
$(".upload-box-addedfiles ul:first li.upload-valid > div").each(function(index, element) {
var file = swfu.getFile($(this).attr("id"));
@@ -367,6 +379,12 @@
//Add file
file_order.push(file);
elementChecked++;
if( elementChecked === nbElements) {
//Start upload
swfu.startUpload(file_order.shift().id);
}
});
}
});
@@ -375,10 +393,7 @@
$("button.clear-queue", UploaderManager.getContainer()).attr("disabled", true).addClass("disabled");
$("button.upload-submitter", UploaderManager.getContainer()).attr("disabled", true).addClass('disabled');
if( file_order.length > 0 ) {
//Start upload
swfu.startUpload(file_order.shift().id);
} else {
if (nbElements === 0) {
alert("{% trans 'Please select at least one valid file' %}");
}
});

View File

@@ -20,27 +20,36 @@
<div id="tab-upload">
<form id="fileupload" enctype="multipart/form-data" method="POST" action="/prod/upload/">
<div id="uploadBoxLeft" class="well ">
<div id="uploadBoxLeft" class="well">
{# <h5 style="margin-top: 10px;">{% trans 'Choose files to add' %} :</h5> #}
{# action bar #}
<div id="addFileList">
<div class="btn-toolbar">
<span class="btn btn-inverse fileinput-button input-medium">
<span>{% trans 'Select files...' %}</span>
<input type="file" name="files[]" multiple>
</span>
<br />
<span>
<a href="/prod/upload/flash-version/" class="dialog full-dialog" title="{% trans 'Upload' %}"><span class="label label-info"><i>{% trans 'Switch to flash uploader' %}</i></span></a>
</span>
<br />
<span class="comment">
({% trans %} maximum : {{ maxFileSizeReadable }} {% endtrans %})
</span>
{# <button type="button" class="upload-submitter btn btn-inverse input-medium">{% trans 'Send' %}</button> #}
</div>
</div>
<table id="addFileList">
<tr>
<td class='uploader-button'>
<span class="btn btn-inverse fileinput-button input-medium">
<span>{% trans 'Select files...' %}</span>
<input type="file" name="files[]" multiple>
</span>
<br />
<span class="comment">
({% trans %} maximum : {{ maxFileSizeReadable }} {% endtrans %})
</span>
</td>
<td class='uploader-icon'>
<img src='/skins/icons/html5-logo.jpeg' width="32px" heigh="32px" title="{% trans 'You are using the HTML5 uploader'%}"/>
</td>
<td class="uploader-info">
<p>
{% trans 'You are using the HTML5 uploader.' %}
{% if not browser.supportFileAPI() %}
{% trans 'Your browser does not support all HTML5 features properly.' %}
{% endif %}
</p>
<a href="/prod/upload/flash-version/" class="dialog full-dialog">{% trans 'Use the Flash uploader' %}</a>
</td>
</tr>
</table>
{# settings box #}
<div class='settings-box'>