mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Merge branch '3.7'
This commit is contained in:
@@ -38,6 +38,10 @@
|
|||||||
"doctrine/data-fixtures" : "dev-master"
|
"doctrine/data-fixtures" : "dev-master"
|
||||||
},
|
},
|
||||||
"repositories": [
|
"repositories": [
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/romainneutron/Imagine.git"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type" : "git",
|
"type" : "git",
|
||||||
"url" : "https://github.com/winmillwill/BadFaith"
|
"url" : "https://github.com/winmillwill/BadFaith"
|
||||||
|
27
composer.lock
generated
27
composer.lock
generated
@@ -599,14 +599,17 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"sami/sami": "dev-master"
|
"sami/sami": "dev-master"
|
||||||
},
|
},
|
||||||
"time": "2012-12-13 18:31:18",
|
"suggest": {
|
||||||
|
"ext-gd": "to use the GD implementation",
|
||||||
|
"ext-gmagick": "to use the Gmagick implementation",
|
||||||
|
"ext-imagick": "to use the Imagick implementation"
|
||||||
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {
|
"psr-0": {
|
||||||
"Imagine": "lib/"
|
"Imagine": "lib/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
"license": [
|
||||||
"MIT"
|
"MIT"
|
||||||
],
|
],
|
||||||
@@ -620,11 +623,12 @@
|
|||||||
"description": "Image processing for PHP 5.3",
|
"description": "Image processing for PHP 5.3",
|
||||||
"homepage": "http://imagine.readthedocs.org/",
|
"homepage": "http://imagine.readthedocs.org/",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"image manipulation",
|
|
||||||
"image processing",
|
|
||||||
"drawing",
|
"drawing",
|
||||||
"graphics"
|
"graphics",
|
||||||
]
|
"image manipulation",
|
||||||
|
"image processing"
|
||||||
|
],
|
||||||
|
"time": "2013-03-21 10:11:30"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "knplabs/knp-snappy",
|
"name": "knplabs/knp-snappy",
|
||||||
@@ -738,13 +742,14 @@
|
|||||||
],
|
],
|
||||||
"description": "An Object Oriented wrapper for easy multimedia conversion, based on Imagine, FFMpeg, SwfTools, Unoconv and other libs",
|
"description": "An Object Oriented wrapper for easy multimedia conversion, based on Imagine, FFMpeg, SwfTools, Unoconv and other libs",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"image processing",
|
|
||||||
"image",
|
|
||||||
"audio",
|
"audio",
|
||||||
"video processing",
|
"audio processing",
|
||||||
|
"image",
|
||||||
|
"image processing",
|
||||||
"video",
|
"video",
|
||||||
"audio processing"
|
"video processing"
|
||||||
]
|
],
|
||||||
|
"time": "2013-03-21 09:21:45"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mediavorus/mediavorus",
|
"name": "mediavorus/mediavorus",
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
namespace Alchemy\Phrasea\Controller\Prod;
|
namespace Alchemy\Phrasea\Controller\Prod;
|
||||||
|
|
||||||
use Alchemy\Phrasea\Controller\RecordsRequest;
|
use Alchemy\Phrasea\Controller\RecordsRequest;
|
||||||
|
use Alchemy\Phrasea\Exception\RuntimeException;
|
||||||
use DataURI;
|
use DataURI;
|
||||||
use Silex\Application;
|
use Silex\Application;
|
||||||
use Silex\ControllerProviderInterface;
|
use Silex\ControllerProviderInterface;
|
||||||
@@ -113,27 +114,29 @@ class Tools implements ControllerProviderInterface
|
|||||||
|
|
||||||
$controllers->post('/hddoc/', function(Application $app, Request $request) {
|
$controllers->post('/hddoc/', function(Application $app, Request $request) {
|
||||||
$success = false;
|
$success = false;
|
||||||
$errorMessage = "";
|
$message = _('An error occured');
|
||||||
$fileName = null;
|
|
||||||
|
|
||||||
if ($file = $request->files->get('newHD')) {
|
if ($file = $request->files->get('newHD')) {
|
||||||
|
|
||||||
if ($file->isValid()) {
|
if ($file->isValid()) {
|
||||||
|
|
||||||
$fileName = $file->getClientOriginalName();
|
$fileName = $file->getClientOriginalName();
|
||||||
$size = $file->getClientSize();
|
|
||||||
|
|
||||||
$tempoFile = tempnam(sys_get_temp_dir(), 'substit');
|
|
||||||
unlink($tempoFile);
|
|
||||||
mkdir($tempoFile);
|
|
||||||
$tempoFile = $tempoFile . DIRECTORY_SEPARATOR . $fileName;
|
|
||||||
copy($file->getPathname(), $tempoFile);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
$tempoDir = tempnam(sys_get_temp_dir(), 'substit');
|
||||||
|
unlink($tempoDir);
|
||||||
|
mkdir($tempoDir);
|
||||||
|
$tempoFile = $tempoDir . DIRECTORY_SEPARATOR . $fileName;
|
||||||
|
|
||||||
|
if (false === rename($file->getPathname(), $tempoFile)) {
|
||||||
|
throw new RuntimeException('Error while renaming file');
|
||||||
|
}
|
||||||
|
|
||||||
$record = new \record_adapter(
|
$record = new \record_adapter(
|
||||||
$app,
|
$app,
|
||||||
$request->request->get('sbas_id')
|
$request->get('sbas_id'),
|
||||||
, $request->request->get('record_id')
|
$request->get('record_id')
|
||||||
);
|
);
|
||||||
|
|
||||||
$media = $app['mediavorus']->guess($tempoFile);
|
$media = $app['mediavorus']->guess($tempoFile);
|
||||||
@@ -144,72 +147,73 @@ class Tools implements ControllerProviderInterface
|
|||||||
$record->set_original_name($fileName);
|
$record->set_original_name($fileName);
|
||||||
$app['phraseanet.SE']->updateRecord($record);
|
$app['phraseanet.SE']->updateRecord($record);
|
||||||
}
|
}
|
||||||
|
|
||||||
$success = true;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$errorMessage = $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
unlink($tempoFile);
|
unlink($tempoFile);
|
||||||
rmdir(dirname($tempoFile));
|
rmdir($tempoDir);
|
||||||
unlink($file->getPathname());
|
$success = true;
|
||||||
|
$message = _('Document has been successfully substitued');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$message = _('file is not valid');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$errorMessage = _('file is not valid');
|
$message = _('file is not valid');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$app->abort(400, 'Missing file parameter');
|
||||||
}
|
}
|
||||||
|
|
||||||
$template = 'prod/actions/Tools/iframeUpload.html.twig';
|
return $app['twig']->render('prod/actions/Tools/iframeUpload.html.twig', array(
|
||||||
$var = array(
|
'success' => $success,
|
||||||
'success' => $success
|
'message' => $message,
|
||||||
, 'fileName' => $fileName
|
));
|
||||||
, 'errorMessage' => $errorMessage
|
|
||||||
);
|
|
||||||
|
|
||||||
return $app['twig']->render($template, $var);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$controllers->post('/chgthumb/', function(Application $app, Request $request) {
|
$controllers->post('/chgthumb/', function(Application $app, Request $request) {
|
||||||
$success = false;
|
$success = false;
|
||||||
$errorMessage = "";
|
$message = _('An error occured');
|
||||||
|
|
||||||
if ($file = $request->files->get('newThumb')) {
|
if ($file = $request->files->get('newThumb')) {
|
||||||
|
|
||||||
$size = $file->getClientSize();
|
if ($file->isValid()) {
|
||||||
$fileName = $file->getClientOriginalName();
|
|
||||||
|
|
||||||
if ($size && $fileName && $file->isValid()) {
|
|
||||||
try {
|
try {
|
||||||
$rootPath = $app['phraseanet.registry']->get('GV_RootPath');
|
$fileName = $file->getClientOriginalName();
|
||||||
$tmpFile = $rootPath . 'tmp/' . $fileName;
|
$tempoDir = tempnam(sys_get_temp_dir(), 'substit');
|
||||||
rename($file->getPathname(), $tmpFile);
|
unlink($tempoDir);
|
||||||
|
mkdir($tempoDir);
|
||||||
|
$tempoFile = $tempoDir . DIRECTORY_SEPARATOR . $fileName;
|
||||||
|
|
||||||
|
if (false === rename($file->getPathname(), $tempoFile)) {
|
||||||
|
throw new RuntimeException('Error while renaming file');
|
||||||
|
}
|
||||||
|
|
||||||
$record = new \record_adapter(
|
$record = new \record_adapter(
|
||||||
$app,
|
$app,
|
||||||
$request->request->get('sbas_id')
|
$request->get('sbas_id'),
|
||||||
, $request->request->get('record_id')
|
$request->get('record_id')
|
||||||
);
|
);
|
||||||
|
|
||||||
$media = $app['mediavorus']->guess($tmpFile);
|
$media = $app['mediavorus']->guess($tempoFile);
|
||||||
|
|
||||||
$record->substitute_subdef('thumbnail', $media, $app);
|
$record->substitute_subdef('thumbnail', $media, $app);
|
||||||
|
|
||||||
|
unlink($tempoFile);
|
||||||
|
rmdir($tempoDir);
|
||||||
$success = true;
|
$success = true;
|
||||||
|
$message = _('Thumbnail has been successfully substitued');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$errorMessage = $e->getMessage();
|
var_dump($e->getMessage());
|
||||||
|
$message = _('file is not valid');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$errorMessage = _('file is not valid');
|
$message = _('file is not valid');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$app->abort(400, 'Missing file parameter');
|
||||||
}
|
}
|
||||||
|
|
||||||
$template = 'prod/actions/Tools/iframeUpload.html.twig';
|
return $app['twig']->render('prod/actions/Tools/iframeUpload.html.twig', array(
|
||||||
$var = array(
|
'success' => $success,
|
||||||
'success' => $success
|
'message' => $message,
|
||||||
, 'fileName' => $fileName
|
));
|
||||||
, 'errorMessage' => $errorMessage
|
|
||||||
);
|
|
||||||
|
|
||||||
return $app['twig']->render($template, $var);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$controllers->post('/thumb-extractor/confirm-box/', function(Application $app, Request $request) {
|
$controllers->post('/thumb-extractor/confirm-box/', function(Application $app, Request $request) {
|
||||||
|
@@ -1,7 +1,4 @@
|
|||||||
|
|
||||||
<div class='content'>
|
<div class='content {% if not success %}text-error{% endif %}'>
|
||||||
{% if not success %}
|
{{ message }}
|
||||||
{% trans 'an error occured' %}
|
|
||||||
{{errorMessage}}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
@@ -57,7 +57,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if selectionLength == 1 and app['phraseanet.registry'].get('GV_seeOngChgDoc') %}
|
{% if selectionLength == 1 and (app['phraseanet.registry'].get('GV_seeOngChgDoc') or app['phraseanet.registry'].get('GV_seeNewThumb')) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="#substitution">
|
<a href="#substitution">
|
||||||
{% trans "substitution" %}
|
{% trans "substitution" %}
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{# subef section #}
|
{# subdef section #}
|
||||||
<div id="subdefs" class="tabBox">
|
<div id="subdefs" class="tabBox">
|
||||||
<form id="new-img-form" action="/prod/tools/image/" method="post">
|
<form id="new-img-form" action="/prod/tools/image/" method="post">
|
||||||
<fieldset style='border:1px solid #999; padding:20px;'>
|
<fieldset style='border:1px solid #999; padding:20px;'>
|
||||||
@@ -124,7 +124,19 @@
|
|||||||
<div class="PNB frame_video">
|
<div class="PNB frame_video">
|
||||||
|
|
||||||
{% set previewHtml5 = record.getSubdfefByDeviceAndMime(constant('\\databox_subdef::DEVICE_SCREEN'), ['video/ogg', 'video/mp4', 'video/webm']) %}
|
{% set previewHtml5 = record.getSubdfefByDeviceAndMime(constant('\\databox_subdef::DEVICE_SCREEN'), ['video/ogg', 'video/mp4', 'video/webm']) %}
|
||||||
<video id="thumb_video" controls="" preload="auto">
|
{% set dataW = constant('media_subdef::TC_DATA_WIDTH') %}
|
||||||
|
{% set dataH = constant('media_subdef::TC_DATA_HEIGHT') %}
|
||||||
|
|
||||||
|
{% set width = record.get_technical_infos(dataW) %}
|
||||||
|
{% set height = record.get_technical_infos(dataH) %}
|
||||||
|
|
||||||
|
{% if width and height %}
|
||||||
|
{% set ratio = width / height %}
|
||||||
|
{% else %}
|
||||||
|
{% set ratio = '' %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<video id="thumb_video" controls="" preload="auto" data-ratio="{{ ratio }}">
|
||||||
{% for subdef in previewHtml5 %}
|
{% for subdef in previewHtml5 %}
|
||||||
<source type="{{ subdef.get_mime() }}" src="{{ subdef.get_url() }}" />
|
<source type="{{ subdef.get_mime() }}" src="{{ subdef.get_url() }}" />
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -150,7 +162,7 @@
|
|||||||
<img src="/skins/prod/ThumbExtractor/delete.png" />
|
<img src="/skins/prod/ThumbExtractor/delete.png" />
|
||||||
</div>
|
</div>
|
||||||
<p id='thumb_info'>{% trans 'To take a screenshot click on camera' %}</p>
|
<p id='thumb_info'>{% trans 'To take a screenshot click on camera' %}</p>
|
||||||
<canvas id="thumb_canvas" >
|
<canvas id="thumb_canvas">
|
||||||
</canvas>
|
</canvas>
|
||||||
</div>
|
</div>
|
||||||
<div class="PNB action_bar_right">
|
<div class="PNB action_bar_right">
|
||||||
@@ -257,10 +269,13 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# hd sub section #}
|
{# hd sub section #}
|
||||||
{% if selectionLength == 1 %}
|
{% if selectionLength == 1 and (app['phraseanet.registry'].get('GV_seeOngChgDoc') or app['phraseanet.registry'].get('GV_seeNewThumb')) %}
|
||||||
{% for record in records %}
|
{% for record in selection %}
|
||||||
<div id="substitution" class="tabBox">
|
<div id="substitution" class="tabBox">
|
||||||
|
|
||||||
|
{% if "unknown" == record.get_type() %}
|
||||||
|
<i class="icon-warning-sign icon-white"></i>{% trans "Substitution is not possible for this kind of record" %}
|
||||||
|
{% else %}
|
||||||
{% if app['phraseanet.registry'].get('GV_seeOngChgDoc') %}
|
{% if app['phraseanet.registry'].get('GV_seeOngChgDoc') %}
|
||||||
<div id="substitution-hd">
|
<div id="substitution-hd">
|
||||||
<form
|
<form
|
||||||
@@ -273,8 +288,7 @@
|
|||||||
<fieldset style='border:1px solid #999;padding:20px;'>
|
<fieldset style='border:1px solid #999;padding:20px;'>
|
||||||
<legend style='color:#EEE'> <b>{% trans "substitution HD" %}</b> </legend>
|
<legend style='color:#EEE'> <b>{% trans "substitution HD" %}</b> </legend>
|
||||||
<div>
|
<div>
|
||||||
<input type="hidden" name="MAX_FILE_SIZE" value="20000000" />
|
<input id='new-hd-file' name="newHD" type="file"/>
|
||||||
<input id='new-hd-file' name="newHD" type="file" />
|
|
||||||
<br />
|
<br />
|
||||||
<label for="CCFNALP" class="checkbox">
|
<label for="CCFNALP" class="checkbox">
|
||||||
<input type="checkbox" name="ccfilename" id="CCFNALP" value="1">
|
<input type="checkbox" name="ccfilename" id="CCFNALP" value="1">
|
||||||
@@ -306,7 +320,6 @@
|
|||||||
<fieldset style='border:1px solid #999;padding:20px;'>
|
<fieldset style='border:1px solid #999;padding:20px;'>
|
||||||
<legend style='color:#EEE'> <b>{% trans "substitution SD" %}</b> </legend>
|
<legend style='color:#EEE'> <b>{% trans "substitution SD" %}</b> </legend>
|
||||||
<div>
|
<div>
|
||||||
<input type="hidden" name="MAX_FILE_SIZE" value="20000000" />
|
|
||||||
<input id='new-sd-file' name="newThumb" type="file" />
|
<input id='new-sd-file' name="newThumb" type="file" />
|
||||||
<input type="hidden" name="sbas_id" value="{{record.get_sbas_id()}}" />
|
<input type="hidden" name="sbas_id" value="{{record.get_sbas_id()}}" />
|
||||||
<input type="hidden" name="record_id" value="{{record.get_record_id()}}" />
|
<input type="hidden" name="record_id" value="{{record.get_record_id()}}" />
|
||||||
@@ -321,6 +334,7 @@
|
|||||||
<div class='resultAction'></div>
|
<div class='resultAction'></div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@@ -77,6 +77,11 @@
|
|||||||
<img style="cursor:help;" src="/skins/icons/ok.png" title="{% spaceless %}{{title|e}}{% endspaceless %}" />
|
<img style="cursor:help;" src="/skins/icons/ok.png" title="{% spaceless %}{{title|e}}{% endspaceless %}" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<div style="position:absolute;bottom:4px;right:4px;">
|
||||||
|
<img class="infoTips" tooltipsrc="/prod/tooltip/tc_datas/{{element.get_sbas_id()}}/{{element.get_record_id()}}/" src="/skins/icons/info.gif"/>
|
||||||
|
<div tooltipsrc="/prod/tooltip/preview/{{element.get_sbas_id()}}/{{element.get_record_id()}}/" class="previewTips"></div>
|
||||||
|
<div tooltipsrc="/prod/tooltip/caption/{{element.get_sbas_id()}}/{{element.get_record_id()}}/preview/" class="captionRolloverTips"></div>
|
||||||
|
</div>
|
||||||
<input type="hidden" name="order_element_id" value="{{order_element_id}}"/>
|
<input type="hidden" name="order_element_id" value="{{order_element_id}}"/>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -155,6 +160,13 @@ $(document).ready(function(){
|
|||||||
$this.addClass('last_selected');
|
$this.addClass('last_selected');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.captionTips, .captionRolloverTips, .infoTips', dialog.getDomElement()).tooltip({
|
||||||
|
delay:0
|
||||||
|
});
|
||||||
|
$('.previewTips', dialog.getDomElement()).tooltip({
|
||||||
|
fixable:true
|
||||||
|
});
|
||||||
|
|
||||||
$('button.send', dialog.getDomElement()).bind('click',function(){
|
$('button.send', dialog.getDomElement()).bind('click',function(){
|
||||||
send_documents(order_id);
|
send_documents(order_id);
|
||||||
});
|
});
|
||||||
|
64
tests/Alchemy/Tests/Phrasea/Controller/Prod/ToolsTest.php
Normal file
64
tests/Alchemy/Tests/Phrasea/Controller/Prod/ToolsTest.php
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Alchemy\Tests\Phrasea\Controller\Prod;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||||
|
|
||||||
|
class ControllerToolsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||||
|
{
|
||||||
|
protected $client;
|
||||||
|
protected $tmpFile;
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->tmpFile = sys_get_temp_dir() . '/' . time() . mt_rand(1000, 9999) . '.jpg';
|
||||||
|
copy(__DIR__ . '/../../../../../files/cestlafete.jpg', $this->tmpFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
if (file_exists($this->tmpFile)) {
|
||||||
|
unlink($this->tmpFile);
|
||||||
|
}
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRouteChangeDoc()
|
||||||
|
{
|
||||||
|
$record = self::$DI['record_1'];
|
||||||
|
|
||||||
|
$crawler = self::$DI['client']->request('POST', '/prod/tools/hddoc/', array(
|
||||||
|
'sbas_id' => $record->get_sbas_id(),
|
||||||
|
'record_id' => $record->get_record_id(),
|
||||||
|
), array(
|
||||||
|
'newHD' => new UploadedFile(
|
||||||
|
$this->tmpFile, 'KIKOO.JPG', 'image/jpg', 2000
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = self::$DI['client']->getResponse();
|
||||||
|
$message = trim($crawler->filterXPath('//div')->text());
|
||||||
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals(_('Document has been successfully substitued'), $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRouteChangeThumb()
|
||||||
|
{
|
||||||
|
$record = self::$DI['record_1'];
|
||||||
|
|
||||||
|
$crawler = self::$DI['client']->request('POST', '/prod/tools/chgthumb/', array(
|
||||||
|
'sbas_id' => $record->get_sbas_id(),
|
||||||
|
'record_id' => $record->get_record_id(),
|
||||||
|
), array(
|
||||||
|
'newThumb' => new UploadedFile(
|
||||||
|
$this->tmpFile, 'KIKOO.JPG', 'image/jpg', 2000
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = self::$DI['client']->getResponse();
|
||||||
|
$message = trim($crawler->filterXPath('//div')->text());
|
||||||
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals(_('Thumbnail has been successfully substitued'), $message);
|
||||||
|
}
|
||||||
|
}
|
@@ -184,6 +184,59 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSearch_withOffset()
|
||||||
|
{
|
||||||
|
$request = new Request(array(), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||||
|
$result = $this->object->search_records($request);
|
||||||
|
$this->assertEquals(200, $result->get_http_code());
|
||||||
|
$this->assertEquals('application/json', $result->get_content_type());
|
||||||
|
$this->assertTrue(is_array(json_decode($result->format(), true)));
|
||||||
|
|
||||||
|
$data = json_decode($result->format(), true);
|
||||||
|
|
||||||
|
if ($data['response']['total_results'] < 2) {
|
||||||
|
$this->markTestSkipped('Not enough data to test');
|
||||||
|
}
|
||||||
|
|
||||||
|
$total = $data['response']['total_results'];
|
||||||
|
|
||||||
|
$request = new Request(array(
|
||||||
|
'offset_start' => 0,
|
||||||
|
'per_page' => 1,
|
||||||
|
), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||||
|
$resultData1 = $this->object->search_records($request);
|
||||||
|
|
||||||
|
$data = json_decode($resultData1->format(), true);
|
||||||
|
|
||||||
|
$this->assertCount(1, $data['response']['results']);
|
||||||
|
$result1 = array_pop($data['response']['results']);
|
||||||
|
|
||||||
|
$request = new Request(array(
|
||||||
|
'offset_start' => 1,
|
||||||
|
'per_page' => 1,
|
||||||
|
), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||||
|
$resultData2 = $this->object->search_records($request);
|
||||||
|
|
||||||
|
$data = json_decode($resultData2->format(), true);
|
||||||
|
|
||||||
|
$this->assertCount(1, $data['response']['results']);
|
||||||
|
$result2 = array_pop($data['response']['results']);
|
||||||
|
|
||||||
|
// item at offset #0 is different than offset at item #1
|
||||||
|
$this->assertNotEquals($result1['record_id'], $result2['record_id']);
|
||||||
|
|
||||||
|
// last item is last item
|
||||||
|
$request = new Request(array(
|
||||||
|
'offset_start' => $total - 1,
|
||||||
|
'per_page' => 10,
|
||||||
|
), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||||
|
$resultData = $this->object->search_records($request);
|
||||||
|
|
||||||
|
$data = json_decode($resultData->format(), true);
|
||||||
|
|
||||||
|
$this->assertCount(1, $data['response']['results']);
|
||||||
|
}
|
||||||
|
|
||||||
public function testSearch_recordsWithStories()
|
public function testSearch_recordsWithStories()
|
||||||
{
|
{
|
||||||
$auth = new \Session_Authentication_None(self::$DI['user']);
|
$auth = new \Session_Authentication_None(self::$DI['user']);
|
||||||
|
@@ -429,8 +429,35 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
top -= 10;
|
if(resizeImgTips)
|
||||||
height += 20;
|
{
|
||||||
|
var factor = Math.min((width - 45) / width, (height - 75) / height);
|
||||||
|
var imgWidth = Math.round(width * factor);
|
||||||
|
var imgHeight = Math.round(height * factor);
|
||||||
|
|
||||||
|
width = imgWidth + 45;
|
||||||
|
height = imgHeight + 85;
|
||||||
|
|
||||||
|
$imgTips.css({
|
||||||
|
maxWidth: imgWidth,
|
||||||
|
maxHeight: imgHeight
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(resizeVideoTips)
|
||||||
|
{
|
||||||
|
var factor = Math.min((width - 45) / width, (height - 75) / height);
|
||||||
|
var imgWidth = Math.round(width * factor);
|
||||||
|
var imgHeight = Math.round(height * factor);
|
||||||
|
|
||||||
|
width = imgWidth + 45;
|
||||||
|
height = imgHeight + 75;
|
||||||
|
|
||||||
|
$videoTips.css({
|
||||||
|
width: Math.round(imgWidth),
|
||||||
|
height: Math.round(imgHeight)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
helper.parent.css({
|
helper.parent.css({
|
||||||
width: Math.round(width),
|
width: Math.round(width),
|
||||||
@@ -439,22 +466,6 @@
|
|||||||
top: top
|
top: top
|
||||||
});
|
});
|
||||||
|
|
||||||
if(resizeImgTips)
|
|
||||||
{
|
|
||||||
$imgTips.css({
|
|
||||||
maxWidth: Math.round(width - 50),
|
|
||||||
maxHeight: Math.round(height-70)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if(resizeVideoTips)
|
|
||||||
{
|
|
||||||
$videoTips.css({
|
|
||||||
width: Math.round(width - 50),
|
|
||||||
height: Math.round(height-70)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -6,12 +6,23 @@
|
|||||||
*****************/
|
*****************/
|
||||||
var Canva = function(domCanva){
|
var Canva = function(domCanva){
|
||||||
this.domCanva = domCanva;
|
this.domCanva = domCanva;
|
||||||
}
|
};
|
||||||
|
|
||||||
Canva.prototype = {
|
Canva.prototype = {
|
||||||
resize : function(elementDomNode){
|
resize : function(elementDomNode){
|
||||||
var h = elementDomNode.getHeight();
|
|
||||||
var w = elementDomNode.getWidth();
|
var w = elementDomNode.getWidth();
|
||||||
|
var maxH = elementDomNode.getHeight();
|
||||||
|
|
||||||
|
if ('' !== elementDomNode.getAspectRatio()) {
|
||||||
|
var h = Math.round(w * (1 / elementDomNode.getAspectRatio()));
|
||||||
|
|
||||||
|
if (h > maxH) {
|
||||||
|
var h = maxH;
|
||||||
|
var w = Math.round(h * elementDomNode.getAspectRatio());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var h = maxH;
|
||||||
|
}
|
||||||
|
|
||||||
this.domCanva.setAttribute("width", w);
|
this.domCanva.setAttribute("width", w);
|
||||||
this.domCanva.setAttribute("height", h);
|
this.domCanva.setAttribute("height", h);
|
||||||
@@ -20,7 +31,7 @@
|
|||||||
},
|
},
|
||||||
getContext2d : function(){
|
getContext2d : function(){
|
||||||
|
|
||||||
if (this.domCanva.getContext == undefined)
|
if (undefined === this.domCanva.getContext)
|
||||||
{
|
{
|
||||||
return G_vmlCanvasManager
|
return G_vmlCanvasManager
|
||||||
.initElement(this.domCanva)
|
.initElement(this.domCanva)
|
||||||
@@ -94,6 +105,7 @@
|
|||||||
|
|
||||||
var Video = function(domElement){
|
var Video = function(domElement){
|
||||||
Image.call(this, domElement);
|
Image.call(this, domElement);
|
||||||
|
this.aspectRatio = domElement.getAttribute('data-ratio');
|
||||||
};
|
};
|
||||||
|
|
||||||
Video.prototype = new Image();
|
Video.prototype = new Image();
|
||||||
@@ -101,6 +113,9 @@
|
|||||||
Video.prototype.getCurrentTime = function(){
|
Video.prototype.getCurrentTime = function(){
|
||||||
return Math.floor(this.domElement.currentTime);
|
return Math.floor(this.domElement.currentTime);
|
||||||
};
|
};
|
||||||
|
Video.prototype.getAspectRatio = function(){
|
||||||
|
return this.aspectRatio;
|
||||||
|
};
|
||||||
|
|
||||||
/******************
|
/******************
|
||||||
* Cache Object
|
* Cache Object
|
||||||
@@ -148,7 +163,7 @@
|
|||||||
this.timestamp = date.getTime();
|
this.timestamp = date.getTime();
|
||||||
this.dataURI = canva.extractImage();
|
this.dataURI = canva.extractImage();
|
||||||
this.videoTime = video.getCurrentTime();
|
this.videoTime = video.getCurrentTime();
|
||||||
}
|
};
|
||||||
|
|
||||||
ScreenShot.prototype = {
|
ScreenShot.prototype = {
|
||||||
getId:function(){
|
getId:function(){
|
||||||
|
@@ -3741,7 +3741,7 @@ dans l'onglet thesaurus : arbres, menus contextuels
|
|||||||
#thumbExtractor .main_title {
|
#thumbExtractor .main_title {
|
||||||
height: 15px;
|
height: 15px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
top: 15px
|
top: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#thumbExtractor .part_title_left {
|
#thumbExtractor .part_title_left {
|
||||||
@@ -3780,11 +3780,18 @@ dans l'onglet thesaurus : arbres, menus contextuels
|
|||||||
border: 1px solid #1A1B1B;
|
border: 1px solid #1A1B1B;
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
height: 210px;
|
height: 210px;
|
||||||
|
line-height:210px;
|
||||||
width: 320px;
|
width: 320px;
|
||||||
top: 50px;
|
top: 50px;
|
||||||
left: 380px;
|
left: 380px;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
text-align: center
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#thumbExtractor #thumb_canvas {
|
||||||
|
vertical-align:middle;
|
||||||
|
display:inline-block;
|
||||||
|
line-height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#thumbExtractor .action_bar_left {
|
#thumbExtractor .action_bar_left {
|
||||||
@@ -3811,7 +3818,7 @@ dans l'onglet thesaurus : arbres, menus contextuels
|
|||||||
#thumbExtractor .action_bar_right .action_icon {
|
#thumbExtractor .action_bar_right .action_icon {
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
display: table-cell;
|
display: table-cell;
|
||||||
vertical-align: middle
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
#thumbExtractor .action_bar_right .action_icon:hover {
|
#thumbExtractor .action_bar_right .action_icon:hover {
|
||||||
@@ -3825,6 +3832,7 @@ dans l'onglet thesaurus : arbres, menus contextuels
|
|||||||
bottom: 10px;
|
bottom: 10px;
|
||||||
right: 60px;
|
right: 60px;
|
||||||
display: none;
|
display: none;
|
||||||
|
line-height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#thumbExtractor #thumb_delete_button {
|
#thumbExtractor #thumb_delete_button {
|
||||||
@@ -3833,7 +3841,8 @@ dans l'onglet thesaurus : arbres, menus contextuels
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 10px;
|
bottom: 10px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
display: none
|
display: none;
|
||||||
|
line-height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#thumbExtractor #thumb_delete_button,
|
#thumbExtractor #thumb_delete_button,
|
||||||
|
@@ -3925,6 +3925,7 @@ dans l'onglet thesaurus : arbres, menus contextuels
|
|||||||
border: 1px solid #1A1B1B;
|
border: 1px solid #1A1B1B;
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
height: 210px;
|
height: 210px;
|
||||||
|
line-height:210px;
|
||||||
width: 320px;
|
width: 320px;
|
||||||
top: 50px;
|
top: 50px;
|
||||||
left: 380px;
|
left: 380px;
|
||||||
@@ -3932,6 +3933,12 @@ dans l'onglet thesaurus : arbres, menus contextuels
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#thumbExtractor #thumb_canvas {
|
||||||
|
vertical-align:middle;
|
||||||
|
display:inline-block;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
#thumbExtractor .action_bar_left {
|
#thumbExtractor .action_bar_left {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
width: 320px;
|
width: 320px;
|
||||||
@@ -3970,6 +3977,7 @@ dans l'onglet thesaurus : arbres, menus contextuels
|
|||||||
bottom: 10px;
|
bottom: 10px;
|
||||||
right: 60px;
|
right: 60px;
|
||||||
display: none;
|
display: none;
|
||||||
|
line-height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#thumbExtractor #thumb_delete_button {
|
#thumbExtractor #thumb_delete_button {
|
||||||
@@ -3979,6 +3987,7 @@ dans l'onglet thesaurus : arbres, menus contextuels
|
|||||||
bottom: 10px;
|
bottom: 10px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
display: none;
|
display: none;
|
||||||
|
line-height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#thumbExtractor #thumb_delete_button,
|
#thumbExtractor #thumb_delete_button,
|
||||||
|
Reference in New Issue
Block a user