diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php index e0ea64ca73..8924ca0ba9 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php @@ -65,26 +65,23 @@ class Tools implements ControllerProviderInterface }); $controllers->post('/rotate/', function (Application $app, Request $request) { - $return = ['success' => true, 'errorMessage' => '']; - $records = RecordsRequest::fromRequest($app, $request, false); - - $rotation = in_array($request->request->get('rotation'), ['-90', '90', '180']) ? $request->request->get('rotation', 90) : 90; + $rotation = in_array($request->request->get('rotation'), array('-90', '90', '180')) ? $request->request->get('rotation', 90) : 90; foreach ($records as $record) { - foreach ($record->get_subdefs() as $name => $subdef) { - if ($name == 'document') + foreach ($record->get_subdefs() as $subdef) { + if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) { continue; + } try { $subdef->rotate($rotation, $app['media-alchemyst'], $app['mediavorus']); } catch (\Exception $e) { - } } } - return $app->json($return); + return $app->json(array('success' => true, 'errorMessage' => '')); })->bind('prod_tools_rotate'); $controllers->post('/image/', function (Application $app, Request $request) { diff --git a/templates/web/prod/actions/Tools/index.html.twig b/templates/web/prod/actions/Tools/index.html.twig index 9be5f5407f..c0eb82f68c 100644 --- a/templates/web/prod/actions/Tools/index.html.twig +++ b/templates/web/prod/actions/Tools/index.html.twig @@ -19,14 +19,6 @@ {% endif %} {% endfor %} -{# image section #} -{% set allowRotate = '0' %} -{% for record in records %} - {% if record.get_type() == 'image' %} - {% set allowRotate = '1' %} - {% endif %} -{% endfor %} -
{# jquery Tabs #} @@ -50,14 +42,12 @@ {% endif %} {% endfor %} {% endif %} - {% if allowRotate == 1%} -
  • - - {{ "image tool" | trans }} - -
  • - {% endif %} - {% if selectionLength == 1 and (app['conf'].get(['registry', 'modules', 'doc-substitution']) or app['conf'].get(['registry', 'modules', 'thumb-substitution'])) %} +
  • + + {{ "image tool" | trans }} + +
  • + {% if selectionLength == 1 and (app['phraseanet.registry'].get('GV_seeOngChgDoc') or app['phraseanet.registry'].get('GV_seeNewThumb')) %}
  • {{ "substitution" | trans }} @@ -242,31 +232,32 @@ {% endfor %} {% endif %} - {% if allowRotate == 1 %} -
    -
    -
    -  {{ "image rotation" | trans }}  - -
    - - - - -
    -
    - - -
    -
    +
    +
    + {% trans %}Changes for rotation will be applied only on the sub-definitions of "image" type.{% endtrans %} +
    +
    +
    +  {% trans "image rotation" %}  + +
    + + + + +
    +
    + +
    - {% endif %} +
    +
    {# hd sub section #} {% if selectionLength == 1 and (app['conf'].get(['registry', 'modules', 'doc-substitution']) or app['conf'].get(['registry', 'modules', 'thumb-substitution'])) %}