diff --git a/lib/Alchemy/Phrasea/Border/Manager.php b/lib/Alchemy/Phrasea/Border/Manager.php index 98e458b302..707eee5a79 100644 --- a/lib/Alchemy/Phrasea/Border/Manager.php +++ b/lib/Alchemy/Phrasea/Border/Manager.php @@ -17,6 +17,8 @@ use Doctrine\ORM\EntityManager; use Entities\LazaretAttribute; use Entities\LazaretFile; use Entities\LazaretSession; +use MediaAlchemyst\Exception\Exception as MediaAlchemystException; +use MediaAlchemyst\Specification\Image as ImageSpec; use Monolog\Logger; use PHPExiftool\Driver\Metadata\Metadata; use PHPExiftool\Driver\Value\Mono as MonoValue; @@ -398,9 +400,9 @@ class Manager $this->filesystem->copy($file->getFile()->getRealPath(), $lazaretPathname, true); - $spec = new \MediaAlchemyst\Specification\Image(); + $spec = new ImageSpec(); - $spec->setResizeMode(\MediaAlchemyst\Specification\Image::RESIZE_MODE_INBOUND_FIXEDRATIO); + $spec->setResizeMode(ImageSpec::RESIZE_MODE_INBOUND_FIXEDRATIO); $spec->setDimensions(375, 275); $core = \bootstrap::getCore(); @@ -410,8 +412,8 @@ class Manager ->open($file->getFile()->getPathname()) ->turnInto($lazaretPathname, $spec) ->close(); - } catch (\MediaAlchemyst\Exception\Exception $e) { - + } catch (MediaAlchemystException $e) { + } $lazaretFile = new LazaretFile(); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Language.php b/lib/Alchemy/Phrasea/Controller/Prod/Language.php index aed7d0f91b..155ed462c4 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Language.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Language.php @@ -98,6 +98,7 @@ class Language implements ControllerProviderInterface $out['errorAjaxRequest'] = _('An error occured, please retry'); $out['fileBeingDownloaded'] = _('Some files are being downloaded'); $out['warning'] = _('Attention'); + $out['browserFeatureSupport'] = _('This feature is not supported by your browser'); $Serializer = $app['Core']['Serializer']; diff --git a/lib/classes/media/subdef.class.php b/lib/classes/media/subdef.class.php index a4b58f1f04..68555b8551 100644 --- a/lib/classes/media/subdef.class.php +++ b/lib/classes/media/subdef.class.php @@ -438,7 +438,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface */ public function get_size() { - return @filesize($this->get_pathfile()); + return (int) @filesize($this->get_pathfile()); } /** diff --git a/templates/web/prod/actions/Tools/index.html.twig b/templates/web/prod/actions/Tools/index.html.twig index 57317db684..8dcfdcee2a 100644 --- a/templates/web/prod/actions/Tools/index.html.twig +++ b/templates/web/prod/actions/Tools/index.html.twig @@ -374,22 +374,23 @@ diff --git a/tests/Alchemy/Phrasea/Controller/Prod/BasketTest.php b/tests/Alchemy/Phrasea/Controller/Prod/BasketTest.php index 01deed7549..9135a4d638 100644 --- a/tests/Alchemy/Phrasea/Controller/Prod/BasketTest.php +++ b/tests/Alchemy/Phrasea/Controller/Prod/BasketTest.php @@ -18,10 +18,10 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract public function createApplication() { $app = require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php'; - + $app['debug'] = true; unset($app['exception_handler']); - + return $app; } diff --git a/tests/Alchemy/Phrasea/Controller/Prod/LazaretTest.php b/tests/Alchemy/Phrasea/Controller/Prod/LazaretTest.php index a343fa15d4..03191f16be 100644 --- a/tests/Alchemy/Phrasea/Controller/Prod/LazaretTest.php +++ b/tests/Alchemy/Phrasea/Controller/Prod/LazaretTest.php @@ -24,10 +24,12 @@ class LazaretTest extends \PhraseanetWebTestCaseAuthenticatedAbstract public function createApplication() { $app = require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php'; - + $app['debug'] = true; unset($app['exception_handler']); - + + $app['Core']['file-system'] = $this->getMock('Symfony\Component\Filesystem\Filesystem', array('remove')); + return $app; } diff --git a/tests/api/v1/api_v1_adapterTest.php b/tests/api/v1/api_v1_adapterTest.php index defc33b255..195ff0df6e 100644 --- a/tests/api/v1/api_v1_adapterTest.php +++ b/tests/api/v1/api_v1_adapterTest.php @@ -276,6 +276,10 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract break; } + if(null === $statusbit) { + $this->markTestSkipped('No status bit defined in databox'); + } + $request = new Request(array("salut" => "salut c'est la fete"), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json')); $result = $stub->set_record_status($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id()); $this->assertEquals(400, $result->get_http_code()); diff --git a/www/prod/ThumbExtractor.js b/www/prod/ThumbExtractor.js index 9ff01b2463..f21f55290a 100644 --- a/www/prod/ThumbExtractor.js +++ b/www/prod/ThumbExtractor.js @@ -1,30 +1,30 @@ ; (function(document){ - + /***************** * Canva Object *****************/ var Canva = function(domCanva){ this.domCanva = domCanva; } - + Canva.prototype = { resize : function(elementDomNode){ var h = elementDomNode.getHeight(); var w = elementDomNode.getWidth(); - + this.domCanva.setAttribute("width", w); this.domCanva.setAttribute("height", h); - + return this; }, getContext2d : function(){ - if (this.domCanva.getContext == undefined) + if (this.domCanva.getContext == undefined) { return G_vmlCanvasManager .initElement(this.domCanva) - .getContext("2d"); + .getContext("2d"); } return this.domCanva.getContext('2d'); @@ -36,17 +36,17 @@ var context = this.getContext2d(); var w = this.getWidth(); var h = this.getHeight(); - + context.save(); context.setTransform(1, 0, 0, 1, 0, 0); context.clearRect(0, 0, w, h); context.restore(); - + return this; }, copy : function(elementDomNode){ var context = this.getContext2d(); - + context.drawImage( elementDomNode.getDomElement() , 0 @@ -54,7 +54,7 @@ , this.getWidth() , this.getHeight() ); - + return this; }, getDomElement : function(){ @@ -67,15 +67,15 @@ return this.domCanva.offsetWidth; } }; - - + + /****************** * Image Object ******************/ var Image = function(domElement){ this.domElement = domElement; }; - + Image.prototype = { getDomElement : function(){ return this.domElement; @@ -87,28 +87,28 @@ return this.domElement.offsetWidth; } }; - + /****************** * Video Object inherits from Image object ******************/ - + var Video = function(domElement){ Image.call(this, domElement); }; - + Video.prototype = new Image(); Video.prototype.constructor = Video; Video.prototype.getCurrentTime = function(){ return Math.floor(this.domElement.currentTime); }; - + /****************** * Cache Object ******************/ var Store = function(){ this.datas = {}; }; - + Store.prototype = { set : function(id, item){ this.datas[id] = item; @@ -133,23 +133,23 @@ return count; } }; - + /****************** * Screenshot Object ******************/ var ScreenShot = function(id, canva, video){ - + var date = new Date(); - + canva.resize(video); canva.copy(video); - + this.id = id; this.timestamp = date.getTime(); this.dataURI = canva.extractImage(); this.videoTime = video.getCurrentTime(); } - + ScreenShot.prototype = { getId:function(){ return this.id; @@ -164,29 +164,34 @@ return this.videoTime; } }; - + /** * THUMB EDITOR */ var ThumbEditor = function(videoId, canvaId){ - + var editorVideo = new Video(document.getElementById(videoId)); var store = new Store(); - + function getCanva(){ return document.getElementById(canvaId); } - + return { + isSupported : function () { + var elem = document.createElement('canvas'); + + return !! elem.getContext && !! elem.getContext('2d'); + }, screenshot : function(){ var screenshot = new ScreenShot( store.getLength() + 1, new Canva(getCanva()), editorVideo ); - + store.set(screenshot.getId(), screenshot); - + return screenshot; }, store : store, @@ -213,6 +218,6 @@ }; document.THUMB_EDITOR = ThumbEditor; - + })(document);