From f71f7adf19c923e4032a9dfd805575c142692711 Mon Sep 17 00:00:00 2001
From: Jean-Yves Gaulier
Date: Thu, 5 Feb 2015 14:20:44 +0100
Subject: [PATCH] hide "use flash uploader" with ie >= 10 #time 8h
---
.../Phrasea/Controller/Prod/Upload.php | 25 +++++++++++++++----
templates/web/common/menubar.html.twig | 2 +-
.../web/prod/upload/upload-flash.html.twig | 3 +--
templates/web/prod/upload/upload.html.twig | 17 ++++++++++++-
4 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php
index eee6ef7153..ffa7d74a0e 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php
@@ -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
@@ -119,11 +121,24 @@ class Upload implements ControllerProviderInterface
return $app['twig']->render(
'prod/upload/upload-flash.html.twig', array(
- 'sessionId' => session_id(),
- 'collections' => $this->getGrantedCollections($app['authentication']->getUser()),
- 'maxFileSize' => $maxFileSize,
- 'maxFileSizeReadable' => \p4string::format_octets($maxFileSize)
- ));
+ 'sessionId' => session_id(),
+ 'collections' => $this->getGrantedCollections($app['authentication']->getUser()),
+ 'maxFileSize' => $maxFileSize,
+ 'maxFileSizeReadable' => \p4string::format_octets($maxFileSize)
+ ));
+ }
+
+ 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)
+ ));
}
/**
diff --git a/templates/web/common/menubar.html.twig b/templates/web/common/menubar.html.twig
index a9b2255dd4..557af546e5 100644
--- a/templates/web/common/menubar.html.twig
+++ b/templates/web/common/menubar.html.twig
@@ -61,7 +61,7 @@
{% if module == "prod" %}
{% if app['authentication'].getUser().ACL.has_access_to_module('upload') %}
- {% set link = path('upload_form') %}
+ {% set link = path('upload_html5_form') %}
{% if not app['browser'].supportFileAPI() %}
{% set link = path('upload_flash_form') %}
diff --git a/templates/web/prod/upload/upload-flash.html.twig b/templates/web/prod/upload/upload-flash.html.twig
index 493861b28e..d55a4b917b 100644
--- a/templates/web/prod/upload/upload-flash.html.twig
+++ b/templates/web/prod/upload/upload-flash.html.twig
@@ -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' %}
- {% trans 'Use the HTML5 uploader' %}
+ {% trans 'Use the HTML5 uploader' %}
@@ -167,7 +167,6 @@
$('#uploadBox #status-' + selectedCollId).show();
});
-
//global file order, start uploads from swf.queue, following
//order of "file_order"
var file_order = [];
diff --git a/templates/web/prod/upload/upload.html.twig b/templates/web/prod/upload/upload.html.twig
index 5c153c36b2..c7a4101e80 100644
--- a/templates/web/prod/upload/upload.html.twig
+++ b/templates/web/prod/upload/upload.html.twig
@@ -46,7 +46,7 @@
{% trans 'Your browser does not support all HTML5 features properly.' %}
{% endif %}
- {% trans 'Use the Flash uploader' %}
+ {% trans 'Use the Flash uploader' %}
@@ -143,6 +143,21 @@