hide "use flash uploader" with ie >= 10

#time 8h
This commit is contained in:
Jean-Yves Gaulier
2015-02-05 14:20:44 +01:00
parent 21054d3849
commit f71f7adf19
4 changed files with 38 additions and 9 deletions

View File

@@ -80,6 +80,8 @@ class Upload implements ControllerProviderInterface
*/
$controllers->get('/flash-version/', $this->call('getFlashUploadForm'))
->bind('upload_flash_form');
$controllers->get('/html5-version/', $this->call('getHtml5UploadForm'))
->bind('upload_html5_form');
/**
* UPLOAD route
@@ -126,6 +128,19 @@ class Upload implements ControllerProviderInterface
));
}
public function getHtml5UploadForm(Application $app, Request $request)
{
$maxFileSize = $this->getUploadMaxFileSize();
return $app['twig']->render(
'prod/upload/upload.html.twig', array(
'sessionId' => session_id(),
'collections' => $this->getGrantedCollections($app['authentication']->getUser()),
'maxFileSize' => $maxFileSize,
'maxFileSizeReadable' => \p4string::format_octets($maxFileSize)
));
}
/**
* Render the html upload form
*

View File

@@ -61,7 +61,7 @@
{% if module == "prod" %}
{% if app['authentication'].getUser().ACL.has_access_to_module('upload') %}
<li>
{% set link = path('upload_form') %}
{% set link = path('upload_html5_form') %}
{% if not app['browser'].supportFileAPI() %}
{% set link = path('upload_flash_form') %}

View File

@@ -41,7 +41,7 @@
{% trans 'You are using the Flash uploader.'%}
{% trans 'This version does not allow you to access all the features offered by the HTML5 uploader' %}
</p>
<a href="{{ path('upload_form') }}" class="dialog full-dialog">{% trans 'Use the HTML5 uploader' %}</a>
<a href="{{ path('upload_html5_form') }}" class="dialog full-dialog">{% trans 'Use the HTML5 uploader' %}</a>
</td>
</tr>
</table>
@@ -167,7 +167,6 @@
$('#uploadBox #status-' + selectedCollId).show();
});
//global file order, start uploads from swf.queue, following
//order of "file_order"
var file_order = [];

View File

@@ -46,7 +46,7 @@
{% trans 'Your browser does not support all HTML5 features properly.' %}
{% endif %}
</p>
<a href="{{ path('upload_flash_form') }}" class="dialog full-dialog">{% trans 'Use the Flash uploader' %}</a>
<a id="UPLOAD_FLASH_LINK" href="{{ path('upload_flash_form') }}" class="dialog full-dialog">{% trans 'Use the Flash uploader' %}</a>
</td>
</tr>
</table>
@@ -143,6 +143,21 @@
<script>
$(document).ready(function () {
var userAgent = navigator.userAgent.toLowerCase();
$.browser = {
version: (userAgent.match( /.+(?:rv|it|ra|ie|me)[/: ]([\d.]+)/ ) || [])[1],
chrome: /chrome/.test( userAgent ),
safari: /webkit/.test( userAgent ) && !/chrome/.test( userAgent ),
opera: /opera/.test( userAgent ),
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
};
if($.browser.msie && parseFloat($.browser.version)>=10) {
$("#UPLOAD_FLASH_LINK").hide();
}
//Upload management
var UploaderManager = new p4.UploaderManager({
container: $('#uploadBox'),