diff --git a/composer.lock b/composer.lock index 3794bfe80c..eb4523a2a5 100644 --- a/composer.lock +++ b/composer.lock @@ -383,16 +383,16 @@ }, { "name": "alchemy/phpexiftool", - "version": "0.7.0", + "version": "0.7.2", "source": { "type": "git", "url": "https://github.com/alchemy-fr/PHPExiftool.git", - "reference": "7372ca4e43473328bf06bca810558fbad7bb2f95" + "reference": "ba1cb51eceb6562d7996023478977a8739de188b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/alchemy-fr/PHPExiftool/zipball/7372ca4e43473328bf06bca810558fbad7bb2f95", - "reference": "7372ca4e43473328bf06bca810558fbad7bb2f95", + "url": "https://api.github.com/repos/alchemy-fr/PHPExiftool/zipball/ba1cb51eceb6562d7996023478977a8739de188b", + "reference": "ba1cb51eceb6562d7996023478977a8739de188b", "shasum": "" }, "require": { @@ -443,8 +443,8 @@ }, { "name": "Benoit Burnichon", - "role": "Lead Developer", - "email": "bburnichon@alchemy.fr" + "email": "bburnichon@alchemy.fr", + "role": "Lead Developer" } ], "description": "Exiftool driver for PHP", @@ -452,7 +452,7 @@ "exiftool", "metadata" ], - "time": "2017-05-18T19:04:04+00:00" + "time": "2019-02-13T13:06:43+00:00" }, { "name": "alchemy/queue-bundle", diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index f25e906f57..13c7728f86 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -665,7 +665,7 @@ class Application extends SilexApplication private function setupGeonames() { $this['geonames.server-uri'] = $this->share(function (Application $app) { - return $app['conf']->get(['registry', 'webservices', 'geonames-server'], 'http://geonames.alchemyasp.com/'); + return $app['conf']->get(['registry', 'webservices', 'geonames-server'], 'https://geonames.alchemyasp.com/'); }); } diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php index 5bb3e10614..39361d46da 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php +++ b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php @@ -944,7 +944,7 @@ class V1Controller extends Controller } $originalName = $pi['filename'] . '.' . $pi['extension']; - $newPathname = $tempfile; + $uploadedFilename = $newPathname = $tempfile; } } else { @@ -956,8 +956,11 @@ class V1Controller extends Controller if (!$file->isValid()) { return $this->getBadRequestAction($request, 'Data corrupted, please try again'); } + + $uploadedFilename = $file->getPathname(); $originalName = $file->getClientOriginalName(); $newPathname = $file->getPathname() . '.' . $file->getClientOriginalExtension(); + if (false === rename($file->getPathname(), $newPathname)) { return Result::createError($request, 403, 'Error while renaming file')->createResponse(); } @@ -1010,6 +1013,11 @@ class V1Controller extends Controller $nosubdef = $request->get('nosubdefs') === '' || \p4field::isyes($request->get('nosubdefs')); $this->getBorderManager()->process($session, $Package, $callback, $behavior, $nosubdef); + // remove $newPathname on temporary directory + if ($newPathname !== $uploadedFilename) { + @rename($newPathname, $uploadedFilename); + } + $ret = ['entity' => null]; if ($output instanceof \record_adapter) { @@ -1081,6 +1089,11 @@ class V1Controller extends Controller } } + // remove $newPathname on temporary directory + if ($renamedFilename !== $uploadedFilename) { + @rename($renamedFilename, $uploadedFilename); + } + return Result::create($request, $ret)->createResponse(); } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/PushController.php b/lib/Alchemy/Phrasea/Controller/Prod/PushController.php index 569537fed3..f9ce528e41 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/PushController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/PushController.php @@ -463,6 +463,8 @@ class PushController extends Controller } try { + $manager = $this->getEntityManager(); + $password = $this->getRandomGenerator()->generateString(128); $user = $this->getUserManipulator()->createUser($email, $password, $email); @@ -476,12 +478,15 @@ class PushController extends Controller $user->setCompany($request->request->get('company')); } if ($request->request->get('job')) { - $user->setCompany($request->request->get('job')); + $user->setJob($request->request->get('job')); } - if ($request->request->get('form_geonameid')) { - $this->getUserManipulator()->setGeonameId($user, $request->request->get('form_geonameid')); + if ($request->request->get('city')) { + $this->getUserManipulator()->setGeonameId($user, $request->request->get('city')); } + $manager->persist($user); + $manager->flush(); + $result['message'] = $this->app->trans('User successfully created'); $result['success'] = true; $result['user'] = $this->formatUser($user); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php b/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php index a362540935..1e8724c0ee 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php @@ -179,7 +179,6 @@ class QueryController extends Controller }; $userManipulator->setUserSetting($user, 'last_jsonquery', (string)$request->request->get('jsQuery')); - $jsQuery = @json_decode((string)$request->request->get('jsQuery'), true); if(($ft = $findFulltext($jsQuery['query'])) !== null) { $userManipulator->setUserSetting($user, 'start_page_query', $ft); @@ -317,7 +316,7 @@ class QueryController extends Controller ' . '' - . $this->app->trans('%total% reponses', ['%total%' => ''.$result->getTotal().'']) . ''; + . $this->app->trans('%total% reponses', ['%total%' => ''.number_format($result->getTotal(),null, null, ' ').'']) . ''; $json['infos'] = $infoResult; $json['navigationTpl'] = $string; diff --git a/lib/Alchemy/Phrasea/Controller/Root/LoginController.php b/lib/Alchemy/Phrasea/Controller/Root/LoginController.php index ecb65abc47..c0a05be25f 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/LoginController.php +++ b/lib/Alchemy/Phrasea/Controller/Root/LoginController.php @@ -265,7 +265,7 @@ class LoginController extends Controller return $this->render('login/register-classic.html.twig', array_merge( $this->getDefaultTemplateVariables($request), [ - 'geonames_server_uri' => str_replace(sprintf('%s:', parse_url($url, PHP_URL_SCHEME)), '', $url), + 'geonames_server_uri' => $url, 'form' => $form->createView() ])); } diff --git a/lib/Alchemy/Phrasea/Core/Configuration/RegistryFormManipulator.php b/lib/Alchemy/Phrasea/Core/Configuration/RegistryFormManipulator.php index fbf4526d05..fbce72ccc7 100644 --- a/lib/Alchemy/Phrasea/Core/Configuration/RegistryFormManipulator.php +++ b/lib/Alchemy/Phrasea/Core/Configuration/RegistryFormManipulator.php @@ -146,7 +146,7 @@ class RegistryFormManipulator ], 'webservices' => [ 'google-charts-enabled' => true, - 'geonames-server' => 'http://geonames.alchemyasp.com/', + 'geonames-server' => 'https://geonames.alchemyasp.com/', 'captchas-enabled' => false, 'recaptcha-public-key' => '', 'recaptcha-private-key' => '', diff --git a/lib/Alchemy/Phrasea/Media/SubdefGenerator.php b/lib/Alchemy/Phrasea/Media/SubdefGenerator.php index 2dede228c5..88867551a1 100644 --- a/lib/Alchemy/Phrasea/Media/SubdefGenerator.php +++ b/lib/Alchemy/Phrasea/Media/SubdefGenerator.php @@ -61,7 +61,7 @@ class SubdefGenerator public function generateSubdefs(\record_adapter $record, array $wanted_subdefs = null) { - if ($record->get_hd_file() !== null) { + if ($record->get_hd_file() !== null && $record->get_hd_file()->getMimeType() == "application/x-indesign") { $mediaSource = $this->mediavorus->guess($record->get_hd_file()->getPathname()); $metadatas = $mediaSource->getMetadatas(); @@ -69,15 +69,27 @@ class SubdefGenerator if(!isset($this->tmpFilesystem)){ $this->tmpFilesystem = Manager::create(); } - $tmpDir = $this->tmpFilesystem->createTemporaryDirectory(); + $tmpDir = $this->tmpFilesystem->createTemporaryDirectory(0777, 500); - try { - $this->app['filesystem']->dumpFile($tmpDir.'/file.jpg', $metadatas->get('XMP-xmp:PageImage')->getValue()->asString()); - $this->tmpFilePath = $tmpDir.'/file.jpg'; - } catch (\Exception $e) { - $this->logger->error(sprintf('Unable to write temporary file : %s', $e->getMessage())); + $files = $this->app['exiftool.preview-extractor']->extract($record->get_hd_file()->getPathname(), $tmpDir); + + $selected = null; + $size = null; + + foreach ($files as $file) { + if ($file->isDir() || $file->isDot()) { + continue; + } + + if (is_null($selected) || $file->getSize() > $size) { + $selected = $file->getPathname(); + $size = $file->getSize(); + } } + if ($selected) { + $this->tmpFilePath = $selected; + } } } diff --git a/package.json b/package.json index d93ac787a6..84823d0938 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "normalize-css": "^2.1.0", "npm": "^6.0.0", "npm-modernizr": "^2.8.3", - "phraseanet-production-client": "^0.34.53-d", + "phraseanet-production-client": "0.34.72-d", "requirejs": "^2.3.5", "tinymce": "^4.0.28", "underscore": "^1.8.3", diff --git a/resources/www/common/js/components/common.js b/resources/www/common/js/components/common.js index d19965e696..39c6ddf3c8 100644 --- a/resources/www/common/js/components/common.js +++ b/resources/www/common/js/components/common.js @@ -31,17 +31,13 @@ var commonModule = (function ($, p4) { $(this).removeClass('context-menu-item-hover'); }); - // $('#help-trigger').contextMenu('#mainMenu .helpcontextmenu', {openEvt: 'click', dropDown: true, theme: 'vista', dropDown: true, - // showTransition: 'slideDown', - // hideTransition: 'hide', - // shadow: false - // }); $('body').on('click', '.infoDialog', function (event) { infoDialog($(this)); }); }); + function showOverlay(n, appendto, callback, zIndex) { var div = "OVERLAY"; diff --git a/resources/www/common/styles/main.scss b/resources/www/common/styles/main.scss index 6a99013e9b..805e018608 100644 --- a/resources/www/common/styles/main.scss +++ b/resources/www/common/styles/main.scss @@ -88,4 +88,20 @@ $mainMenuLinkBackgroundHoverColor: transparent; box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.39); } } +/*Help menu*/ +.contextMenu.helpcontextmenu { + display: none; + &.shown { + display: block; + position: absolute; + z-index: 101; + } +} +.help-trigger { + display:inline-block; + cursor:pointer; + padding: 0 4px; + border:none; + margin-left: -12px; +} diff --git a/resources/www/prod/images/Basket/Browser/archive.png b/resources/www/prod/images/Basket/Browser/archive.png index f7373f9614..ab89643a35 100644 Binary files a/resources/www/prod/images/Basket/Browser/archive.png and b/resources/www/prod/images/Basket/Browser/archive.png differ diff --git a/resources/www/prod/images/Basket/Browser/archived.png b/resources/www/prod/images/Basket/Browser/archived.png index 3e34e45736..6015eafc48 100644 Binary files a/resources/www/prod/images/Basket/Browser/archived.png and b/resources/www/prod/images/Basket/Browser/archived.png differ diff --git a/resources/www/report/styles/main.scss b/resources/www/report/styles/main.scss index 75030126a9..218fce1f28 100644 --- a/resources/www/report/styles/main.scss +++ b/resources/www/report/styles/main.scss @@ -110,7 +110,7 @@ $select-height: 26px; } .input-prepend { margin: 0; - + .dmin, .dmax { border: 0 none; height: 16px; @@ -203,7 +203,7 @@ $select-height: 26px; height: $select-height; } .select-styled { - position: absolute; + position: absolute; top: 0; right: 0; bottom: 0; @@ -232,9 +232,9 @@ $select-height: 26px; background-color: darken($select-background, 5); } } - + .select-options { - display: none; + display: none; position: absolute; top: 12px; right: -12px; @@ -292,7 +292,7 @@ $select-height: 26px; -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); - + &:hover { background-color: #2c2c2c; } @@ -355,4 +355,8 @@ $select-height: 26px; &.ui-widget-content{ background-color: #212121; } -} \ No newline at end of file +} + +#mainMenu li .context-menu-item-inner a:hover { + color: #000; +} diff --git a/templates/web/admin/editusers.html.twig b/templates/web/admin/editusers.html.twig index 4b07dea1d3..2421976775 100644 --- a/templates/web/admin/editusers.html.twig +++ b/templates/web/admin/editusers.html.twig @@ -512,7 +512,7 @@ {{ 'admin::compte-utilisateur poste' | trans }} - + @@ -528,7 +528,7 @@ {{ 'admin::compte-utilisateur activite' | trans }} - + diff --git a/templates/web/common/menubar.html.twig b/templates/web/common/menubar.html.twig index 84ab930e7d..3821f42e79 100644 --- a/templates/web/common/menubar.html.twig +++ b/templates/web/common/menubar.html.twig @@ -25,103 +25,103 @@ @@ -235,11 +235,10 @@ {{ 'phraseanet:: aide' | trans }} - - + +
@@ -301,6 +300,10 @@ + diff --git a/templates/web/prod/WorkZone/Browser/Results.html.twig b/templates/web/prod/WorkZone/Browser/Results.html.twig index 47ba7802dd..50455d69f1 100644 --- a/templates/web/prod/WorkZone/Browser/Results.html.twig +++ b/templates/web/prod/WorkZone/Browser/Results.html.twig @@ -4,28 +4,9 @@ -
- {% if Total == 0 %} - {{ 'No results' | trans }} - {% elseif Total == 1 %} - {{ '1 result' | trans }} - {% else %} - {% trans with {'%Total%' : Total} %}%Total% results{% endtrans %} - {% endif %} - - {% if Page - 1 > 0 %} - - - - {% endif %} - - Page {{ Page }} / {{ MaxPage }} - - {% if Page + 1 <= MaxPage %} - - - - {% endif %} + {% transchoice Total %} + {0} No results|{1} Result|]1,Inf[ Results + {% endtranschoice %}
@@ -33,43 +14,39 @@
{% for Basket in Baskets %} -
- × -
- - - - + - -
+
+   +
+
+ +
{% set BasketElement = Basket.getElements().first() %} {% if BasketElement %} - {{thumbnail.format(BasketElement.getRecord(app).get_thumbnail(), 80, 80, '', true, false)}} + {{thumbnail.format(BasketElement.getRecord(app).get_thumbnail(), 150, 106, '', true, false)}} {% endif %} -
- {{ Basket.getElements().count() }} -
-
+ +

{% if Basket.getValidation() is empty or Basket.getValidation().isInitiator(app.getAuthenticatedUser()) %} - - - +   - - - +   {% endif %} - {{ Basket.getName() }} - + {{ Basket.getName() }} +
+ {{ Basket.getElements().count() }} {{ ' records' }} +

+ {% if Basket.getPusher() %}

- {% set user_name = '' ~ Basket.getPusher(app).get_display_name() ~ '' %} + {% set user_name = '' ~ Basket.getPusher(app).getDisplayName() ~ '' %} {% trans with {'%user_name%' : user_name} %}Received from %user_name%{% endtrans %}

{% endif %} @@ -92,12 +69,11 @@

{% endif %} -
+
{% endfor %} @@ -117,19 +93,16 @@
{% if Page - 1 > 0 %} - - - +   {% endif %} Page {{ Page }} / {{ MaxPage }} {% if Page + 1 <= MaxPage %} - - - +   {% endif %}
+ diff --git a/templates/web/prod/actions/edit_default.html.twig b/templates/web/prod/actions/edit_default.html.twig index afe8bc12c6..bc4a8a3de9 100644 --- a/templates/web/prod/actions/edit_default.html.twig +++ b/templates/web/prod/actions/edit_default.html.twig @@ -196,8 +196,10 @@
-
- +
+
diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php index d78194c4d7..c8f2cdb254 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php @@ -14,6 +14,7 @@ use Alchemy\Phrasea\Model\Entities\LazaretSession; use Alchemy\Phrasea\Model\Entities\Task; use Alchemy\Phrasea\Model\Entities\User; use Alchemy\Phrasea\SearchEngine\SearchEngineOptions; +use Alchemy\Phrasea\Status\StatusStructureProviderInterface; use Doctrine\Common\Collections\ArrayCollection; use Guzzle\Common\Exception\GuzzleException; use Ramsey\Uuid\Uuid; @@ -1256,13 +1257,33 @@ class ApiJsonTest extends ApiTestCase $record1 = $this->getRecord1(); $route = '/api/v1/records/' . $record1->getDataboxId() . '/' . $record1->getRecordId() . '/setstatus/'; - $record_status = strrev($record1->getStatus()); + $initialRecordStatus = $record_status = strrev($record1->getStatus()); + + /** @var StatusStructureProviderInterface $statusProvider */ + $statusProvider = $app['status.provider']; + + // initialize status structure for test eg: 4 to 15 bit + foreach (range(4, 15) as $n) { + $properties = [ + 'searchable' => '0', + 'printable' => '0', + 'name' => 'status_test_' . $n, + 'labelon' => '', + 'labeloff' => '', + 'labels_on' => [], + 'labels_off' => [], + ]; + + $statusProvider->updateStatus($record1->getStatusStructure(), $n, $properties); + } + $statusStructure = $record1->getStatusStructure(); $tochange = []; foreach ($statusStructure as $n => $datas) { $tochange[$n] = substr($record_status, ($n - 1), 1) == '0' ? '1' : '0'; } + $this->evaluateMethodNotAllowedRoute($route, ['GET', 'PUT', 'DELETE']); $response = $this->request('POST', $route, $this->getParameters(['status' => $tochange]), ['HTTP_Accept' => $this->getAcceptMimeType()]); @@ -1281,6 +1302,27 @@ class ApiJsonTest extends ApiTestCase $this->assertEquals(substr($record_status, ($n), 1), $tochange[$n]); } + // test record_status in string + $record_status_expected = $record_status; + + $pos = strpos($record_status, '1'); + $bitToChange[$pos] = '1'; + + $response = $this->request('POST', $route, $this->getParameters(['status' => $bitToChange]), ['HTTP_Accept' => $this->getAcceptMimeType()]); + $content = $this->unserialize($response->getContent()); + + // Get fresh record_1 + $testRecord = new \record_adapter($app, $testRecord->getDataboxId(), $testRecord->getRecordId()); + + $this->evaluateResponse200($response); + $this->evaluateMeta200($content); + + $this->evaluateRecordsStatusResponse($testRecord, $content); + + $record_new_status = strrev($testRecord->getStatus()); + $this->assertEquals($record_status_expected, $record_new_status); + + foreach ($tochange as $n => $value) { $tochange[$n] = $value == '0' ? '1' : '0'; } @@ -1301,6 +1343,8 @@ class ApiJsonTest extends ApiTestCase $this->assertEquals(substr($record_status, ($n), 1), $tochange[$n]); } + $this->assertEquals($initialRecordStatus, $record_status); + $record1->setStatus(str_repeat('0', 32)); } diff --git a/yarn.lock b/yarn.lock index c469bd7d52..4cfedda66c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7555,10 +7555,10 @@ phraseanet-common@^0.4.1: js-cookie "^2.1.0" pym.js "^1.3.1" -phraseanet-production-client@^0.34.53-d: - version "0.34.53-d" - resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.53-d.tgz#517e5d9ccae2f1f0f3cdb7ac194e70579cbcc65f" - integrity sha512-/Vd5kd/YRapDpUWzBZZvm5hHwieXdU2cBEtC3D/FPbeSEI3dmYEDnuznDxBafPZvep65KdAtufPw+B6ulWNgBQ== +phraseanet-production-client@0.34.72-d: + version "0.34.72-d" + resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.72-d.tgz#028a5ccd589e696b5433eea9d53d9367966613c8" + integrity sha512-IPaDRqXwyJegoKmzr56bggxTzN4TnmuAqU4O7rDEhh0aqdCiuC8rlH/yzKoLeEIMSrESCw5mBhrI//ccntvv9w== dependencies: "@mapbox/mapbox-gl-language" "^0.9.2" "@turf/turf" "^5.1.6"