mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Merge branch 'master' into PHRAS-2603-migration-patch-configuration-yml
This commit is contained in:
@@ -45,10 +45,7 @@ RUN apt-get update \
|
|||||||
&& docker-php-source delete \
|
&& docker-php-source delete \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
|
COPY --from=composer:1.9.1 /usr/bin/composer /usr/bin/composer
|
||||||
&& php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
|
|
||||||
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
|
|
||||||
&& php -r "unlink('composer-setup.php');"
|
|
||||||
|
|
||||||
# Node Installation (node + yarn)
|
# Node Installation (node + yarn)
|
||||||
# Reference :
|
# Reference :
|
||||||
|
@@ -18,6 +18,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "package",
|
||||||
|
"package": {
|
||||||
|
"name": "exiftool/exiftool",
|
||||||
|
"version": "11",
|
||||||
|
"source": {
|
||||||
|
"url": "https://github.com/exiftool/exiftool.git",
|
||||||
|
"type": "git",
|
||||||
|
"reference": "11.84"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://github.com/alchemy-fr/tcpdf-clone"
|
"url": "https://github.com/alchemy-fr/tcpdf-clone"
|
||||||
@@ -95,7 +107,7 @@
|
|||||||
"pagerfanta/pagerfanta": "^1.0",
|
"pagerfanta/pagerfanta": "^1.0",
|
||||||
"php-ffmpeg/php-ffmpeg": "~0.5.0",
|
"php-ffmpeg/php-ffmpeg": "~0.5.0",
|
||||||
"php-xpdf/php-xpdf": "~0.2.1",
|
"php-xpdf/php-xpdf": "~0.2.1",
|
||||||
"phpexiftool/exiftool": "10.10",
|
"exiftool/exiftool": "^11",
|
||||||
"ramsey/uuid": "^3.0",
|
"ramsey/uuid": "^3.0",
|
||||||
"roave/security-advisories": "dev-master",
|
"roave/security-advisories": "dev-master",
|
||||||
"silex/silex": "^1.3.0",
|
"silex/silex": "^1.3.0",
|
||||||
|
109
composer.lock
generated
109
composer.lock
generated
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"_readme": [
|
"_readme": [
|
||||||
"This file locks the dependencies of your project to a known state",
|
"This file locks the dependencies of your project to a known state",
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "d0c8742d02e8d51c702c26ecb5502b30",
|
"content-hash": "5a4a0be62b13071a6b06893b7ce08372",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "alchemy-fr/tcpdf-clone",
|
"name": "alchemy-fr/tcpdf-clone",
|
||||||
@@ -137,6 +137,12 @@
|
|||||||
"url": "https://github.com/alchemy-fr/embed-bundle.git",
|
"url": "https://github.com/alchemy-fr/embed-bundle.git",
|
||||||
"reference": "cbaa5e34b7b6ccbe128f8c804649c8a3ecd1e621"
|
"reference": "cbaa5e34b7b6ccbe128f8c804649c8a3ecd1e621"
|
||||||
},
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/alchemy-fr/embed-bundle/zipball/cbaa5e34b7b6ccbe128f8c804649c8a3ecd1e621",
|
||||||
|
"reference": "cbaa5e34b7b6ccbe128f8c804649c8a3ecd1e621",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^4.7",
|
"phpunit/phpunit": "^4.7",
|
||||||
"silex/silex": "^1.0.0",
|
"silex/silex": "^1.0.0",
|
||||||
@@ -373,30 +379,27 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "alchemy/phpexiftool",
|
"name": "alchemy/phpexiftool",
|
||||||
"version": "0.7.2",
|
"version": "0.7.3",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/alchemy-fr/PHPExiftool.git",
|
"url": "https://github.com/alchemy-fr/PHPExiftool.git",
|
||||||
"reference": "ba1cb51eceb6562d7996023478977a8739de188b"
|
"reference": "0b22e7d7cc40f2a6b9c85c0cfbd968a39a31dab2"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/alchemy-fr/PHPExiftool/zipball/ba1cb51eceb6562d7996023478977a8739de188b",
|
"url": "https://api.github.com/repos/alchemy-fr/PHPExiftool/zipball/0b22e7d7cc40f2a6b9c85c0cfbd968a39a31dab2",
|
||||||
"reference": "ba1cb51eceb6562d7996023478977a8739de188b",
|
"reference": "0b22e7d7cc40f2a6b9c85c0cfbd968a39a31dab2",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"doctrine/cache": "^1.0",
|
"doctrine/cache": "^1.0",
|
||||||
"doctrine/collections": "^1.0",
|
"doctrine/collections": "^1.0",
|
||||||
|
"exiftool/exiftool": "^11",
|
||||||
"monolog/monolog": "^1.3",
|
"monolog/monolog": "^1.3",
|
||||||
"php": ">=5.5.9",
|
"php": ">=5.5.9",
|
||||||
"phpexiftool/exiftool": "10.10",
|
|
||||||
"symfony/console": "^2.1|^3.0",
|
"symfony/console": "^2.1|^3.0",
|
||||||
"symfony/process": "^2.1|^3.0"
|
"symfony/process": "^2.1|^3.0"
|
||||||
},
|
},
|
||||||
"replace": {
|
|
||||||
"phpexiftool/phpexiftool": "<0.5.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"jms/serializer": "~0.10|^1.0",
|
"jms/serializer": "~0.10|^1.0",
|
||||||
"phpunit/phpunit": "^4.0|^5.0",
|
"phpunit/phpunit": "^4.0|^5.0",
|
||||||
@@ -442,7 +445,7 @@
|
|||||||
"exiftool",
|
"exiftool",
|
||||||
"metadata"
|
"metadata"
|
||||||
],
|
],
|
||||||
"time": "2019-02-13T13:06:43+00:00"
|
"time": "2020-01-17T14:28:33+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "alchemy/queue-bundle",
|
"name": "alchemy/queue-bundle",
|
||||||
@@ -2095,6 +2098,16 @@
|
|||||||
],
|
],
|
||||||
"time": "2012-05-30T15:01:08+00:00"
|
"time": "2012-05-30T15:01:08+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "exiftool/exiftool",
|
||||||
|
"version": "11",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/exiftool/exiftool.git",
|
||||||
|
"reference": "11.84"
|
||||||
|
},
|
||||||
|
"type": "library"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "facebook/graph-sdk",
|
"name": "facebook/graph-sdk",
|
||||||
"version": "5.6.1",
|
"version": "5.6.1",
|
||||||
@@ -5395,39 +5408,6 @@
|
|||||||
],
|
],
|
||||||
"time": "2015-05-17T12:39:23+00:00"
|
"time": "2015-05-17T12:39:23+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "phpexiftool/exiftool",
|
|
||||||
"version": "10.10",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/alchemy-fr/exiftool.git",
|
|
||||||
"reference": "0833cab894c890353192a83011428525a318bedf"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/alchemy-fr/exiftool/zipball/0833cab894c890353192a83011428525a318bedf",
|
|
||||||
"reference": "0833cab894c890353192a83011428525a318bedf",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"Perl Licensing"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Phil Harvey",
|
|
||||||
"email": "phil@owl.phy.queensu.ca",
|
|
||||||
"homepage": "http://www.sno.phy.queensu.ca/~phil/exiftool/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Exiftool is a library for reading, writing and editing meta information. This package is not PHP, but required for the main PHP driver : PHP Exiftool",
|
|
||||||
"keywords": [
|
|
||||||
"exiftool",
|
|
||||||
"metadatas"
|
|
||||||
],
|
|
||||||
"time": "2016-01-25T11:10:14+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "phpoption/phpoption",
|
"name": "phpoption/phpoption",
|
||||||
"version": "1.5.0",
|
"version": "1.5.0",
|
||||||
@@ -5892,6 +5872,12 @@
|
|||||||
"url": "https://github.com/Roave/SecurityAdvisories.git",
|
"url": "https://github.com/Roave/SecurityAdvisories.git",
|
||||||
"reference": "0698207bf8a9bed212fdde2d8c7cdc77085660c4"
|
"reference": "0698207bf8a9bed212fdde2d8c7cdc77085660c4"
|
||||||
},
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/0698207bf8a9bed212fdde2d8c7cdc77085660c4",
|
||||||
|
"reference": "0698207bf8a9bed212fdde2d8c7cdc77085660c4",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"adodb/adodb-php": "<5.20.6",
|
"adodb/adodb-php": "<5.20.6",
|
||||||
"amphp/artax": ">=2,<2.0.4|>0.7.1,<1.0.4",
|
"amphp/artax": ">=2,<2.0.4|>0.7.1,<1.0.4",
|
||||||
@@ -7716,6 +7702,7 @@
|
|||||||
"code",
|
"code",
|
||||||
"zf2"
|
"zf2"
|
||||||
],
|
],
|
||||||
|
"abandoned": "laminas/laminas-code",
|
||||||
"time": "2016-04-20T17:26:42+00:00"
|
"time": "2016-04-20T17:26:42+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -7770,6 +7757,7 @@
|
|||||||
"events",
|
"events",
|
||||||
"zf2"
|
"zf2"
|
||||||
],
|
],
|
||||||
|
"abandoned": "laminas/laminas-eventmanager",
|
||||||
"time": "2016-02-18T20:53:00+00:00"
|
"time": "2016-02-18T20:53:00+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -7966,6 +7954,39 @@
|
|||||||
],
|
],
|
||||||
"time": "2016-11-25T06:54:22+00:00"
|
"time": "2016-11-25T06:54:22+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "phpexiftool/exiftool",
|
||||||
|
"version": "10.10",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/alchemy-fr/exiftool.git",
|
||||||
|
"reference": "0833cab894c890353192a83011428525a318bedf"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/alchemy-fr/exiftool/zipball/0833cab894c890353192a83011428525a318bedf",
|
||||||
|
"reference": "0833cab894c890353192a83011428525a318bedf",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"Perl Licensing"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Phil Harvey",
|
||||||
|
"email": "phil@owl.phy.queensu.ca",
|
||||||
|
"homepage": "http://www.sno.phy.queensu.ca/~phil/exiftool/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Exiftool is a library for reading, writing and editing meta information. This package is not PHP, but required for the main PHP driver : PHP Exiftool",
|
||||||
|
"keywords": [
|
||||||
|
"exiftool",
|
||||||
|
"metadatas"
|
||||||
|
],
|
||||||
|
"time": "2016-01-25T11:10:14+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "phpspec/prophecy",
|
"name": "phpspec/prophecy",
|
||||||
"version": "v1.6.2",
|
"version": "v1.6.2",
|
||||||
|
@@ -136,6 +136,7 @@ class LanguageController
|
|||||||
'or' => $translator->trans('or'),
|
'or' => $translator->trans('or'),
|
||||||
'Suppr' => $translator->trans('Suppr'),
|
'Suppr' => $translator->trans('Suppr'),
|
||||||
'Add new range' => $translator->trans('Add new range'),
|
'Add new range' => $translator->trans('Add new range'),
|
||||||
|
'Save as VTT' => $translator->trans('Save as VTT'),
|
||||||
'Export ranges' => $translator->trans('Export ranges'),
|
'Export ranges' => $translator->trans('Export ranges'),
|
||||||
'Start Range' => $translator->trans('Start Range'),
|
'Start Range' => $translator->trans('Start Range'),
|
||||||
'End Range' => $translator->trans('End Range'),
|
'End Range' => $translator->trans('End Range'),
|
||||||
|
@@ -12,7 +12,7 @@ namespace Alchemy\Phrasea\Controller\Prod;
|
|||||||
use Alchemy\Phrasea\Application\Helper\DataboxLoggerAware;
|
use Alchemy\Phrasea\Application\Helper\DataboxLoggerAware;
|
||||||
use Alchemy\Phrasea\Controller\Controller;
|
use Alchemy\Phrasea\Controller\Controller;
|
||||||
use Alchemy\Phrasea\Helper\Record as RecordHelper;
|
use Alchemy\Phrasea\Helper\Record as RecordHelper;
|
||||||
use Alchemy\Phrasea\Out\Module\PDF as PDFExport;
|
use Alchemy\Phrasea\Out\Module\PDFRecords;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
@@ -24,19 +24,27 @@ class PrinterController extends Controller
|
|||||||
{
|
{
|
||||||
$printer = new RecordHelper\Printer($this->app, $request);
|
$printer = new RecordHelper\Printer($this->app, $request);
|
||||||
|
|
||||||
return $this->render('prod/actions/printer_default.html.twig', ['printer' => $printer, 'message' => '']);
|
$basketFeedbackId = null;
|
||||||
|
if($printer->is_basket() && ($basket = $printer->get_original_basket()) && ($validation = $basket->getValidation())) {
|
||||||
|
if($validation->getInitiator()->getId() === $this->app->getAuthenticatedUser()->getId()) {
|
||||||
|
$basketFeedbackId = $basket->getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('prod/actions/printer_default.html.twig', ['printer' => $printer, 'message' => '', 'basketFeedbackId' => $basketFeedbackId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function printAction(Request $request)
|
public function printAction(Request $request)
|
||||||
{
|
{
|
||||||
$printer = new RecordHelper\Printer($this->app, $request);
|
$printer = new RecordHelper\Printer($this->app, $request);
|
||||||
|
$b = $printer->get_original_basket();
|
||||||
|
|
||||||
$layout = $request->request->get('lay');
|
$layout = $request->request->get('lay');
|
||||||
|
|
||||||
foreach ($printer->get_elements() as $record) {
|
foreach ($printer->get_elements() as $record) {
|
||||||
$this->getDataboxLogger($record->getDatabox())->log($record, \Session_Logger::EVENT_PRINT, $layout, '');
|
$this->getDataboxLogger($record->getDatabox())->log($record, \Session_Logger::EVENT_PRINT, $layout, '');
|
||||||
}
|
}
|
||||||
$PDF = new PDFExport($this->app, $printer->get_elements(), $layout);
|
$PDF = new PDFRecords($this->app, $printer, $layout);
|
||||||
|
|
||||||
$response = new Response($PDF->render(), 200, array('Content-Type' => 'application/pdf'));
|
$response = new Response($PDF->render(), 200, array('Content-Type' => 'application/pdf'));
|
||||||
$response->headers->set('Pragma', 'public', true);
|
$response->headers->set('Pragma', 'public', true);
|
||||||
@@ -44,4 +52,5 @@ class PrinterController extends Controller
|
|||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -456,17 +456,27 @@ class Basket
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function hasRecord(Application $app, \record_adapter $record)
|
public function hasRecord(Application $app, \record_adapter $record)
|
||||||
|
{
|
||||||
|
return !is_null($this->getElementByRecord($app, $record));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Application $app
|
||||||
|
* @param \record_adapter $record
|
||||||
|
* @return BasketElement
|
||||||
|
*/
|
||||||
|
public function getElementByRecord(Application $app, \record_adapter $record)
|
||||||
{
|
{
|
||||||
foreach ($this->getElements() as $basket_element) {
|
foreach ($this->getElements() as $basket_element) {
|
||||||
$bask_record = $basket_element->getRecord($app);
|
$bask_record = $basket_element->getRecord($app);
|
||||||
|
|
||||||
if ($bask_record->getRecordId() == $record->getRecordId()
|
if ($bask_record->getRecordId() == $record->getRecordId()
|
||||||
&& $bask_record->getDataboxId() == $record->getDataboxId()) {
|
&& $bask_record->getDataboxId() == $record->getDataboxId()) {
|
||||||
return true;
|
return $basket_element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSize(Application $app)
|
public function getSize(Application $app)
|
||||||
|
@@ -368,7 +368,7 @@ class UserManipulator implements ManipulatorInterface
|
|||||||
throw new InvalidArgumentException(sprintf('Email %s is not legal.', $email));
|
throw new InvalidArgumentException(sprintf('Email %s is not legal.', $email));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $this->repository->findByEmail($email)) {
|
if (($email !== null) && (null !== $this->repository->findByEmail($email))) {
|
||||||
throw new RuntimeException(sprintf('User with email %s already exists.', $email));
|
throw new RuntimeException(sprintf('User with email %s already exists.', $email));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -232,7 +232,7 @@ class BasketRepository extends EntityRepository
|
|||||||
$dql = "SELECT b\n"
|
$dql = "SELECT b\n"
|
||||||
. "FROM Phraseanet:Basket b\n"
|
. "FROM Phraseanet:Basket b\n"
|
||||||
. " JOIN b.elements e\n"
|
. " JOIN b.elements e\n"
|
||||||
. "WHERE b.user = :usr_id AND b.pusher_id IS NOT NULL";
|
. "WHERE b.user = :usr_id AND b.pusher IS NOT NULL";
|
||||||
$params = [
|
$params = [
|
||||||
'usr_id' => $user->getId()
|
'usr_id' => $user->getId()
|
||||||
];
|
];
|
||||||
|
@@ -20,6 +20,7 @@ class PDF
|
|||||||
protected $records;
|
protected $records;
|
||||||
protected $pdf;
|
protected $pdf;
|
||||||
|
|
||||||
|
const LAYOUT_FEEDBACK = 'feedback';
|
||||||
const LAYOUT_PREVIEW = 'preview';
|
const LAYOUT_PREVIEW = 'preview';
|
||||||
const LAYOUT_PREVIEWCAPTION = 'previewCaption';
|
const LAYOUT_PREVIEWCAPTION = 'previewCaption';
|
||||||
const LAYOUT_PREVIEWCAPTIONTDM = 'previewCaptionTdm';
|
const LAYOUT_PREVIEWCAPTIONTDM = 'previewCaptionTdm';
|
||||||
@@ -27,64 +28,10 @@ class PDF
|
|||||||
const LAYOUT_THUMBNAILGRID = 'thumbnailGrid';
|
const LAYOUT_THUMBNAILGRID = 'thumbnailGrid';
|
||||||
const LAYOUT_CAPTION = 'caption';
|
const LAYOUT_CAPTION = 'caption';
|
||||||
|
|
||||||
public function __construct(Application $app, array $records, $layout)
|
public function __construct(Application $app)
|
||||||
{
|
{
|
||||||
$this->app = $app;
|
$this->app = $app;
|
||||||
|
|
||||||
$list = [];
|
|
||||||
|
|
||||||
foreach ($records as $record) {
|
|
||||||
switch ($layout) {
|
|
||||||
default:
|
|
||||||
throw new \Exception('Unknown layout');
|
|
||||||
break;
|
|
||||||
case self::LAYOUT_PREVIEW:
|
|
||||||
case self::LAYOUT_PREVIEWCAPTION:
|
|
||||||
case self::LAYOUT_PREVIEWCAPTIONTDM:
|
|
||||||
try {
|
|
||||||
$subdef = $record->get_subdef('preview');
|
|
||||||
// fallback to thumbnail ( video, sound, doc ) ..
|
|
||||||
if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) {
|
|
||||||
$subdef = $record->get_thumbnail();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$subdef->is_physically_present()) {
|
|
||||||
continue 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) {
|
|
||||||
continue 2;
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
continue 2;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case self::LAYOUT_THUMBNAILLIST:
|
|
||||||
case self::LAYOUT_THUMBNAILGRID:
|
|
||||||
try {
|
|
||||||
$subdef = $record->get_thumbnail();
|
|
||||||
if (!$subdef->is_physically_present()) {
|
|
||||||
continue 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) {
|
|
||||||
continue 2;
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
continue 2;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case self::LAYOUT_CAPTION:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$record->setNumber(count($list) + 1);
|
|
||||||
|
|
||||||
$list[] = $record;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->records = $list;
|
|
||||||
|
|
||||||
$pdf = new PhraseaPDF("P", "mm", "A4", true, 'UTF-8', false);
|
$pdf = new PhraseaPDF("P", "mm", "A4", true, 'UTF-8', false);
|
||||||
|
|
||||||
$pdf->SetAuthor("Phraseanet");
|
$pdf->SetAuthor("Phraseanet");
|
||||||
@@ -92,29 +39,6 @@ class PDF
|
|||||||
$pdf->SetDisplayMode("fullpage", "single");
|
$pdf->SetDisplayMode("fullpage", "single");
|
||||||
|
|
||||||
$this->pdf = $pdf;
|
$this->pdf = $pdf;
|
||||||
|
|
||||||
switch ($layout) {
|
|
||||||
case self::LAYOUT_PREVIEW:
|
|
||||||
$this->print_preview(false, false);
|
|
||||||
break;
|
|
||||||
case self::LAYOUT_PREVIEWCAPTION:
|
|
||||||
$this->print_preview(false, true);
|
|
||||||
break;
|
|
||||||
case self::LAYOUT_PREVIEWCAPTIONTDM:
|
|
||||||
$this->print_preview(true, true);
|
|
||||||
break;
|
|
||||||
case self::LAYOUT_THUMBNAILLIST:
|
|
||||||
$this->print_thumbnailList();
|
|
||||||
break;
|
|
||||||
case self::LAYOUT_THUMBNAILGRID:
|
|
||||||
$this->print_thumbnailGrid();
|
|
||||||
break;
|
|
||||||
case self::LAYOUT_CAPTION:
|
|
||||||
$this->print_caption();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
@@ -123,447 +47,4 @@ class PDF
|
|||||||
|
|
||||||
return $this->pdf->Output('', 'S');
|
return $this->pdf->Output('', 'S');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function print_thumbnailGrid($links = false)
|
|
||||||
{
|
|
||||||
$NDiapoW = 3;
|
|
||||||
$NDiapoH = 4;
|
|
||||||
|
|
||||||
$this->pdf->AddPage();
|
|
||||||
|
|
||||||
$oldMargins = $this->pdf->getMargins();
|
|
||||||
$tmargin = $oldMargins['top'];
|
|
||||||
$lmargin = $oldMargins['left'];
|
|
||||||
$bmargin = $oldMargins['bottom'];
|
|
||||||
$rmargin = $oldMargins['right'];
|
|
||||||
|
|
||||||
$this->pdf->SetLeftMargin($lmargin + 55);
|
|
||||||
|
|
||||||
$clientW = $this->pdf->getPageWidth() - $lmargin - $rmargin;
|
|
||||||
$clientH = $this->pdf->getPageHeight() - $tmargin - $bmargin;
|
|
||||||
|
|
||||||
$DiapoW = floor($clientW / $NDiapoW);
|
|
||||||
$DiapoH = floor($clientH / $NDiapoH);
|
|
||||||
$TitleH = 5;
|
|
||||||
$ImgSize = min($DiapoW, ($DiapoH - $TitleH)) - 5;
|
|
||||||
|
|
||||||
$npages = ceil(count($this->records) / ($NDiapoW * $NDiapoH));
|
|
||||||
|
|
||||||
$irow = $ipage = 0;
|
|
||||||
$icol = -1;
|
|
||||||
foreach ($this->records as $rec) {
|
|
||||||
/* @var \record_adapter $rec */
|
|
||||||
if (++$icol >= $NDiapoW) {
|
|
||||||
$icol = 0;
|
|
||||||
if (++$irow >= $NDiapoH) {
|
|
||||||
$irow = 0;
|
|
||||||
$ipage++;
|
|
||||||
$this->pdf->AddPage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$fimg = null;
|
|
||||||
$himg = 0;
|
|
||||||
|
|
||||||
$subdef = $rec->get_subdef('preview');
|
|
||||||
|
|
||||||
if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) {
|
|
||||||
$subdef = $rec->get_thumbnail();
|
|
||||||
}
|
|
||||||
|
|
||||||
$fimg = $subdef->getRealPath();
|
|
||||||
|
|
||||||
if (!$this->app->getAclForUser($this->app->getAuthenticatedUser())->has_right_on_base($rec->getBaseId(), \ACL::NOWATERMARK)
|
|
||||||
&& $subdef->get_type() == \media_subdef::TYPE_IMAGE) {
|
|
||||||
$fimg = \recordutils_image::watermark($this->app, $subdef);
|
|
||||||
}
|
|
||||||
|
|
||||||
$wimg = $himg = $ImgSize;
|
|
||||||
if ($subdef->get_height() > 0 && $subdef->get_width() > 0) {
|
|
||||||
if ($subdef->get_width() > $subdef->get_height())
|
|
||||||
$himg = $wimg * $subdef->get_height() / $subdef->get_width();
|
|
||||||
else
|
|
||||||
$wimg = $himg * $subdef->get_width() / $subdef->get_height();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($fimg) {
|
|
||||||
$x = $lmargin + ($icol * $DiapoW);
|
|
||||||
$y = $tmargin + ($irow * $DiapoH);
|
|
||||||
$this->pdf->SetDrawColor(0);
|
|
||||||
$this->pdf->Rect($x, $y, $DiapoW, $DiapoH, "D");
|
|
||||||
|
|
||||||
$this->pdf->SetXY($x, $y + 1);
|
|
||||||
$this->pdf->SetFont(PhraseaPDF::FONT, '', 10);
|
|
||||||
$t = $irow . '-' . $x;
|
|
||||||
$t = $rec->get_title();
|
|
||||||
|
|
||||||
if ($links) {
|
|
||||||
$lk = $this->pdf->AddLink();
|
|
||||||
$this->pdf->SetLink($lk, 0, $npages + $rec->getNumber());
|
|
||||||
$this->pdf->Image(
|
|
||||||
$fimg
|
|
||||||
, $x + (($DiapoW - $wimg) / 2)
|
|
||||||
, $TitleH + $y + (($DiapoH - $TitleH - $himg) / 2)
|
|
||||||
, $wimg, $himg
|
|
||||||
, null, $lk
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$this->pdf->Image($fimg
|
|
||||||
, $x + (($DiapoW - $wimg) / 2)
|
|
||||||
, $TitleH + $y + (($DiapoH - $TitleH - $himg) / 2)
|
|
||||||
, $wimg, $himg
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->pdf->MultiCell($DiapoW, $TitleH, $t, '0', 'C', false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->pdf->SetLeftMargin($oldMargins['left']);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function print_thumbnailList()
|
|
||||||
{
|
|
||||||
$this->pdf->AddPage();
|
|
||||||
$oldMargins = $this->pdf->getMargins();
|
|
||||||
|
|
||||||
$lmargin = $oldMargins['left'];
|
|
||||||
$rmargin = $oldMargins['right'];
|
|
||||||
|
|
||||||
$this->pdf->SetLeftMargin($lmargin + 55);
|
|
||||||
|
|
||||||
$ndoc = 0;
|
|
||||||
foreach ($this->records as $rec) {
|
|
||||||
/* @var \record_adapter $rec */
|
|
||||||
$subdef = $rec->get_subdef('thumbnail');
|
|
||||||
|
|
||||||
$fimg = $subdef->getRealPath();
|
|
||||||
|
|
||||||
$wimg = $himg = 50;
|
|
||||||
// 1px = 3.77952 mm
|
|
||||||
$finalWidth = round($subdef->get_width() / 3.779528, 2);
|
|
||||||
$finalHeight = round($subdef->get_height() / 3.779528, 2);
|
|
||||||
$aspectH = $finalWidth/$finalHeight;
|
|
||||||
$aspectW = $finalHeight/$finalWidth;
|
|
||||||
|
|
||||||
if ($finalWidth > 0 && $finalHeight > 0) {
|
|
||||||
if ($finalWidth > $finalHeight && $finalWidth > $wimg) {
|
|
||||||
$finalWidth = $wimg;
|
|
||||||
$finalHeight = $wimg * $aspectW;
|
|
||||||
} else if ($finalHeight > $finalWidth && $finalHeight > $himg) {
|
|
||||||
$finalHeight = $himg;
|
|
||||||
$finalWidth = $himg * $aspectH;
|
|
||||||
} else if ($finalHeight == $finalWidth & $finalWidth > $wimg) {
|
|
||||||
$finalHeight = $wimg;
|
|
||||||
$finalWidth = $himg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->pdf->GetY() > $this->pdf->getPageHeight() - (6 + $finalHeight + 20))
|
|
||||||
$this->pdf->AddPage();
|
|
||||||
|
|
||||||
$title = "record : " . $rec->get_title();
|
|
||||||
|
|
||||||
$y = $this->pdf->GetY();
|
|
||||||
|
|
||||||
$t = \phrasea::bas_labels($rec->getBaseId(), $this->app);
|
|
||||||
$this->pdf->SetFont(PhraseaPDF::FONT, '', 10);
|
|
||||||
$this->pdf->SetFillColor(220, 220, 220);
|
|
||||||
$this->pdf->SetLeftMargin($lmargin);
|
|
||||||
$this->pdf->SetRightMargin($rmargin);
|
|
||||||
$this->pdf->SetX($lmargin);
|
|
||||||
$this->pdf->SetY($y);
|
|
||||||
|
|
||||||
$this->pdf->out = false;
|
|
||||||
$this->pdf->MultiCell(140, 4, $title, "LTR", "L", 1);
|
|
||||||
$y2 = $this->pdf->GetY();
|
|
||||||
$h = $y2 - $y;
|
|
||||||
$this->pdf->out = true;
|
|
||||||
$this->pdf->SetX($lmargin);
|
|
||||||
$this->pdf->SetY($y);
|
|
||||||
$this->pdf->Cell(0, $h, "", "LTR", 1, "R", 1);
|
|
||||||
$this->pdf->SetX($lmargin);
|
|
||||||
$this->pdf->SetY($y);
|
|
||||||
$this->pdf->Cell(0, 4, $t, "", 1, "R");
|
|
||||||
$this->pdf->SetX($lmargin);
|
|
||||||
$this->pdf->SetY($y);
|
|
||||||
$this->pdf->MultiCell(140, 4, $title, "", "L");
|
|
||||||
$this->pdf->SetX($lmargin);
|
|
||||||
$this->pdf->SetY($y = $y2);
|
|
||||||
|
|
||||||
$this->pdf->SetLeftMargin($lmargin + 55);
|
|
||||||
$this->pdf->SetY($y + 2);
|
|
||||||
|
|
||||||
if ($fimg) {
|
|
||||||
$y = $this->pdf->GetY();
|
|
||||||
$this->pdf->Image($fimg, $lmargin, $y, $finalWidth, $finalHeight);
|
|
||||||
$this->pdf->SetY($y + 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
$nf = 0;
|
|
||||||
$this->pdf->SetX($lmargin + 55);
|
|
||||||
$p0 = $this->pdf->PageNo();
|
|
||||||
$y0 = $this->pdf->GetY();
|
|
||||||
foreach ($rec->get_caption()->get_fields() as $field) {
|
|
||||||
/* @var $field caption_field */
|
|
||||||
|
|
||||||
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
|
|
||||||
$this->pdf->Write(5, $field->get_name() . " : ");
|
|
||||||
|
|
||||||
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
|
||||||
$this->pdf->Write(5, $field->get_serialized_values());
|
|
||||||
|
|
||||||
$this->pdf->Write(6, "\n");
|
|
||||||
$nf++;
|
|
||||||
}
|
|
||||||
if ($this->pdf->PageNo() == $p0 && ($this->pdf->GetY() - $y0) < $finalHeight)
|
|
||||||
$this->pdf->SetY($y0 + $finalHeight);
|
|
||||||
$ndoc++;
|
|
||||||
}
|
|
||||||
$this->pdf->SetLeftMargin($lmargin);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function print_caption()
|
|
||||||
{
|
|
||||||
$this->pdf->AddPage();
|
|
||||||
$oldMargins = $this->pdf->getMargins();
|
|
||||||
|
|
||||||
$lmargin = $oldMargins['left'];
|
|
||||||
$rmargin = $oldMargins['right'];
|
|
||||||
|
|
||||||
foreach ($this->records as $rec) {
|
|
||||||
$title = "record : " . $rec->get_title();
|
|
||||||
|
|
||||||
$y = $this->pdf->GetY();
|
|
||||||
if($this->pdf->getPageHeight() - $y < 20){ // height of the footer is 15
|
|
||||||
$this->pdf->AddPage();
|
|
||||||
$y = $oldMargins['top'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$t = \phrasea::bas_labels($rec->getBaseId(), $this->app);
|
|
||||||
$this->pdf->SetFont(PhraseaPDF::FONT, '', 10);
|
|
||||||
$this->pdf->SetFillColor(220, 220, 220);
|
|
||||||
$this->pdf->SetLeftMargin($lmargin);
|
|
||||||
$this->pdf->SetRightMargin($rmargin);
|
|
||||||
$this->pdf->SetX($lmargin);
|
|
||||||
$this->pdf->SetY($y);
|
|
||||||
|
|
||||||
$this->pdf->out = false;
|
|
||||||
$this->pdf->MultiCell(140, 4, $title, "LTR", "L", 1);
|
|
||||||
$y2 = $this->pdf->GetY();
|
|
||||||
$h = $y2 - $y;
|
|
||||||
$this->pdf->out = true;
|
|
||||||
$this->pdf->SetX($lmargin);
|
|
||||||
$this->pdf->SetY($y);
|
|
||||||
$this->pdf->Cell(0, $h, "", "LTR", 1, "R", 1);
|
|
||||||
$this->pdf->SetX($lmargin);
|
|
||||||
$this->pdf->SetY($y);
|
|
||||||
$this->pdf->Cell(0, 4, $t, "", 1, "R");
|
|
||||||
$this->pdf->SetX($lmargin);
|
|
||||||
$this->pdf->SetY($y);
|
|
||||||
$this->pdf->MultiCell(140, 4, $title, "", "L");
|
|
||||||
$this->pdf->SetX($lmargin);
|
|
||||||
$this->pdf->SetY($y = $y2);
|
|
||||||
$this->pdf->SetY($y + 2);
|
|
||||||
|
|
||||||
foreach ($rec->get_caption()->get_fields() as $field) {
|
|
||||||
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
|
|
||||||
$this->pdf->Write(5, $field->get_name() . " : ");
|
|
||||||
|
|
||||||
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
|
||||||
$t = str_replace(
|
|
||||||
["<", ">", "&"]
|
|
||||||
, ["<", ">", "&"]
|
|
||||||
, strip_tags($field->get_serialized_values())
|
|
||||||
);
|
|
||||||
$this->pdf->Write(5, $t);
|
|
||||||
|
|
||||||
$this->pdf->Write(6, "\n");
|
|
||||||
}
|
|
||||||
$this->pdf->SetY($this->pdf->GetY() + 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function print_preview($withtdm, $write_caption)
|
|
||||||
{
|
|
||||||
if ($withtdm === true) {
|
|
||||||
$this->print_thumbnailGrid($this->pdf, $this->records, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->records as $krec => $rec) {
|
|
||||||
/* @var \record_adapter $rec */
|
|
||||||
|
|
||||||
$this->pdf->AddPage();
|
|
||||||
|
|
||||||
if ($withtdm === "CALCPAGES") {
|
|
||||||
$rec->setNumber($this->pdf->PageNo());
|
|
||||||
}
|
|
||||||
$lmargin = $this->pdf->GetX();
|
|
||||||
$himg = 0;
|
|
||||||
$y = 0;
|
|
||||||
$miniConv = NULL;
|
|
||||||
|
|
||||||
$LEFT__TEXT = "";
|
|
||||||
$LEFT__IMG = NULL;
|
|
||||||
$RIGHT_TEXT = "";
|
|
||||||
$RIGHT_IMG = NULL;
|
|
||||||
|
|
||||||
$LEFT__IMG = $this->app['root.path'] . "/config/minilogos/logopdf_" . $rec->getDataboxId() . ".jpg";
|
|
||||||
|
|
||||||
if (!is_file($LEFT__IMG)) {
|
|
||||||
$databox = $rec->getDatabox();
|
|
||||||
$str = $databox->get_sxml_structure();
|
|
||||||
$vn = (string) ($str->pdfPrintLogo);
|
|
||||||
if (($vn * 1) == 1) {
|
|
||||||
$LEFT__TEXT = $databox->get_label($this->app['locale']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$collection = \collection::getByBaseId($this->app, $rec->getBaseId());
|
|
||||||
|
|
||||||
$vn = "";
|
|
||||||
if (false !== $str = simplexml_load_string($collection->get_prefs())) {
|
|
||||||
$vn = (string) ($str->pdfPrintappear);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($vn == "" || $vn == "1") {
|
|
||||||
$RIGHT_TEXT = \phrasea::bas_labels($rec->getBaseId(), $this->app);
|
|
||||||
} elseif ($vn == "2") {
|
|
||||||
$RIGHT_IMG = $this->app['root.path'] . "/config/minilogos/" . $rec->getBaseId();
|
|
||||||
}
|
|
||||||
|
|
||||||
$xtmp = $this->pdf->GetX();
|
|
||||||
$ytmp = $this->pdf->GetY();
|
|
||||||
|
|
||||||
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
|
||||||
$this->pdf->SetFillColor(220, 220, 220);
|
|
||||||
$y = $this->pdf->GetY();
|
|
||||||
$this->pdf->MultiCell(95, 7, $LEFT__TEXT, "LTB", "L", 1);
|
|
||||||
$y2 = $this->pdf->GetY();
|
|
||||||
$h = $y2 - $y;
|
|
||||||
$this->pdf->SetY($y);
|
|
||||||
$this->pdf->SetX(105);
|
|
||||||
$this->pdf->Cell(95, $h, $RIGHT_TEXT, "TBR", 1, "R", 1);
|
|
||||||
|
|
||||||
if ($LEFT__TEXT == "" && is_file($LEFT__IMG)) {
|
|
||||||
if ($size = @getimagesize($LEFT__IMG)) {
|
|
||||||
$wmm = (int) $size[0] * 25.4 / 72;
|
|
||||||
$hmm = (int) $size[1] * 25.4 / 72;
|
|
||||||
if ($hmm > 6) {
|
|
||||||
$coeff = $hmm / 6;
|
|
||||||
$wmm = (int) $wmm / $coeff;
|
|
||||||
$hmm = (int) $hmm / $coeff;
|
|
||||||
}
|
|
||||||
$this->pdf->Image($LEFT__IMG, $xtmp + 0.5, $ytmp + 0.5, $wmm, $hmm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($RIGHT_IMG != NULL && is_file($RIGHT_IMG)) {
|
|
||||||
if ($size = @getimagesize($RIGHT_IMG)) {
|
|
||||||
|
|
||||||
if ($size[2] == '1') {
|
|
||||||
if (!isset($miniConv[$RIGHT_IMG])) {
|
|
||||||
$tmp_filename = tempnam('minilogos/', 'gif4fpdf');
|
|
||||||
$img = imagecreatefromgif($RIGHT_IMG);
|
|
||||||
imageinterlace($img, 0);
|
|
||||||
imagepng($img, $tmp_filename);
|
|
||||||
rename($tmp_filename, $tmp_filename . '.png');
|
|
||||||
$miniConv[$RIGHT_IMG] = $tmp_filename . '.png';
|
|
||||||
$RIGHT_IMG = $tmp_filename . '.png';
|
|
||||||
} else
|
|
||||||
$RIGHT_IMG = $miniConv[$RIGHT_IMG];
|
|
||||||
|
|
||||||
$wmm = (int) $size[0] * 25.4 / 72;
|
|
||||||
$hmm = (int) $size[1] * 25.4 / 72;
|
|
||||||
if ($hmm > 6) {
|
|
||||||
$coeff = $hmm / 6;
|
|
||||||
$wmm = (int) $wmm / $coeff;
|
|
||||||
$hmm = (int) $hmm / $coeff;
|
|
||||||
}
|
|
||||||
$tt = 0;
|
|
||||||
if ($hmm < 6)
|
|
||||||
$tt = (6 - $hmm) / 2;
|
|
||||||
$this->pdf->Image($RIGHT_IMG, 200 - 0.5 - $wmm, $ytmp + 0.5 + $tt);
|
|
||||||
} else {
|
|
||||||
$wmm = (int) $size[0] * 25.4 / 72;
|
|
||||||
$hmm = (int) $size[1] * 25.4 / 72;
|
|
||||||
if ($hmm > 6) {
|
|
||||||
$coeff = $hmm / 6;
|
|
||||||
$wmm = (int) $wmm / $coeff;
|
|
||||||
$hmm = (int) $hmm / $coeff;
|
|
||||||
}
|
|
||||||
$this->pdf->Image($RIGHT_IMG, 200 - 0.5 - $wmm, $ytmp + 0.5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$y = $this->pdf->GetY() + 5;
|
|
||||||
|
|
||||||
$subdef = $rec->get_subdef('preview');
|
|
||||||
|
|
||||||
if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) {
|
|
||||||
$subdef = $rec->get_thumbnail();
|
|
||||||
}
|
|
||||||
|
|
||||||
$f = $subdef->getRealPath();
|
|
||||||
|
|
||||||
if (!$this->app->getAclForUser($this->app->getAuthenticatedUser())->has_right_on_base($rec->getBaseId(), \ACL::NOWATERMARK)
|
|
||||||
&& $subdef->get_type() == \media_subdef::TYPE_IMAGE)
|
|
||||||
$f = \recordutils_image::watermark($this->app, $subdef);
|
|
||||||
|
|
||||||
// original height / original width x new width = new height
|
|
||||||
$wimg = $himg = 150; // preview dans un carre de 150 mm
|
|
||||||
// 1px = 3.77952 mm
|
|
||||||
$finalWidth = round($subdef->get_width() / 3.779528, 2);
|
|
||||||
$finalHeight = round($subdef->get_height() / 3.779528, 2);
|
|
||||||
$aspectH = $finalWidth/$finalHeight;
|
|
||||||
$aspectW = $finalHeight/$finalWidth;
|
|
||||||
|
|
||||||
if ($finalWidth > 0 && $finalHeight > 0) {
|
|
||||||
if ($finalWidth > $finalHeight && $finalWidth > $wimg) {
|
|
||||||
$finalWidth = $wimg;
|
|
||||||
$finalHeight = $wimg * $aspectW;
|
|
||||||
} else if ($finalHeight > $finalWidth && $finalHeight > $himg) {
|
|
||||||
$finalHeight = $himg;
|
|
||||||
$finalWidth = $himg * $aspectH;
|
|
||||||
} else if ($finalHeight == $finalWidth & $finalWidth > $wimg) {
|
|
||||||
$finalHeight = $wimg;
|
|
||||||
$finalWidth = $himg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->pdf->Image($f, (210 - $finalWidth) / 2, $y, $finalWidth, $finalHeight);
|
|
||||||
|
|
||||||
if ($miniConv != NULL) {
|
|
||||||
foreach ($miniConv as $oneF)
|
|
||||||
unlink($oneF);
|
|
||||||
}
|
|
||||||
$this->pdf->SetXY($lmargin, $y += ( $finalHeight + 5));
|
|
||||||
|
|
||||||
$nf = 0;
|
|
||||||
if ($write_caption) {
|
|
||||||
foreach ($rec->get_caption()->get_fields() as $field) {
|
|
||||||
/* @var $field caption_field */
|
|
||||||
if ($nf > 0) {
|
|
||||||
$this->pdf->Write(6, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
|
|
||||||
$this->pdf->Write(5, $field->get_name() . " : ");
|
|
||||||
|
|
||||||
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
|
||||||
|
|
||||||
$t = str_replace(
|
|
||||||
["<", ">", "&"]
|
|
||||||
, ["<", ">", "&"]
|
|
||||||
, strip_tags($field->get_serialized_values())
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->pdf->Write(5, $t);
|
|
||||||
|
|
||||||
$nf++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
675
lib/Alchemy/Phrasea/Out/Module/PDFRecords.php
Normal file
675
lib/Alchemy/Phrasea/Out/Module/PDFRecords.php
Normal file
@@ -0,0 +1,675 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2016 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Out\Module;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Application;
|
||||||
|
use Alchemy\Phrasea\Out\Tool\PhraseaPDF;
|
||||||
|
use Alchemy\Phrasea\Helper\Record\Printer;
|
||||||
|
use Alchemy\Phrasea\Model\Entities\ValidationParticipant;
|
||||||
|
|
||||||
|
class PDFRecords extends PDF
|
||||||
|
{
|
||||||
|
/** @var Printer */
|
||||||
|
private $printer;
|
||||||
|
|
||||||
|
public function __construct(Application $app, Printer $printer, $layout)
|
||||||
|
{
|
||||||
|
parent::__construct($app);
|
||||||
|
$this->printer = $printer;
|
||||||
|
|
||||||
|
$records = $printer->get_elements();
|
||||||
|
|
||||||
|
$list = [];
|
||||||
|
|
||||||
|
foreach ($records as $record) {
|
||||||
|
switch ($layout) {
|
||||||
|
default:
|
||||||
|
throw new \Exception('Unknown layout');
|
||||||
|
break;
|
||||||
|
case self::LAYOUT_FEEDBACK:
|
||||||
|
case self::LAYOUT_PREVIEW:
|
||||||
|
case self::LAYOUT_PREVIEWCAPTION:
|
||||||
|
case self::LAYOUT_PREVIEWCAPTIONTDM:
|
||||||
|
try {
|
||||||
|
$subdef = $record->get_subdef('preview');
|
||||||
|
// fallback to thumbnail ( video, sound, doc ) ..
|
||||||
|
if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) {
|
||||||
|
$subdef = $record->get_thumbnail();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$subdef->is_physically_present()) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case self::LAYOUT_THUMBNAILLIST:
|
||||||
|
case self::LAYOUT_THUMBNAILGRID:
|
||||||
|
try {
|
||||||
|
$subdef = $record->get_thumbnail();
|
||||||
|
if (!$subdef->is_physically_present()) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case self::LAYOUT_CAPTION:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$record->setNumber(count($list) + 1);
|
||||||
|
|
||||||
|
$list[] = $record;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->records = $list;
|
||||||
|
|
||||||
|
switch ($layout) {
|
||||||
|
case self::LAYOUT_FEEDBACK:
|
||||||
|
$this->print_preview(false, true, true);
|
||||||
|
break;
|
||||||
|
case self::LAYOUT_PREVIEW:
|
||||||
|
$this->print_preview(false, false, false);
|
||||||
|
break;
|
||||||
|
case self::LAYOUT_PREVIEWCAPTION:
|
||||||
|
$this->print_preview(false, true, false);
|
||||||
|
break;
|
||||||
|
case self::LAYOUT_PREVIEWCAPTIONTDM:
|
||||||
|
$this->print_preview(true, true, false);
|
||||||
|
break;
|
||||||
|
case self::LAYOUT_THUMBNAILLIST:
|
||||||
|
$this->print_thumbnailList();
|
||||||
|
break;
|
||||||
|
case self::LAYOUT_THUMBNAILGRID:
|
||||||
|
$this->print_thumbnailGrid();
|
||||||
|
break;
|
||||||
|
case self::LAYOUT_CAPTION:
|
||||||
|
$this->print_caption();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function print_thumbnailGrid($links = false)
|
||||||
|
{
|
||||||
|
$NDiapoW = 3;
|
||||||
|
$NDiapoH = 4;
|
||||||
|
|
||||||
|
$this->pdf->AddPage();
|
||||||
|
|
||||||
|
$oldMargins = $this->pdf->getMargins();
|
||||||
|
$tmargin = $oldMargins['top'];
|
||||||
|
$lmargin = $oldMargins['left'];
|
||||||
|
$bmargin = $oldMargins['bottom'];
|
||||||
|
$rmargin = $oldMargins['right'];
|
||||||
|
|
||||||
|
$this->pdf->SetLeftMargin($lmargin + 55);
|
||||||
|
|
||||||
|
$clientW = $this->pdf->getPageWidth() - $lmargin - $rmargin;
|
||||||
|
$clientH = $this->pdf->getPageHeight() - $tmargin - $bmargin;
|
||||||
|
|
||||||
|
$DiapoW = floor($clientW / $NDiapoW);
|
||||||
|
$DiapoH = floor($clientH / $NDiapoH);
|
||||||
|
$TitleH = 5;
|
||||||
|
$ImgSize = min($DiapoW, ($DiapoH - $TitleH)) - 5;
|
||||||
|
|
||||||
|
$npages = ceil(count($this->records) / ($NDiapoW * $NDiapoH));
|
||||||
|
|
||||||
|
$irow = $ipage = 0;
|
||||||
|
$icol = -1;
|
||||||
|
foreach ($this->records as $rec) {
|
||||||
|
/* @var \record_adapter $rec */
|
||||||
|
if (++$icol >= $NDiapoW) {
|
||||||
|
$icol = 0;
|
||||||
|
if (++$irow >= $NDiapoH) {
|
||||||
|
$irow = 0;
|
||||||
|
$ipage++;
|
||||||
|
$this->pdf->AddPage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$fimg = null;
|
||||||
|
$himg = 0;
|
||||||
|
|
||||||
|
$subdef = $rec->get_subdef('preview');
|
||||||
|
|
||||||
|
if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) {
|
||||||
|
$subdef = $rec->get_thumbnail();
|
||||||
|
}
|
||||||
|
|
||||||
|
$fimg = $subdef->getRealPath();
|
||||||
|
|
||||||
|
if (!$this->app->getAclForUser($this->app->getAuthenticatedUser())->has_right_on_base($rec->getBaseId(), \ACL::NOWATERMARK)
|
||||||
|
&& $subdef->get_type() == \media_subdef::TYPE_IMAGE) {
|
||||||
|
$fimg = \recordutils_image::watermark($this->app, $subdef);
|
||||||
|
}
|
||||||
|
|
||||||
|
$wimg = $himg = $ImgSize;
|
||||||
|
if ($subdef->get_height() > 0 && $subdef->get_width() > 0) {
|
||||||
|
if ($subdef->get_width() > $subdef->get_height())
|
||||||
|
$himg = $wimg * $subdef->get_height() / $subdef->get_width();
|
||||||
|
else
|
||||||
|
$wimg = $himg * $subdef->get_width() / $subdef->get_height();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($fimg) {
|
||||||
|
$x = $lmargin + ($icol * $DiapoW);
|
||||||
|
$y = $tmargin + ($irow * $DiapoH);
|
||||||
|
$this->pdf->SetDrawColor(0);
|
||||||
|
$this->pdf->Rect($x, $y, $DiapoW, $DiapoH, "D");
|
||||||
|
|
||||||
|
$this->pdf->SetXY($x, $y + 1);
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 10);
|
||||||
|
$t = $irow . '-' . $x;
|
||||||
|
$t = $rec->get_title();
|
||||||
|
|
||||||
|
if ($links) {
|
||||||
|
$lk = $this->pdf->AddLink();
|
||||||
|
$this->pdf->SetLink($lk, 0, $npages + $rec->getNumber());
|
||||||
|
$this->pdf->Image(
|
||||||
|
$fimg
|
||||||
|
, $x + (($DiapoW - $wimg) / 2)
|
||||||
|
, $TitleH + $y + (($DiapoH - $TitleH - $himg) / 2)
|
||||||
|
, $wimg, $himg
|
||||||
|
, null, $lk
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->pdf->Image($fimg
|
||||||
|
, $x + (($DiapoW - $wimg) / 2)
|
||||||
|
, $TitleH + $y + (($DiapoH - $TitleH - $himg) / 2)
|
||||||
|
, $wimg, $himg
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->pdf->MultiCell($DiapoW, $TitleH, $t, '0', 'C', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->pdf->SetLeftMargin($oldMargins['left']);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function print_thumbnailList()
|
||||||
|
{
|
||||||
|
$this->pdf->AddPage();
|
||||||
|
$oldMargins = $this->pdf->getMargins();
|
||||||
|
|
||||||
|
$lmargin = $oldMargins['left'];
|
||||||
|
$rmargin = $oldMargins['right'];
|
||||||
|
|
||||||
|
$this->pdf->SetLeftMargin($lmargin + 55);
|
||||||
|
|
||||||
|
$ndoc = 0;
|
||||||
|
foreach ($this->records as $rec) {
|
||||||
|
/* @var \record_adapter $rec */
|
||||||
|
$subdef = $rec->get_subdef('thumbnail');
|
||||||
|
|
||||||
|
$fimg = $subdef->getRealPath();
|
||||||
|
|
||||||
|
$wimg = $himg = 50;
|
||||||
|
// 1px = 3.77952 mm
|
||||||
|
$finalWidth = round($subdef->get_width() / 3.779528, 2);
|
||||||
|
$finalHeight = round($subdef->get_height() / 3.779528, 2);
|
||||||
|
$aspectH = $finalWidth/$finalHeight;
|
||||||
|
$aspectW = $finalHeight/$finalWidth;
|
||||||
|
|
||||||
|
if ($finalWidth > 0 && $finalHeight > 0) {
|
||||||
|
if ($finalWidth > $finalHeight && $finalWidth > $wimg) {
|
||||||
|
$finalWidth = $wimg;
|
||||||
|
$finalHeight = $wimg * $aspectW;
|
||||||
|
} else if ($finalHeight > $finalWidth && $finalHeight > $himg) {
|
||||||
|
$finalHeight = $himg;
|
||||||
|
$finalWidth = $himg * $aspectH;
|
||||||
|
} else if ($finalHeight == $finalWidth & $finalWidth > $wimg) {
|
||||||
|
$finalHeight = $wimg;
|
||||||
|
$finalWidth = $himg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->pdf->GetY() > $this->pdf->getPageHeight() - (6 + $finalHeight + 20))
|
||||||
|
$this->pdf->AddPage();
|
||||||
|
|
||||||
|
$title = "record : " . $rec->get_title();
|
||||||
|
|
||||||
|
$y = $this->pdf->GetY();
|
||||||
|
|
||||||
|
$t = \phrasea::bas_labels($rec->getBaseId(), $this->app);
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 10);
|
||||||
|
$this->pdf->SetFillColor(220, 220, 220);
|
||||||
|
$this->pdf->SetLeftMargin($lmargin);
|
||||||
|
$this->pdf->SetRightMargin($rmargin);
|
||||||
|
$this->pdf->SetX($lmargin);
|
||||||
|
$this->pdf->SetY($y);
|
||||||
|
|
||||||
|
$this->pdf->out = false;
|
||||||
|
$this->pdf->MultiCell(140, 4, $title, "LTR", "L", 1);
|
||||||
|
$y2 = $this->pdf->GetY();
|
||||||
|
$h = $y2 - $y;
|
||||||
|
$this->pdf->out = true;
|
||||||
|
$this->pdf->SetX($lmargin);
|
||||||
|
$this->pdf->SetY($y);
|
||||||
|
$this->pdf->Cell(0, $h, "", "LTR", 1, "R", 1);
|
||||||
|
$this->pdf->SetX($lmargin);
|
||||||
|
$this->pdf->SetY($y);
|
||||||
|
$this->pdf->Cell(0, 4, $t, "", 1, "R");
|
||||||
|
$this->pdf->SetX($lmargin);
|
||||||
|
$this->pdf->SetY($y);
|
||||||
|
$this->pdf->MultiCell(140, 4, $title, "", "L");
|
||||||
|
$this->pdf->SetX($lmargin);
|
||||||
|
$this->pdf->SetY($y = $y2);
|
||||||
|
|
||||||
|
$this->pdf->SetLeftMargin($lmargin + 55);
|
||||||
|
$this->pdf->SetY($y + 2);
|
||||||
|
|
||||||
|
if ($fimg) {
|
||||||
|
$y = $this->pdf->GetY();
|
||||||
|
$this->pdf->Image($fimg, $lmargin, $y, $finalWidth, $finalHeight);
|
||||||
|
$this->pdf->SetY($y + 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
$nf = 0;
|
||||||
|
$this->pdf->SetX($lmargin + 55);
|
||||||
|
$p0 = $this->pdf->PageNo();
|
||||||
|
$y0 = $this->pdf->GetY();
|
||||||
|
foreach ($rec->get_caption()->get_fields() as $field) {
|
||||||
|
/* @var $field caption_field */
|
||||||
|
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
|
||||||
|
$this->pdf->Write(5, $field->get_name() . " : ");
|
||||||
|
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
||||||
|
$this->pdf->Write(5, $field->get_serialized_values());
|
||||||
|
|
||||||
|
$this->pdf->Write(6, "\n");
|
||||||
|
$nf++;
|
||||||
|
}
|
||||||
|
if ($this->pdf->PageNo() == $p0 && ($this->pdf->GetY() - $y0) < $finalHeight)
|
||||||
|
$this->pdf->SetY($y0 + $finalHeight);
|
||||||
|
$ndoc++;
|
||||||
|
}
|
||||||
|
$this->pdf->SetLeftMargin($lmargin);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function print_caption()
|
||||||
|
{
|
||||||
|
$this->pdf->AddPage();
|
||||||
|
$oldMargins = $this->pdf->getMargins();
|
||||||
|
|
||||||
|
$lmargin = $oldMargins['left'];
|
||||||
|
$rmargin = $oldMargins['right'];
|
||||||
|
|
||||||
|
foreach ($this->records as $rec) {
|
||||||
|
$title = "record : " . $rec->get_title();
|
||||||
|
|
||||||
|
$y = $this->pdf->GetY();
|
||||||
|
if($this->pdf->getPageHeight() - $y < 20){ // height of the footer is 15
|
||||||
|
$this->pdf->AddPage();
|
||||||
|
$y = $oldMargins['top'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$t = \phrasea::bas_labels($rec->getBaseId(), $this->app);
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 10);
|
||||||
|
$this->pdf->SetFillColor(220, 220, 220);
|
||||||
|
$this->pdf->SetLeftMargin($lmargin);
|
||||||
|
$this->pdf->SetRightMargin($rmargin);
|
||||||
|
$this->pdf->SetX($lmargin);
|
||||||
|
$this->pdf->SetY($y);
|
||||||
|
|
||||||
|
$this->pdf->out = false;
|
||||||
|
$this->pdf->MultiCell(140, 4, $title, "LTR", "L", 1);
|
||||||
|
$y2 = $this->pdf->GetY();
|
||||||
|
$h = $y2 - $y;
|
||||||
|
$this->pdf->out = true;
|
||||||
|
$this->pdf->SetX($lmargin);
|
||||||
|
$this->pdf->SetY($y);
|
||||||
|
$this->pdf->Cell(0, $h, "", "LTR", 1, "R", 1);
|
||||||
|
$this->pdf->SetX($lmargin);
|
||||||
|
$this->pdf->SetY($y);
|
||||||
|
$this->pdf->Cell(0, 4, $t, "", 1, "R");
|
||||||
|
$this->pdf->SetX($lmargin);
|
||||||
|
$this->pdf->SetY($y);
|
||||||
|
$this->pdf->MultiCell(140, 4, $title, "", "L");
|
||||||
|
$this->pdf->SetX($lmargin);
|
||||||
|
$this->pdf->SetY($y = $y2);
|
||||||
|
$this->pdf->SetY($y + 2);
|
||||||
|
|
||||||
|
foreach ($rec->get_caption()->get_fields() as $field) {
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
|
||||||
|
$this->pdf->Write(5, $field->get_name() . " : ");
|
||||||
|
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
||||||
|
$t = str_replace(
|
||||||
|
["<", ">", "&"]
|
||||||
|
, ["<", ">", "&"]
|
||||||
|
, strip_tags($field->get_serialized_values())
|
||||||
|
);
|
||||||
|
$this->pdf->Write(5, $t);
|
||||||
|
|
||||||
|
$this->pdf->Write(6, "\n");
|
||||||
|
}
|
||||||
|
$this->pdf->SetY($this->pdf->GetY() + 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function print_preview($withtdm, $write_caption, $withfeedback)
|
||||||
|
{
|
||||||
|
$basket = $validation = null;
|
||||||
|
|
||||||
|
if($this->printer->is_basket()) {
|
||||||
|
$basket = $this->printer->get_original_basket();
|
||||||
|
|
||||||
|
if($withfeedback) {
|
||||||
|
// first page : validation informations
|
||||||
|
$validation = $basket->getValidation();
|
||||||
|
|
||||||
|
$this->pdf->AddPage();
|
||||||
|
|
||||||
|
$this->pdf->SetY(20);
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 14);
|
||||||
|
$this->pdf->Cell(0, 0,
|
||||||
|
$this->app->trans("print_feedback:: Feedback on basket %name%", ['%name%'=>$basket->getName()]),
|
||||||
|
'', 1, 'C', false);
|
||||||
|
|
||||||
|
$this->pdf->SetY($this->pdf->GetY()+10);
|
||||||
|
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
|
||||||
|
$this->pdf->Write(5, $this->app->trans("print_feedback:: Document generated on : "));
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
||||||
|
$this->pdf->Write(5, $this->app['date-formatter']->getDate(new \DateTime('now')));
|
||||||
|
$this->pdf->Write(12, "\n");
|
||||||
|
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
|
||||||
|
$this->pdf->Write(5, $this->app->trans("print_feedback:: Feedback initiated by : "));
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
||||||
|
$this->pdf->Write(5, $validation->getInitiator()->getLogin());
|
||||||
|
$this->pdf->Write(6, "\n");
|
||||||
|
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
|
||||||
|
$this->pdf->Write(5, $this->app->trans("print_feedback:: Feedback initiated on : "));
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
||||||
|
$this->pdf->Write(5, $this->app['date-formatter']->getDate($validation->getCreated()));
|
||||||
|
$this->pdf->Write(6, "\n");
|
||||||
|
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
|
||||||
|
$this->pdf->Write(5, $this->app->trans("print_feedback:: Feedback expiring on : "));
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
||||||
|
$this->pdf->Write(5, $this->app['date-formatter']->getDate($validation->getExpires()));
|
||||||
|
$this->pdf->Write(12, "\n");
|
||||||
|
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
|
||||||
|
$this->pdf->Write(5, $this->app->trans("print_feedback:: Feedback " . ($validation->isFinished() ? "expired" : "active")));
|
||||||
|
$this->pdf->Write(12, "\n");
|
||||||
|
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
|
||||||
|
$this->pdf->Write(5, $this->app->trans("print_feedback:: Participants : "));
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
||||||
|
foreach ($validation->getParticipants() as $participant) {
|
||||||
|
$this->pdf->Write(5, "\n - " . $participant->getUser()->getLogin());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($withtdm === true) {
|
||||||
|
$this->print_thumbnailGrid($this->pdf, $this->records, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->records as $krec => $rec) {
|
||||||
|
/* @var \record_adapter $rec */
|
||||||
|
|
||||||
|
$this->pdf->AddPage();
|
||||||
|
|
||||||
|
if ($withtdm === "CALCPAGES") {
|
||||||
|
$rec->setNumber($this->pdf->PageNo());
|
||||||
|
}
|
||||||
|
$lmargin = $this->pdf->GetX();
|
||||||
|
$himg = 0;
|
||||||
|
$y = 0;
|
||||||
|
$miniConv = NULL;
|
||||||
|
|
||||||
|
$LEFT__TEXT = "";
|
||||||
|
$LEFT__IMG = NULL;
|
||||||
|
$RIGHT_TEXT = "";
|
||||||
|
$RIGHT_IMG = NULL;
|
||||||
|
|
||||||
|
$LEFT__IMG = $this->app['root.path'] . "/config/minilogos/logopdf_" . $rec->getDataboxId() . ".jpg";
|
||||||
|
|
||||||
|
if (!is_file($LEFT__IMG)) {
|
||||||
|
$databox = $rec->getDatabox();
|
||||||
|
$str = $databox->get_sxml_structure();
|
||||||
|
$vn = (string) ($str->pdfPrintLogo);
|
||||||
|
if (($vn * 1) == 1) {
|
||||||
|
$LEFT__TEXT = $databox->get_label($this->app['locale']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$collection = \collection::getByBaseId($this->app, $rec->getBaseId());
|
||||||
|
|
||||||
|
$vn = "";
|
||||||
|
if (false !== $str = simplexml_load_string($collection->get_prefs())) {
|
||||||
|
$vn = (string) ($str->pdfPrintappear);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($vn == "" || $vn == "1") {
|
||||||
|
$RIGHT_TEXT = \phrasea::bas_labels($rec->getBaseId(), $this->app);
|
||||||
|
} elseif ($vn == "2") {
|
||||||
|
$RIGHT_IMG = $this->app['root.path'] . "/config/minilogos/" . $rec->getBaseId();
|
||||||
|
}
|
||||||
|
|
||||||
|
$xtmp = $this->pdf->GetX();
|
||||||
|
$ytmp = $this->pdf->GetY();
|
||||||
|
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
||||||
|
$this->pdf->SetFillColor(220, 220, 220);
|
||||||
|
$y = $this->pdf->GetY();
|
||||||
|
$this->pdf->MultiCell(95, 7, $LEFT__TEXT, "LTB", "L", 1);
|
||||||
|
$y2 = $this->pdf->GetY();
|
||||||
|
$h = $y2 - $y;
|
||||||
|
$this->pdf->SetY($y);
|
||||||
|
$this->pdf->SetX(105);
|
||||||
|
$this->pdf->Cell(95, $h, $RIGHT_TEXT, "TBR", 1, "R", 1);
|
||||||
|
|
||||||
|
if($basket) {
|
||||||
|
$ord = $basket->getElementByRecord($this->app, $rec)->getOrd();
|
||||||
|
$this->pdf->SetY($y);
|
||||||
|
$this->pdf->SetX(10);
|
||||||
|
$this->pdf->Cell(190, $h, '#' . $ord, "", 1, "C", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($LEFT__TEXT == "" && is_file($LEFT__IMG)) {
|
||||||
|
if ($size = @getimagesize($LEFT__IMG)) {
|
||||||
|
$wmm = (int) $size[0] * 25.4 / 72;
|
||||||
|
$hmm = (int) $size[1] * 25.4 / 72;
|
||||||
|
if ($hmm > 6) {
|
||||||
|
$coeff = $hmm / 6;
|
||||||
|
$wmm = (int) $wmm / $coeff;
|
||||||
|
$hmm = (int) $hmm / $coeff;
|
||||||
|
}
|
||||||
|
$this->pdf->Image($LEFT__IMG, $xtmp + 0.5, $ytmp + 0.5, $wmm, $hmm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($RIGHT_IMG != NULL && is_file($RIGHT_IMG)) {
|
||||||
|
if ($size = @getimagesize($RIGHT_IMG)) {
|
||||||
|
|
||||||
|
if ($size[2] == '1') {
|
||||||
|
if (!isset($miniConv[$RIGHT_IMG])) {
|
||||||
|
$tmp_filename = tempnam('minilogos/', 'gif4fpdf');
|
||||||
|
$img = imagecreatefromgif($RIGHT_IMG);
|
||||||
|
imageinterlace($img, 0);
|
||||||
|
imagepng($img, $tmp_filename);
|
||||||
|
rename($tmp_filename, $tmp_filename . '.png');
|
||||||
|
$miniConv[$RIGHT_IMG] = $tmp_filename . '.png';
|
||||||
|
$RIGHT_IMG = $tmp_filename . '.png';
|
||||||
|
} else
|
||||||
|
$RIGHT_IMG = $miniConv[$RIGHT_IMG];
|
||||||
|
|
||||||
|
$wmm = (int) $size[0] * 25.4 / 72;
|
||||||
|
$hmm = (int) $size[1] * 25.4 / 72;
|
||||||
|
if ($hmm > 6) {
|
||||||
|
$coeff = $hmm / 6;
|
||||||
|
$wmm = (int) $wmm / $coeff;
|
||||||
|
$hmm = (int) $hmm / $coeff;
|
||||||
|
}
|
||||||
|
$tt = 0;
|
||||||
|
if ($hmm < 6)
|
||||||
|
$tt = (6 - $hmm) / 2;
|
||||||
|
$this->pdf->Image($RIGHT_IMG, 200 - 0.5 - $wmm, $ytmp + 0.5 + $tt);
|
||||||
|
} else {
|
||||||
|
$wmm = (int) $size[0] * 25.4 / 72;
|
||||||
|
$hmm = (int) $size[1] * 25.4 / 72;
|
||||||
|
if ($hmm > 6) {
|
||||||
|
$coeff = $hmm / 6;
|
||||||
|
$wmm = (int) $wmm / $coeff;
|
||||||
|
$hmm = (int) $hmm / $coeff;
|
||||||
|
}
|
||||||
|
$this->pdf->Image($RIGHT_IMG, 200 - 0.5 - $wmm, $ytmp + 0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$y = $this->pdf->GetY() + 5;
|
||||||
|
|
||||||
|
$subdef = $rec->get_subdef('preview');
|
||||||
|
|
||||||
|
if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) {
|
||||||
|
$subdef = $rec->get_thumbnail();
|
||||||
|
}
|
||||||
|
|
||||||
|
$f = $subdef->getRealPath();
|
||||||
|
|
||||||
|
if (!$this->app->getAclForUser($this->app->getAuthenticatedUser())->has_right_on_base($rec->getBaseId(), \ACL::NOWATERMARK)
|
||||||
|
&& $subdef->get_type() == \media_subdef::TYPE_IMAGE)
|
||||||
|
$f = \recordutils_image::watermark($this->app, $subdef);
|
||||||
|
|
||||||
|
// original height / original width x new width = new height
|
||||||
|
$wimg = $himg = 150; // preview dans un carre de 150 mm
|
||||||
|
// 1px = 3.77952 mm
|
||||||
|
$finalWidth = round($subdef->get_width() / 3.779528, 2);
|
||||||
|
$finalHeight = round($subdef->get_height() / 3.779528, 2);
|
||||||
|
$aspectH = $finalWidth/$finalHeight;
|
||||||
|
$aspectW = $finalHeight/$finalWidth;
|
||||||
|
|
||||||
|
if ($finalWidth > 0 && $finalHeight > 0) {
|
||||||
|
if ($finalWidth > $finalHeight && $finalWidth > $wimg) {
|
||||||
|
$finalWidth = $wimg;
|
||||||
|
$finalHeight = $wimg * $aspectW;
|
||||||
|
} else if ($finalHeight > $finalWidth && $finalHeight > $himg) {
|
||||||
|
$finalHeight = $himg;
|
||||||
|
$finalWidth = $himg * $aspectH;
|
||||||
|
} else if ($finalHeight == $finalWidth & $finalWidth > $wimg) {
|
||||||
|
$finalHeight = $wimg;
|
||||||
|
$finalWidth = $himg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->pdf->Image($f, (210 - $finalWidth) / 2, $y, $finalWidth, $finalHeight);
|
||||||
|
|
||||||
|
if ($miniConv != NULL) {
|
||||||
|
foreach ($miniConv as $oneF)
|
||||||
|
unlink($oneF);
|
||||||
|
}
|
||||||
|
$this->pdf->SetXY($lmargin, $y += ( $finalHeight + 5));
|
||||||
|
|
||||||
|
$nf = 0;
|
||||||
|
if ($write_caption) {
|
||||||
|
foreach ($rec->get_caption()->get_fields() as $field) {
|
||||||
|
/* @var $field caption_field */
|
||||||
|
if ($nf > 0) {
|
||||||
|
$this->pdf->Write(6, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
|
||||||
|
$this->pdf->Write(5, $field->get_name() . " : ");
|
||||||
|
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
||||||
|
|
||||||
|
$t = str_replace(
|
||||||
|
["<", ">", "&"]
|
||||||
|
, ["<", ">", "&"]
|
||||||
|
, strip_tags($field->get_serialized_values())
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->pdf->Write(5, $t);
|
||||||
|
|
||||||
|
$nf++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($basket && $validation) {
|
||||||
|
/** @var ValidationParticipant $participant */
|
||||||
|
|
||||||
|
if ($nf > 0) {
|
||||||
|
$this->pdf->Write(6, "\n");
|
||||||
|
}
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
|
||||||
|
$this->pdf->Write(5, $this->app->trans("print_feedback:: Votes :"));
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
||||||
|
|
||||||
|
$basketElement = $basket->getElementByRecord($this->app, $rec);
|
||||||
|
|
||||||
|
$iparticipant = 0;
|
||||||
|
foreach ($validation->getParticipants() as $participant) {
|
||||||
|
$this->pdf->Write(6, "\n");
|
||||||
|
if($iparticipant++ > 0) {
|
||||||
|
// $this->pdf->SetY($this->pdf->GetY()+1);
|
||||||
|
}
|
||||||
|
$validationData = $basketElement->getUserValidationDatas($participant->getUser());
|
||||||
|
|
||||||
|
$this->pdf->Write(5, '- ' . $participant->getUser()->getLogin() . " : ");
|
||||||
|
|
||||||
|
$r = $validationData->getAgreement();
|
||||||
|
$this->pdf->SetX(100);
|
||||||
|
if ($r === null) {
|
||||||
|
$this->pdf->Write(0, $this->app->trans("print_feedback:: non voté"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if($r) {
|
||||||
|
$this->pdf->SetTextColor(0, 127, 0);
|
||||||
|
$this->pdf->Write(0, $this->app->trans("print_feedback:: Oui"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->pdf->SetTextColor(200, 0, 0);
|
||||||
|
$this->pdf->Write(0, $this->app->trans("print_feedback:: Non"));
|
||||||
|
}
|
||||||
|
$this->pdf->SetTextColor(0);
|
||||||
|
$this->pdf->Write(0, " (" . $this->app['date-formatter']->getDate($validationData->getUpdated()) . ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($note = (string)($validationData->getNote())) !== '') {
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, 'I', 11);
|
||||||
|
$this->pdf->Write(5,"\n");
|
||||||
|
$this->pdf->SetX(100);
|
||||||
|
$this->pdf->MultiCell(95, 0, $note, '', "L", false);
|
||||||
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
$nf++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function formatDate(DateTime $d)
|
||||||
|
{
|
||||||
|
// todo
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -60,7 +60,7 @@ class BinariesRequirements extends RequirementCollection implements RequirementI
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$exiftool = __DIR__ . '/../../../../../vendor/phpexiftool/exiftool/exiftool' . (defined('PHP_WINDOWS_VERSION_BUILD') ? '.exe' : '');
|
$exiftool = __DIR__ . '/../../../../../vendor/exiftool/exiftool/exiftool' . (defined('PHP_WINDOWS_VERSION_BUILD') ? '.exe' : '');
|
||||||
|
|
||||||
$this->addRequirement(
|
$this->addRequirement(
|
||||||
is_file($exiftool) && is_executable($exiftool),
|
is_file($exiftool) && is_executable($exiftool),
|
||||||
|
@@ -65,7 +65,7 @@
|
|||||||
"normalize-css": "^2.1.0",
|
"normalize-css": "^2.1.0",
|
||||||
"npm": "^6.0.0",
|
"npm": "^6.0.0",
|
||||||
"npm-modernizr": "^2.8.3",
|
"npm-modernizr": "^2.8.3",
|
||||||
"phraseanet-production-client": "^0.34.86-d",
|
"phraseanet-production-client": "0.34.102-d",
|
||||||
"requirejs": "^2.3.5",
|
"requirejs": "^2.3.5",
|
||||||
"tinymce": "^4.0.28",
|
"tinymce": "^4.0.28",
|
||||||
"underscore": "^1.8.3",
|
"underscore": "^1.8.3",
|
||||||
|
@@ -66,5 +66,5 @@
|
|||||||
|
|
||||||
- name: Make exiftool executable
|
- name: Make exiftool executable
|
||||||
file:
|
file:
|
||||||
path: /vagrant/vendor/phpexiftool/exiftool/exiftool
|
path: /vagrant/vendor/exiftool/exiftool/exiftool
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
||||||
<file date="2019-11-19T08:48:53Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
|
<file date="2020-01-15T09:38:21Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
|
||||||
<header>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
||||||
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
||||||
<file date="2019-11-19T08:49:17Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
|
<file date="2020-01-15T09:38:50Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
|
||||||
<header>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
||||||
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
||||||
<file date="2019-11-15T08:03:23Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
|
<file date="2020-01-15T09:39:45Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
|
||||||
<header>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
||||||
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
||||||
<file date="2019-11-19T08:50:13Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
|
<file date="2020-01-15T09:40:44Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
|
||||||
<header>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
||||||
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
||||||
|
@@ -319,3 +319,8 @@ a.active_choice {
|
|||||||
color: #313131;
|
color: #313131;
|
||||||
padding: 6px 0 6px 30px;
|
padding: 6px 0 6px 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pdf-iframe {
|
||||||
|
background: #1a1a1a;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
@@ -694,6 +694,9 @@ button.confirm_report {
|
|||||||
iframe {
|
iframe {
|
||||||
min-height: 240px;
|
min-height: 240px;
|
||||||
width: auto;
|
width: auto;
|
||||||
|
.ui-mobile & {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -57,9 +57,13 @@
|
|||||||
{% set url = app.getAuthenticator().isAuthenticated() ? thumbnail.get_url() : thumbnail.get_permalink().get_url() %}
|
{% set url = app.getAuthenticator().isAuthenticated() ? thumbnail.get_url() : thumbnail.get_permalink().get_url() %}
|
||||||
{% set record_type = thumbnail.get_type() %}
|
{% set record_type = thumbnail.get_type() %}
|
||||||
{% if record_type == 'VIDEO_MP4' or record_type == 'VIDEO_FLV' %}
|
{% if record_type == 'VIDEO_MP4' or record_type == 'VIDEO_FLV' %}
|
||||||
|
{% set thumbnail_height = thumbnail.get_height() > 0 ? thumbnail.get_height() : 120 %}
|
||||||
|
{% set thumbnail_width = thumbnail.get_width() > 0 ? thumbnail.get_width() : 120 %}
|
||||||
|
<input type="hidden" class="hidden" id="videoHeight" name="videoHeight" value="{{ thumbnail_height }}"/>
|
||||||
|
<input type="hidden" class="hidden" id="videoWidth" name="videoWidth" value="{{ thumbnail_width }}"/>
|
||||||
<iframe width="100%" height="100%"
|
<iframe width="100%" height="100%"
|
||||||
src="{{ url('alchemy_embed_view', {url: url|trim, autoplay: autoplay|default('false') }) }}"
|
src="{{ url('alchemy_embed_view', {url: url|trim, autoplay: autoplay|default('false') }) }}"
|
||||||
frameborder="0" allowfullscreen></iframe>
|
frameborder="0" allowfullscreen class="video-iframe"></iframe>
|
||||||
{% elseif record_type == 'FLEXPAPER' %}
|
{% elseif record_type == 'FLEXPAPER' %}
|
||||||
<iframe width="100%" height="100%"
|
<iframe width="100%" height="100%"
|
||||||
src="{{ url('alchemy_embed_view', {url: url|trim, autoplay: autoplay|default('false') }) }}"
|
src="{{ url('alchemy_embed_view', {url: url|trim, autoplay: autoplay|default('false') }) }}"
|
||||||
@@ -68,6 +72,8 @@
|
|||||||
<iframe width="100%" height="100%"
|
<iframe width="100%" height="100%"
|
||||||
src="{{ url('alchemy_embed_view', {url: url|trim, autoplay: autoplay|default('false') }) }}"
|
src="{{ url('alchemy_embed_view', {url: url|trim, autoplay: autoplay|default('false') }) }}"
|
||||||
frameborder="0" allowfullscreen></iframe>
|
frameborder="0" allowfullscreen></iframe>
|
||||||
|
{% elseif record_type == 'PDF' %}
|
||||||
|
<iframe src="{{ url('alchemy_embed_view', {url: url|trim }) }}" width="100%" scrolling="no" marginheight="0" frameborder="0" allowfullscreen="" height="0" class="pdf-iframe"></iframe>
|
||||||
{% else %}
|
{% else %}
|
||||||
<img style="max-height: 100%;max-width:100%" class="record record_image imgTips zoomable thumb"
|
<img style="max-height: 100%;max-width:100%" class="record record_image imgTips zoomable thumb"
|
||||||
oncontextMenu="return(false);"
|
oncontextMenu="return(false);"
|
||||||
|
@@ -93,5 +93,4 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -329,6 +329,12 @@
|
|||||||
</div>
|
</div>
|
||||||
{{thumbnail.format(record.get_thumbnail,82,82, '', true, false)}}
|
{{thumbnail.format(record.get_thumbnail,82,82, '', true, false)}}
|
||||||
<div class="bottom">
|
<div class="bottom">
|
||||||
|
{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), 'basket_caption_display') == '1' %}
|
||||||
|
<span class="icon-stack captionRolloverTips captionTips"
|
||||||
|
tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id(), 'context' : 'basket', 'number' : record.getNumber() }) }}">
|
||||||
|
<i class="icomoon icon-round-list-24px white" style="background: #777;border-radius: 2px;padding: 0px 1px;line-height: 1;margin: 0 4px 4px 4px;"></i>
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
<a
|
<a
|
||||||
{% if wz_scope == 'groupings' %}
|
{% if wz_scope == 'groupings' %}
|
||||||
id="WZEL{{ container.get_sbas_id() }}_{{ container.get_record_id() }}_{{ record.get_sbas_id() }}_{{ record.get_record_id() }}"
|
id="WZEL{{ container.get_sbas_id() }}_{{ container.get_record_id() }}_{{ record.get_sbas_id() }}_{{ record.get_record_id() }}"
|
||||||
@@ -342,9 +348,7 @@
|
|||||||
class="WorkZoneElementRemover {{ wz_scope }}" title="{{ 'delete' | trans }}" >
|
class="WorkZoneElementRemover {{ wz_scope }}" title="{{ 'delete' | trans }}" >
|
||||||
<i class="fa fa-times" aria-hidden="true"></i>
|
<i class="fa fa-times" aria-hidden="true"></i>
|
||||||
</a>
|
</a>
|
||||||
{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), 'basket_caption_display') == '1' %}
|
|
||||||
<div class="captionRolloverTips" tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id(), 'context' : 'basket', 'number' : record.getNumber() }) }}"></div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
@@ -115,7 +115,9 @@
|
|||||||
<div class="frame_canva">
|
<div class="frame_canva">
|
||||||
<div id="thumb_delete_button"/>
|
<div id="thumb_delete_button"/>
|
||||||
<div id="thumb_download_button"/>
|
<div id="thumb_download_button"/>
|
||||||
<canvas id="thumb_canvas"></canvas>
|
<div class="canvas-wrap">
|
||||||
|
<canvas id="thumb_canvas"></canvas>
|
||||||
|
</div>
|
||||||
<div id="alt_canvas_container"
|
<div id="alt_canvas_container"
|
||||||
style="position:absolute;overflow:hidden;top:-1200px;visibility: hidden; width:0!important;height:0!important">
|
style="position:absolute;overflow:hidden;top:-1200px;visibility: hidden; width:0!important;height:0!important">
|
||||||
{% for subdef in outputFormats %}
|
{% for subdef in outputFormats %}
|
||||||
|
@@ -2,6 +2,17 @@
|
|||||||
<form target="_blank" name="formprintpage" method="POST" action="{{ path('prod_printer_print') }}">
|
<form target="_blank" name="formprintpage" method="POST" action="{{ path('prod_printer_print') }}">
|
||||||
<div id="printBox">
|
<div id="printBox">
|
||||||
<div style="padding:10px;">
|
<div style="padding:10px;">
|
||||||
|
{% if basketFeedbackId %}
|
||||||
|
<h4>{{ 'phraseanet:: basket feedback' | trans }}</h4>
|
||||||
|
<input type="hidden" name="ssel" value="{{ basketFeedbackId }}" />
|
||||||
|
<div style="margin: 10px 0 20px 0; padding: 0 10px;">
|
||||||
|
<label for="RADI_PRE_BF" class="radio">
|
||||||
|
<input type="radio" name="lay" value="feedback" id="RADI_PRE_BF" />
|
||||||
|
{{ 'print:: basket feedback' | trans }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if printer.get_count_actionable() > 0 %}
|
{% if printer.get_count_actionable() > 0 %}
|
||||||
{% if printer.get_count_preview() > 0 %}
|
{% if printer.get_count_preview() > 0 %}
|
||||||
<h4>{{ 'phraseanet:: preview' | trans }}</h4>
|
<h4>{{ 'phraseanet:: preview' | trans }}</h4>
|
||||||
|
@@ -926,7 +926,7 @@
|
|||||||
{% set basket_status_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'basket_status_display') %}
|
{% set basket_status_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'basket_status_display') %}
|
||||||
<label for="basket_status_display" class="checkbox">
|
<label for="basket_status_display" class="checkbox">
|
||||||
<input
|
<input
|
||||||
name="basket_status_display" type="checkbox preferences-options-basket-status" class="checkbox" value="1"
|
name="basket_status_display" type="checkbox" class="checkbox preferences-options-basket-status" value="1"
|
||||||
id="basket_status_display" {% if basket_status_display == '1' %}checked="checked"{% endif %} />
|
id="basket_status_display" {% if basket_status_display == '1' %}checked="checked"{% endif %} />
|
||||||
{{ 'Afficher les status' | trans }}
|
{{ 'Afficher les status' | trans }}
|
||||||
</label>
|
</label>
|
||||||
|
@@ -1281,7 +1281,7 @@ class ApiJsonTest extends ApiTestCase
|
|||||||
|
|
||||||
$tochange = [];
|
$tochange = [];
|
||||||
foreach ($statusStructure as $n => $datas) {
|
foreach ($statusStructure as $n => $datas) {
|
||||||
$tochange[$n] = substr($record_status, ($n - 1), 1) == '0' ? '1' : '0';
|
$tochange[$n] = substr($record_status, $n, 1) == '0' ? '1' : '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->evaluateMethodNotAllowedRoute($route, ['GET', 'PUT', 'DELETE']);
|
$this->evaluateMethodNotAllowedRoute($route, ['GET', 'PUT', 'DELETE']);
|
||||||
@@ -1305,7 +1305,8 @@ class ApiJsonTest extends ApiTestCase
|
|||||||
// test record_status in string
|
// test record_status in string
|
||||||
$record_status_expected = $record_status;
|
$record_status_expected = $record_status;
|
||||||
|
|
||||||
$pos = strpos($record_status, '1');
|
$bitToChange = [];
|
||||||
|
$pos = strpos($record_status, '1', 4);
|
||||||
$bitToChange[$pos] = '1';
|
$bitToChange[$pos] = '1';
|
||||||
|
|
||||||
$response = $this->request('POST', $route, $this->getParameters(['status' => $bitToChange]), ['HTTP_Accept' => $this->getAcceptMimeType()]);
|
$response = $this->request('POST', $route, $this->getParameters(['status' => $bitToChange]), ['HTTP_Accept' => $this->getAcceptMimeType()]);
|
||||||
|
@@ -2017,6 +2017,9 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
{
|
{
|
||||||
$app = $this->getApplication();
|
$app = $this->getApplication();
|
||||||
$this->logout($app);
|
$this->logout($app);
|
||||||
|
|
||||||
|
$bkp = $app['phraseanet.configuration']['session'];
|
||||||
|
|
||||||
$app['phraseanet.configuration']['session'] = [
|
$app['phraseanet.configuration']['session'] = [
|
||||||
'idle' => 10,
|
'idle' => 10,
|
||||||
'lifetime' => 60475,
|
'lifetime' => 60475,
|
||||||
@@ -2027,12 +2030,17 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
|
|
||||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||||
$this->assertEquals('hidden', $crawler->filter('input[name="remember-me"]')->attr('type'));
|
$this->assertEquals('hidden', $crawler->filter('input[name="remember-me"]')->attr('type'));
|
||||||
|
|
||||||
|
$app['phraseanet.configuration']['session'] = $bkp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLoginPageWithNoIdleSessionTime()
|
public function testLoginPageWithNoIdleSessionTime()
|
||||||
{
|
{
|
||||||
$app = $this->getApplication();
|
$app = $this->getApplication();
|
||||||
$this->logout($app);
|
$this->logout($app);
|
||||||
|
|
||||||
|
$bkp = $app['phraseanet.configuration']['session'];
|
||||||
|
|
||||||
$app['phraseanet.configuration']['session'] = [
|
$app['phraseanet.configuration']['session'] = [
|
||||||
'idle' => 0,
|
'idle' => 0,
|
||||||
'lifetime' => 60475,
|
'lifetime' => 60475,
|
||||||
@@ -2043,6 +2051,8 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
|
|
||||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||||
$this->assertEquals('checkbox', $crawler->filter('input[name="remember-me"]')->attr('type'));
|
$this->assertEquals('checkbox', $crawler->filter('input[name="remember-me"]')->attr('type'));
|
||||||
|
|
||||||
|
$app['phraseanet.configuration']['session'] = $bkp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addUsrAuthDoctrineEntitySupport($id, $out, $participants = false)
|
private function addUsrAuthDoctrineEntitySupport($id, $out, $participants = false)
|
||||||
|
@@ -19,6 +19,9 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
{
|
{
|
||||||
$app = new Application(Application::ENV_TEST);
|
$app = new Application(Application::ENV_TEST);
|
||||||
$app['dispatcher']->addSubscriber(new SessionManagerSubscriber($app));
|
$app['dispatcher']->addSubscriber(new SessionManagerSubscriber($app));
|
||||||
|
|
||||||
|
$bkp = $app['phraseanet.configuration']['session'];
|
||||||
|
|
||||||
$app['phraseanet.configuration']['session'] = [
|
$app['phraseanet.configuration']['session'] = [
|
||||||
'idle' => 0,
|
'idle' => 0,
|
||||||
'lifetime' => 60475,
|
'lifetime' => 60475,
|
||||||
@@ -39,12 +42,17 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
$this->assertNotNUll($client->getResponse()->headers->get('x-phraseanet-end-session'));
|
$this->assertNotNUll($client->getResponse()->headers->get('x-phraseanet-end-session'));
|
||||||
$this->assertNotNUll($client->getResponse()->headers->get('location'));
|
$this->assertNotNUll($client->getResponse()->headers->get('location'));
|
||||||
$this->assertRegExp('#/login\?redirect=..(?:%2F|/)prod#', $client->getResponse()->headers->get('location'));
|
$this->assertRegExp('#/login\?redirect=..(?:%2F|/)prod#', $client->getResponse()->headers->get('location'));
|
||||||
|
|
||||||
|
$app['phraseanet.configuration']['session'] = $bkp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEndSessionXmlXhttpRequest()
|
public function testEndSessionXmlXhttpRequest()
|
||||||
{
|
{
|
||||||
$app = new Application(Application::ENV_TEST);
|
$app = new Application(Application::ENV_TEST);
|
||||||
$app['dispatcher']->addSubscriber(new SessionManagerSubscriber($app));
|
$app['dispatcher']->addSubscriber(new SessionManagerSubscriber($app));
|
||||||
|
|
||||||
|
$bkp = $app['phraseanet.configuration']['session'];
|
||||||
|
|
||||||
$app['phraseanet.configuration']['session'] = [
|
$app['phraseanet.configuration']['session'] = [
|
||||||
'idle' => 0,
|
'idle' => 0,
|
||||||
'lifetime' => 60475,
|
'lifetime' => 60475,
|
||||||
@@ -67,6 +75,8 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
|
|
||||||
$this->assertTrue($client->getResponse()->isClientError());
|
$this->assertTrue($client->getResponse()->isClientError());
|
||||||
$this->assertNotNUll($client->getResponse()->headers->get('x-phraseanet-end-session'));
|
$this->assertNotNUll($client->getResponse()->headers->get('x-phraseanet-end-session'));
|
||||||
|
|
||||||
|
$app['phraseanet.configuration']['session'] = $bkp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEndSessionAuthenticated()
|
public function testEndSessionAuthenticated()
|
||||||
@@ -85,6 +95,8 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
$app['orm.em']->expects($this->exactly(4))->method('persist')->will($this->returnValue(null));
|
$app['orm.em']->expects($this->exactly(4))->method('persist')->will($this->returnValue(null));
|
||||||
$app['orm.em']->expects($this->exactly(2))->method('flush')->will($this->returnValue(null));
|
$app['orm.em']->expects($this->exactly(2))->method('flush')->will($this->returnValue(null));
|
||||||
|
|
||||||
|
$bkp = $app['phraseanet.configuration']['session'];
|
||||||
|
|
||||||
$app['phraseanet.configuration']['session'] = [
|
$app['phraseanet.configuration']['session'] = [
|
||||||
'idle' => 0,
|
'idle' => 0,
|
||||||
'lifetime' => 60475,
|
'lifetime' => 60475,
|
||||||
@@ -101,6 +113,8 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
$client->request('GET', '/prod');
|
$client->request('GET', '/prod');
|
||||||
|
|
||||||
$this->assertTrue($client->getResponse()->isOK());
|
$this->assertTrue($client->getResponse()->isOK());
|
||||||
|
|
||||||
|
$app['phraseanet.configuration']['session'] = $bkp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEndSessionAuthenticatedWithOutdatedIdle()
|
public function testEndSessionAuthenticatedWithOutdatedIdle()
|
||||||
@@ -120,6 +134,8 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
$app['orm.em']->expects($this->any())->method('persist')->will($this->returnValue(null));
|
$app['orm.em']->expects($this->any())->method('persist')->will($this->returnValue(null));
|
||||||
$app['orm.em']->expects($this->any())->method('flush')->will($this->returnValue(null));
|
$app['orm.em']->expects($this->any())->method('flush')->will($this->returnValue(null));
|
||||||
|
|
||||||
|
$bkp = $app['phraseanet.configuration']['session'];
|
||||||
|
|
||||||
$app['phraseanet.configuration']['session'] = [
|
$app['phraseanet.configuration']['session'] = [
|
||||||
'idle' => 10,
|
'idle' => 10,
|
||||||
'lifetime' => 60475,
|
'lifetime' => 60475,
|
||||||
@@ -139,6 +155,8 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
$this->assertNotNUll($client->getResponse()->headers->get('x-phraseanet-end-session'));
|
$this->assertNotNUll($client->getResponse()->headers->get('x-phraseanet-end-session'));
|
||||||
$this->assertNotNUll($client->getResponse()->headers->get('location'));
|
$this->assertNotNUll($client->getResponse()->headers->get('location'));
|
||||||
$this->assertRegExp('#/login\?redirect=..(?:%2F|/)prod#', $client->getResponse()->headers->get('location'));
|
$this->assertRegExp('#/login\?redirect=..(?:%2F|/)prod#', $client->getResponse()->headers->get('location'));
|
||||||
|
|
||||||
|
$app['phraseanet.configuration']['session'] = $bkp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEndSessionAuthenticatedWithOutdatedIdleXmlHttpRequest()
|
public function testEndSessionAuthenticatedWithOutdatedIdleXmlHttpRequest()
|
||||||
@@ -158,6 +176,8 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
$app['orm.em']->expects($this->any())->method('persist')->will($this->returnValue(null));
|
$app['orm.em']->expects($this->any())->method('persist')->will($this->returnValue(null));
|
||||||
$app['orm.em']->expects($this->any())->method('flush')->will($this->returnValue(null));
|
$app['orm.em']->expects($this->any())->method('flush')->will($this->returnValue(null));
|
||||||
|
|
||||||
|
$bkp = $app['phraseanet.configuration']['session'];
|
||||||
|
|
||||||
$app['phraseanet.configuration']['session'] = [
|
$app['phraseanet.configuration']['session'] = [
|
||||||
'idle' => 10,
|
'idle' => 10,
|
||||||
'lifetime' => 60475,
|
'lifetime' => 60475,
|
||||||
@@ -178,6 +198,8 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
|
|
||||||
$this->assertTrue($client->getResponse()->isClientError());
|
$this->assertTrue($client->getResponse()->isClientError());
|
||||||
$this->assertNotNUll($client->getResponse()->headers->get('x-phraseanet-end-session'));
|
$this->assertNotNUll($client->getResponse()->headers->get('x-phraseanet-end-session'));
|
||||||
|
|
||||||
|
$app['phraseanet.configuration']['session'] = $bkp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUndefinedModule()
|
public function testUndefinedModule()
|
||||||
|
@@ -44,14 +44,15 @@ class media_Permalink_AdapterTest extends \PhraseanetTestCase
|
|||||||
|
|
||||||
public function testGet_url()
|
public function testGet_url()
|
||||||
{
|
{
|
||||||
$url = rtrim(self::$DI['app']['conf']->get('servername'), '/') . '/permalink/v1/'
|
$url = $this->removeScheme(rtrim(self::$DI['app']['conf']->get('servername'), '/') . '/permalink/v1/'
|
||||||
. self::$DI['record_1']->get_sbas_id() . '/'
|
. self::$DI['record_1']->get_sbas_id() . '/'
|
||||||
. self::$DI['record_1']->get_record_id()
|
. self::$DI['record_1']->get_record_id()
|
||||||
. '/document/' . $this->object->get_label()
|
. '/document/' . $this->object->get_label()
|
||||||
. '.' . pathinfo(self::$DI['record_1']->get_subdef('document')->get_file(), PATHINFO_EXTENSION)
|
. '.' . pathinfo(self::$DI['record_1']->get_subdef('document')->get_file(), PATHINFO_EXTENSION)
|
||||||
. '?token=' . urlencode($this->object->get_token());
|
. '?token=' . urlencode($this->object->get_token())
|
||||||
|
);
|
||||||
|
|
||||||
$this->assertEquals($url, $this->object->get_url());
|
$this->assertEquals($url, $this->removeScheme((string)($this->object->get_url())));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGet_Previewurl()
|
public function testGet_Previewurl()
|
||||||
@@ -60,25 +61,27 @@ class media_Permalink_AdapterTest extends \PhraseanetTestCase
|
|||||||
$subdef = self::$DI['record_1']->get_subdef('preview');
|
$subdef = self::$DI['record_1']->get_subdef('preview');
|
||||||
$previewPermalink = media_Permalink_Adapter::getPermalink(self::$DI['app'], $databox, $subdef);
|
$previewPermalink = media_Permalink_Adapter::getPermalink(self::$DI['app'], $databox, $subdef);
|
||||||
|
|
||||||
$url = rtrim(self::$DI['app']['conf']->get('servername'), '/') . '/permalink/v1/'
|
$url = $this->removeScheme(rtrim(self::$DI['app']['conf']->get('servername'), '/') . '/permalink/v1/'
|
||||||
. self::$DI['record_1']->get_sbas_id() . '/'
|
. self::$DI['record_1']->get_sbas_id() . '/'
|
||||||
. self::$DI['record_1']->get_record_id()
|
. self::$DI['record_1']->get_record_id()
|
||||||
. '/preview/' . $previewPermalink->get_label()
|
. '/preview/' . $previewPermalink->get_label()
|
||||||
. '.' . pathinfo(self::$DI['record_1']->get_subdef('preview')->get_file(), PATHINFO_EXTENSION)
|
. '.' . pathinfo(self::$DI['record_1']->get_subdef('preview')->get_file(), PATHINFO_EXTENSION)
|
||||||
. '?token=' . urlencode($previewPermalink->get_token());
|
. '?token=' . urlencode($previewPermalink->get_token())
|
||||||
|
);
|
||||||
|
|
||||||
$this->assertEquals($url, $previewPermalink->get_url());
|
$this->assertEquals($url, $this->removeScheme((string)($previewPermalink->get_url())));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGet_page()
|
public function testGet_page()
|
||||||
{
|
{
|
||||||
$url = rtrim(self::$DI['app']['conf']->get('servername'), '/') . '/permalink/v1/'
|
$url = $this->removeScheme(rtrim(self::$DI['app']['conf']->get('servername'), '/') . '/permalink/v1/'
|
||||||
. self::$DI['record_1']->get_sbas_id() . '/'
|
. self::$DI['record_1']->get_sbas_id() . '/'
|
||||||
. self::$DI['record_1']->get_record_id()
|
. self::$DI['record_1']->get_record_id()
|
||||||
. '/document/'
|
. '/document/'
|
||||||
. '?token=' . urlencode($this->object->get_token());
|
. '?token=' . urlencode($this->object->get_token())
|
||||||
|
);
|
||||||
|
|
||||||
$this->assertEquals($url, $this->object->get_page());
|
$this->assertEquals($url, $this->removeScheme((string)($this->object->get_page())));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGet_id()
|
public function testGet_id()
|
||||||
@@ -113,4 +116,9 @@ class media_Permalink_AdapterTest extends \PhraseanetTestCase
|
|||||||
{
|
{
|
||||||
media_Permalink_Adapter::create(self::$DI['app'], self::$DI['record_1']->get_databox(), self::$DI['record_1']->get_subdef('document'));
|
media_Permalink_Adapter::create(self::$DI['app'], self::$DI['record_1']->get_databox(), self::$DI['record_1']->get_subdef('document'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function removeScheme($s)
|
||||||
|
{
|
||||||
|
return preg_replace('/^(http|https):\\/\\/(.*)$/', '$2', $s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7577,10 +7577,10 @@ phraseanet-common@^0.4.5-d:
|
|||||||
js-cookie "^2.1.0"
|
js-cookie "^2.1.0"
|
||||||
pym.js "^1.3.1"
|
pym.js "^1.3.1"
|
||||||
|
|
||||||
phraseanet-production-client@^0.34.86-d:
|
phraseanet-production-client@0.34.102-d:
|
||||||
version "0.34.86-d"
|
version "0.34.102-d"
|
||||||
resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.86-d.tgz#51e6c6fb17fcd2695cee90fb3d972c781057fd78"
|
resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.102-d.tgz#ee2772fd712a5fb2acc87eae5c7d4a2a46f5a28a"
|
||||||
integrity sha512-12o7pcRZAJ/5Ote4DbkaRxLz2GIZBUcZf53FB+GHVFxhds5ia6UNDCPhYP5vX4hhHtO/Y6Mj/BOlOjnoyi+k1g==
|
integrity sha512-3KtY3n9uI42o6mDUDDXX6KgP3Os2FlQE3nkzEJc3eVbstG9V6rNlk8J/ujXaMKy1hibBT+9f7TTSYy0Z9ARPBA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@mapbox/mapbox-gl-language" "^0.9.2"
|
"@mapbox/mapbox-gl-language" "^0.9.2"
|
||||||
"@turf/turf" "^5.1.6"
|
"@turf/turf" "^5.1.6"
|
||||||
|
Reference in New Issue
Block a user