From d02f8f5a017d3853914d9931308dea0bafb677f2 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Fri, 12 Jul 2019 18:06:01 +0400 Subject: [PATCH 01/48] PHRAS-2665 #comment Fix video tool ratio #time 8h --- cache/.gitkeep | 0 .../prod/actions/Tools/videoEditor.html.twig | 36 +++++++++++++++---- 2 files changed, 29 insertions(+), 7 deletions(-) delete mode 100644 cache/.gitkeep diff --git a/cache/.gitkeep b/cache/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/templates/web/prod/actions/Tools/videoEditor.html.twig b/templates/web/prod/actions/Tools/videoEditor.html.twig index df8f61332c..c4f45e1642 100644 --- a/templates/web/prod/actions/Tools/videoEditor.html.twig +++ b/templates/web/prod/actions/Tools/videoEditor.html.twig @@ -45,6 +45,8 @@ {% set dataH = constant('media_subdef::TC_DATA_HEIGHT') %} {% set technical_info = record.get_technical_infos %} + + {#Set the preview Ratio #} {% set width = technical_info[dataW].value %} {% set height = technical_info[dataH].value %} @@ -56,12 +58,32 @@ {% set ratio = '' %} {% endif %} - + {#Set the document Ratio #} + {% for subdef in outputFormats %} + + {% set width = subdef.get_width() %} + {% set height = subdef.get_height() %} + + {% if width and height %} + {% set rawRatio = (width / height)|number_format(3, '.') %} + {% set rawRatioLength = rawRatio|length %} + {% set docRatio = rawRatio|slice(0,rawRatioLength-1) %} + {% else %} + {% set docRatio = '' %} + {% endif %} + + + +
+ {% endfor %}
@@ -109,7 +131,7 @@ + class="alt_canvas" id="{{ subdef.get_name() }}" > {% endfor %} From b590ae1c8aa79eb111466aee9bfad360f34304b6 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Mon, 15 Jul 2019 18:30:37 +0400 Subject: [PATCH 02/48] PHRAS-2665 --- .../prod/actions/Tools/videoEditor.html.twig | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/templates/web/prod/actions/Tools/videoEditor.html.twig b/templates/web/prod/actions/Tools/videoEditor.html.twig index c4f45e1642..150bc55767 100644 --- a/templates/web/prod/actions/Tools/videoEditor.html.twig +++ b/templates/web/prod/actions/Tools/videoEditor.html.twig @@ -71,18 +71,19 @@ {% else %} {% set docRatio = '' %} {% endif %} + {% if loop.index == 1 %} + - - -
+
+ {% endif %} {% endfor %} From 1ba27e55c7870af175a700a5fdbda4271aab6c3e Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 16 Jul 2019 14:07:41 +0400 Subject: [PATCH 03/48] PHRAS-2665 #time 3h --- .../prod/actions/Tools/videoEditor.html.twig | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/templates/web/prod/actions/Tools/videoEditor.html.twig b/templates/web/prod/actions/Tools/videoEditor.html.twig index 150bc55767..b0064cc978 100644 --- a/templates/web/prod/actions/Tools/videoEditor.html.twig +++ b/templates/web/prod/actions/Tools/videoEditor.html.twig @@ -49,6 +49,7 @@ {#Set the preview Ratio #} {% set width = technical_info[dataW].value %} {% set height = technical_info[dataH].value %} + {% set prevRatio = '' %} {% if width and height %} {% set rawRatio = (width / height)|number_format(3, '.') %} @@ -59,7 +60,7 @@ {% endif %} {#Set the document Ratio #} - {% for subdef in outputFormats %} + {% for subdef in previewHtml5 %} {% set width = subdef.get_width() %} {% set height = subdef.get_height() %} @@ -67,24 +68,21 @@ {% if width and height %} {% set rawRatio = (width / height)|number_format(3, '.') %} {% set rawRatioLength = rawRatio|length %} - {% set docRatio = rawRatio|slice(0,rawRatioLength-1) %} + {% if subdef.get_name()=='preview' %} + {% set prevRatio = rawRatio|slice(0,rawRatioLength-1) %} + {% endif %} {% else %} - {% set docRatio = '' %} + {% set prevRatio = '' %} {% endif %} - {% if loop.index == 1 %} - -
- {% endif %} {% endfor %} + +
From c2f55eb8ba080a5410345f372b42a66ff52749e9 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 16 Jul 2019 15:12:26 +0400 Subject: [PATCH 04/48] PHRAS-2668 #comment fix twig error #time 1h --- cache/.gitkeep | 0 templates/web/common/index_bootstrap.html.twig | 2 +- templates/web/prod/index.html.twig | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 cache/.gitkeep diff --git a/cache/.gitkeep b/cache/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/templates/web/common/index_bootstrap.html.twig b/templates/web/common/index_bootstrap.html.twig index 6249ef8e66..9b9f27a228 100644 --- a/templates/web/common/index_bootstrap.html.twig +++ b/templates/web/common/index_bootstrap.html.twig @@ -32,7 +32,7 @@ {% endblock %} - +
{% include 'common/menubar.html.twig' %}
diff --git a/templates/web/prod/index.html.twig b/templates/web/prod/index.html.twig index d2b34b8ff1..73adc3534e 100644 --- a/templates/web/prod/index.html.twig +++ b/templates/web/prod/index.html.twig @@ -146,7 +146,7 @@ $(document).ready(function(){ prodApp.appEvents.emit('workzone.doRemoveWarning', "{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), "warning_on_delete_story") %}true{% else %}false{% endif %}"); prodApp.appEvents.emit('search.updateFacetData'); - + $('body').addClass('{{ cssfile }}') }); From 49f6ff58ee1c3cca187837ecc12547980ce1f15c Mon Sep 17 00:00:00 2001 From: Nicolas Maillat Date: Tue, 16 Jul 2019 18:10:25 +0200 Subject: [PATCH 05/48] Update index.html.twig --- templates/web/prod/index.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/web/prod/index.html.twig b/templates/web/prod/index.html.twig index 73adc3534e..c5cde9d778 100644 --- a/templates/web/prod/index.html.twig +++ b/templates/web/prod/index.html.twig @@ -146,7 +146,7 @@ $(document).ready(function(){ prodApp.appEvents.emit('workzone.doRemoveWarning', "{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), "warning_on_delete_story") %}true{% else %}false{% endif %}"); prodApp.appEvents.emit('search.updateFacetData'); - $('body').addClass('{{ cssfile }}') + $('body').addClass('{{ cssfile }}'); }); From 8c0f939339df7278536d5fd47e95704a56159b1f Mon Sep 17 00:00:00 2001 From: Xavier Rousset Date: Tue, 16 Jul 2019 20:13:46 +0200 Subject: [PATCH 06/48] Update provisioning workflow, check if a box name is defined. A playbook for box usage is created --- Vagrantfile | 66 ++++++++++++---------------- resources/ansible/playbook-boxes.yml | 21 +++++++++ resources/ansible/playbook.yml | 24 +++++----- 3 files changed, 61 insertions(+), 50 deletions(-) create mode 100644 resources/ansible/playbook-boxes.yml diff --git a/Vagrantfile b/Vagrantfile index a899a77ca5..f4d4ea0049 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,16 +1,5 @@ Vagrant.require_version ">= 1.5" - -class MyCustomError < StandardError - attr_reader :code - - def initialize(code) - @code = code - end - - def to_s - "[#{code} #{super}]" - end -end +require 'json' # Check to determine whether we're on a windows or linux/os-x host, # later on we use this to launch ansible in the supported way @@ -39,7 +28,16 @@ unless Vagrant.has_plugin?('vagrant-hostmanager') raise "vagrant-hostmanager is not installed! Please run\n vagrant plugin install vagrant-hostmanager\n\n" end -if ARGV[1] == '--provision' +# Check to determine if box_meta JSON is present +# if provisionned : pick name of box +if File.file?(".vagrant/machines/default/virtualbox/box_meta") + data = File.read(".vagrant/machines/default/virtualbox/box_meta") + parsed_json = JSON.parse(data) + $box = parsed_json["name"] +end + +# if not : run prompt to configure provisioning +if !File.file?(".vagrant/machines/default/virtualbox/box_meta") && ARGV[0] == 'up' print "\033[34m \nChoose a Build type :\n\n(1) Use prebuilt Phraseanet Box\n(2) Build Phraseanet from scratch (xenial)\n\033[00m" type = STDIN.gets.chomp print "\n" @@ -47,9 +45,10 @@ if ARGV[1] == '--provision' case (type) when '1' $box = "alchemy/Phraseanet-vagrant-dev_php" + $playbook = "resources/ansible/playbook-boxes.yml" when '2' $box = "ubuntu/xenial64" - print("\033[91mComplete build selected, don't forget to uncomment all roles on playbook.yml\n\n\033[00m") + $playbook = "resources/ansible/playbook.yml" else raise "\033[31mYou should specify Build type before running vagrant\n\n (Available : 1, 2)\n\n\033[00m" end @@ -133,8 +132,6 @@ else if $env == "linux" $hostIps = `ifconfig | sed -nE 's/[[:space:]]*inet ([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})(.*)$/\\1/p'`.split("\n"); else $hostIps = `resources/ansible/inventories/GetIpAdresses.cmd`; - # raise MyCustomError.new($hostIps), "HOST IP" - end end @@ -157,31 +154,28 @@ Vagrant.configure("2") do |config| ] end - config.vm.box = ($box) ? $box : "ubuntu/xenial64" - - # In case, Phraseanet box, choose the php version - # For php 7.0 use box 0.0.1 - # For php 7.1 use box 0.0.2 - #config.vm.box_version = "0.0.1" - + config.vm.box = $box config.ssh.forward_agent = true config_net(config) # If ansible is in your path it will provision from your HOST machine # If ansible is not found in the path it will be instaled in the VM and provisioned from there if which('ansible-playbook') - config.vm.provision "ansible_local" do |ansible| - ansible.playbook = "resources/ansible/playbook.yml" - ansible.limit = 'all' - ansible.verbose = 'vvv' - ansible.extra_vars = { - hostname: $hostname, - host_addresses: $hostIps, - phpversion: phpversion, - postfix: { - postfix_domain: $hostname + ".vb" + + if $playbook + config.vm.provision "ansible_local" do |ansible| + ansible.playbook = $playbook + ansible.limit = 'all' + ansible.verbose = 'vvv' + ansible.extra_vars = { + hostname: $hostname, + host_addresses: $hostIps, + phpversion: phpversion, + postfix: { + postfix_domain: $hostname + ".vb" + } } - } + end end config.vm.provision "ansible_local", run: "always" do |ansible| @@ -194,10 +188,6 @@ Vagrant.configure("2") do |config| } end else - # raise MyCustomError.new([$hostname, $phpVersion, $hostIps]), "HOST IP" - # raise MyCustomError.new($hostIps), "HOST IP" - # raise MyCustomError.new($hostIps), "HOST IP" - config.vm.provision :shell, path: "resources/ansible/windows.sh", args: [$hostname, $phpVersion, $hostIps] # config.vm.provision :shell, run: "always", path: "resources/ansible/windows-always.sh", args: ["default"] end diff --git a/resources/ansible/playbook-boxes.yml b/resources/ansible/playbook-boxes.yml new file mode 100644 index 0000000000..704c5b96ec --- /dev/null +++ b/resources/ansible/playbook-boxes.yml @@ -0,0 +1,21 @@ +--- +- hosts: all + sudo: true + vars_files: + - vars/all.yml + roles: +# - server +# - repositories +# - vagrant_local +# - nginx +# - mariadb +# - elasticsearch +# - rabbitmq +# - php +# - xdebug +# - composer +# - mailcatcher +# - node +# - yarn +# - ffmpeg + - app diff --git a/resources/ansible/playbook.yml b/resources/ansible/playbook.yml index 370b427481..c4f76aaa61 100644 --- a/resources/ansible/playbook.yml +++ b/resources/ansible/playbook.yml @@ -4,18 +4,18 @@ vars_files: - vars/all.yml roles: -# - server -# - repositories -# - vagrant_local + - server + - repositories + - vagrant_local - nginx -# - mariadb -# - elasticsearch -# - rabbitmq -# - php + - mariadb + - elasticsearch + - rabbitmq + - php - xdebug -# - composer -# - mailcatcher -# - node -# - yarn -# - ffmpeg + - composer + - mailcatcher + - node + - yarn + - ffmpeg - app From e06a281dd061258834dc6aa0d8cd98c051271db6 Mon Sep 17 00:00:00 2001 From: aynsix Date: Thu, 18 Jul 2019 12:17:44 +0400 Subject: [PATCH 07/48] add index on table notifications --- lib/Alchemy/Phrasea/Core/Version.php | 2 +- lib/conf.d/bases_structure.xml | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php index b2bf620798..0e15108724 100644 --- a/lib/Alchemy/Phrasea/Core/Version.php +++ b/lib/Alchemy/Phrasea/Core/Version.php @@ -16,7 +16,7 @@ class Version /** * @var string */ - private $number = '4.1.0-alpha.14a'; + private $number = '4.1.0-alpha.15a'; /** * @var string diff --git a/lib/conf.d/bases_structure.xml b/lib/conf.d/bases_structure.xml index a4d0d2f9c5..a666eaeb5c 100644 --- a/lib/conf.d/bases_structure.xml +++ b/lib/conf.d/bases_structure.xml @@ -1278,6 +1278,27 @@ id + + usr_id + INDEX + + usr_id + + + + unread + INDEX + + unread + + + + created_on + INDEX + + created_on + + InnoDB From 5bc66e8f237fd80d041823c41fb6684b8a940d84 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Fri, 19 Jul 2019 12:04:19 +0400 Subject: [PATCH 08/48] PHRAS-2671 #comment Fix behaviour of display tooltip #time 4h --- cache/.gitkeep | 0 templates/web/common/preview.html.twig | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 cache/.gitkeep diff --git a/cache/.gitkeep b/cache/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/templates/web/common/preview.html.twig b/templates/web/common/preview.html.twig index b607d6d017..0dba1f0cfd 100644 --- a/templates/web/common/preview.html.twig +++ b/templates/web/common/preview.html.twig @@ -15,7 +15,7 @@ {% set previewHtml5 = null %} -{% if app.getAclForUser(app.getAuthenticatedUser()).has_access_to_subdef(record, 'preview') %} +{% if app.getAclForUser(app.getAuthenticatedUser()).has_access_to_subdef(record, 'preview') and record.has_preview == true %} {% set preview_obj = record.get_preview() %} {% else %} {% set preview_obj = record.get_thumbnail() %} From 954e04477d66569799bacd9963fd7df22441c604 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 23 Jul 2019 11:27:11 +0400 Subject: [PATCH 09/48] PHRAS-2665 #comment fix code review #time 1h --- .../web/prod/actions/Tools/videoEditor.html.twig | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/templates/web/prod/actions/Tools/videoEditor.html.twig b/templates/web/prod/actions/Tools/videoEditor.html.twig index b0064cc978..d9a798291a 100644 --- a/templates/web/prod/actions/Tools/videoEditor.html.twig +++ b/templates/web/prod/actions/Tools/videoEditor.html.twig @@ -52,11 +52,7 @@ {% set prevRatio = '' %} {% if width and height %} - {% set rawRatio = (width / height)|number_format(3, '.') %} - {% set rawRatioLength = rawRatio|length %} - {% set ratio = rawRatio|slice(0,rawRatioLength-1) %} - {% else %} - {% set ratio = '' %} + {% set ratio = (width / height)|number_format(3, '.') %} {% endif %} {#Set the document Ratio #} @@ -66,13 +62,9 @@ {% set height = subdef.get_height() %} {% if width and height %} - {% set rawRatio = (width / height)|number_format(3, '.') %} - {% set rawRatioLength = rawRatio|length %} {% if subdef.get_name()=='preview' %} - {% set prevRatio = rawRatio|slice(0,rawRatioLength-1) %} + {% set prevRatio = (width / height)|number_format(3, '.') %} {% endif %} - {% else %} - {% set prevRatio = '' %} {% endif %} {% endfor %} From 86484c6580210073d8d53d58d839834f21d4e634 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 23 Jul 2019 11:29:00 +0400 Subject: [PATCH 10/48] PHRAS-2665 --- templates/web/prod/actions/Tools/videoEditor.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/web/prod/actions/Tools/videoEditor.html.twig b/templates/web/prod/actions/Tools/videoEditor.html.twig index d9a798291a..6d10080cce 100644 --- a/templates/web/prod/actions/Tools/videoEditor.html.twig +++ b/templates/web/prod/actions/Tools/videoEditor.html.twig @@ -52,7 +52,7 @@ {% set prevRatio = '' %} {% if width and height %} - {% set ratio = (width / height)|number_format(3, '.') %} + {% set ratio = (width / height)|number_format(2, '.') %} {% endif %} {#Set the document Ratio #} @@ -63,7 +63,7 @@ {% if width and height %} {% if subdef.get_name()=='preview' %} - {% set prevRatio = (width / height)|number_format(3, '.') %} + {% set prevRatio = (width / height)|number_format(2, '.') %} {% endif %} {% endif %} From 714918f148687f14fa472dbc7bfd775e817662b3 Mon Sep 17 00:00:00 2001 From: jygaulier Date: Tue, 23 Jul 2019 16:58:50 +0200 Subject: [PATCH 11/48] Restore xdebug provisioning restore roles xdebug & nginx --- resources/ansible/playbook-boxes.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/ansible/playbook-boxes.yml b/resources/ansible/playbook-boxes.yml index 704c5b96ec..370b427481 100644 --- a/resources/ansible/playbook-boxes.yml +++ b/resources/ansible/playbook-boxes.yml @@ -7,12 +7,12 @@ # - server # - repositories # - vagrant_local -# - nginx + - nginx # - mariadb # - elasticsearch # - rabbitmq # - php -# - xdebug + - xdebug # - composer # - mailcatcher # - node From 2180332414e3312330ec7d56682985670c752a71 Mon Sep 17 00:00:00 2001 From: jygaulier Date: Mon, 29 Jul 2019 13:37:53 +0200 Subject: [PATCH 12/48] fix mailcatcher version current version of mailcatcher wants ruby 2, downgrade to a version ok with ruby 1.9 --- resources/ansible/roles/mailcatcher/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/ansible/roles/mailcatcher/tasks/main.yml b/resources/ansible/roles/mailcatcher/tasks/main.yml index 7d1ca213ea..45a377ebe8 100644 --- a/resources/ansible/roles/mailcatcher/tasks/main.yml +++ b/resources/ansible/roles/mailcatcher/tasks/main.yml @@ -13,7 +13,7 @@ - name: Install mailcatcher gem # gem module is flaky, this is consistent - command: gem install mailcatcher --conservative + command: gem install mailcatcher -v 0.6.4 --conservative ignore_errors: yes - name: Install mailcatcher supervisord conf From 9335bb2517cc02fd093e6f084e50f71397296a05 Mon Sep 17 00:00:00 2001 From: jygaulier Date: Mon, 29 Jul 2019 13:39:06 +0200 Subject: [PATCH 13/48] restore mailcatcher --- resources/ansible/playbook-boxes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/ansible/playbook-boxes.yml b/resources/ansible/playbook-boxes.yml index 370b427481..3418297c6c 100644 --- a/resources/ansible/playbook-boxes.yml +++ b/resources/ansible/playbook-boxes.yml @@ -14,7 +14,7 @@ # - php - xdebug # - composer -# - mailcatcher + - mailcatcher # - node # - yarn # - ffmpeg From e679f78ed746d8fb73550b208916558f866d0328 Mon Sep 17 00:00:00 2001 From: Alexandre BRACH Date: Fri, 2 Aug 2019 11:15:49 +0200 Subject: [PATCH 14/48] PHRDPL-75 #comment composer-install : update checksum --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9f1821fb6d..7ff718ab2c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,7 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ - && php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \ + && 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');" From f185558de74f846cfa68d05399f828f8453ce533 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Fri, 2 Aug 2019 13:48:48 +0400 Subject: [PATCH 15/48] PHRAS-2688 #comment Port 41 of Prod workzone: Change type of numbering #time 1h --- lib/Alchemy/Phrasea/Controller/Prod/QueryController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php b/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php index a362540935..12685f1119 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php @@ -317,7 +317,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; From 3663ace661998b0f0a7e8fd781b9cf7e18ee69fa Mon Sep 17 00:00:00 2001 From: Alexandre BRACH Date: Fri, 2 Aug 2019 12:32:09 +0200 Subject: [PATCH 16/48] PHRDPL-75 #comment update .circleci --- .circleci/config.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7ce9464ae5..28843588b3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -124,7 +124,7 @@ workflows: context: "AWS London" create-repo: true dockerfile: Dockerfile - extra-build-args: "--target phraseanet" + extra-build-args: "--target phraseanet-fpm" region: AWS_DEFAULT_REGION repo: "${AWS_RESOURCE_NAME_PREFIX}/phraseanet" tag: "alpha-0.1" @@ -139,3 +139,14 @@ workflows: region: AWS_DEFAULT_REGION repo: "${AWS_RESOURCE_NAME_PREFIX}/phraseanet-nginx" tag: "alpha-0.1" + - aws-ecr/build_and_push_image: + account-url: AWS_ACCOUNT_URL + aws-access-key-id: AWS_ACCESS_KEY_ID + aws-secret-access-key: AWS_SECRET_ACCESS_KEY + context: "AWS London" + create-repo: true + dockerfile: Dockerfile + extra-build-args: "--target phraseanet-worker" + region: AWS_DEFAULT_REGION + repo: "${AWS_RESOURCE_NAME_PREFIX}/phraseanet" + tag: "alpha-0.1" From 366c48673397dc537de4a6d209df5a17354fd0c0 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Wed, 7 Aug 2019 16:43:53 +0400 Subject: [PATCH 17/48] PHRAS-2282 #comment add new design #time 24h --- .../prod/WorkZone/Browser/Browser.html.twig | 6 ++-- .../prod/WorkZone/Browser/Results.html.twig | 32 ++++++------------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/templates/web/prod/WorkZone/Browser/Browser.html.twig b/templates/web/prod/WorkZone/Browser/Browser.html.twig index 7ba9370ec7..ce831a2b42 100644 --- a/templates/web/prod/WorkZone/Browser/Browser.html.twig +++ b/templates/web/prod/WorkZone/Browser/Browser.html.twig @@ -1,7 +1,7 @@ -
+
-
+
@@ -78,7 +78,7 @@
-
+
diff --git a/templates/web/prod/WorkZone/Browser/Results.html.twig b/templates/web/prod/WorkZone/Browser/Results.html.twig index 47ba7802dd..71e43ef98c 100644 --- a/templates/web/prod/WorkZone/Browser/Results.html.twig +++ b/templates/web/prod/WorkZone/Browser/Results.html.twig @@ -7,24 +7,9 @@ {% if Total == 0 %} {{ 'No results' | trans }} {% elseif Total == 1 %} - {{ '1 result' | trans }} + {{ 'Result' | trans }} {% else %} - {% trans with {'%Total%' : Total} %}%Total% results{% endtrans %} - {% endif %} - - - {% if Page - 1 > 0 %} - - - - {% endif %} - - Page {{ Page }} / {{ MaxPage }} - - {% if Page + 1 <= MaxPage %} - - - + {{ 'Results' | trans }} {% endif %} @@ -35,18 +20,16 @@ {% 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() }} -
 

@@ -64,9 +47,12 @@ {% endif %} {{ Basket.getName() }} - +
+ {{ Basket.getElements().count() }} {{ ' records' }} +

+ {% if Basket.getPusher() %}

{% set user_name = '' ~ Basket.getPusher(app).get_display_name() ~ '' %} From e7ec57346a46ce366f02a632038f6a696c1e5b2f Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Thu, 8 Aug 2019 13:56:44 +0400 Subject: [PATCH 18/48] PRHAS-2282 #comment fix JY comments --- templates/web/prod/WorkZone/Browser/Results.html.twig | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/templates/web/prod/WorkZone/Browser/Results.html.twig b/templates/web/prod/WorkZone/Browser/Results.html.twig index 71e43ef98c..908de424c2 100644 --- a/templates/web/prod/WorkZone/Browser/Results.html.twig +++ b/templates/web/prod/WorkZone/Browser/Results.html.twig @@ -4,13 +4,9 @@
- {% if Total == 0 %} - {{ 'No results' | trans }} - {% elseif Total == 1 %} - {{ 'Result' | trans }} - {% else %} - {{ 'Results' | trans }} - {% endif %} + {% transchoice Total %} + {0} No results|{1} Result|]1,Inf[ Results + {% endtranschoice %}
From 772b1026320c652c2cf99d3fbb65632a9379c90b Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Mon, 12 Aug 2019 16:40:58 +0400 Subject: [PATCH 19/48] PHRAS-2282 #time 4h --- templates/web/prod/WorkZone/Browser/Browser.html.twig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templates/web/prod/WorkZone/Browser/Browser.html.twig b/templates/web/prod/WorkZone/Browser/Browser.html.twig index ce831a2b42..5ca65cf7e4 100644 --- a/templates/web/prod/WorkZone/Browser/Browser.html.twig +++ b/templates/web/prod/WorkZone/Browser/Browser.html.twig @@ -84,3 +84,8 @@

+ From 947b97ee0ba84677aaff2a781a0143e50ee45f81 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 13 Aug 2019 11:06:57 +0400 Subject: [PATCH 20/48] PHRAS-2706 --- lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php index 6304f3eaa6..ee65e0bd1e 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php @@ -212,8 +212,7 @@ class BasketRepository extends EntityRepository case self::RECEIVED: $dql = 'SELECT b FROM Phraseanet:Basket b - JOIN b.elements e - WHERE b.user = :usr_id AND b.pusher_id IS NOT NULL'; + JOIN b.elements e'; $params = [ 'usr_id' => $user->getId() ]; From 074e1cf9ea66b0963e466347f5c65140fbc27cfd Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 13 Aug 2019 11:35:06 +0400 Subject: [PATCH 21/48] PHRAS-2282 commit to run circle ci test --- templates/web/prod/WorkZone/Browser/Browser.html.twig | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/web/prod/WorkZone/Browser/Browser.html.twig b/templates/web/prod/WorkZone/Browser/Browser.html.twig index 5ca65cf7e4..1545366eac 100644 --- a/templates/web/prod/WorkZone/Browser/Browser.html.twig +++ b/templates/web/prod/WorkZone/Browser/Browser.html.twig @@ -88,4 +88,5 @@ .dialog-Medium { height: 523px!important; } + From 8987e2dba5cf066c8b69dba4dd51e0d16c6fef54 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 13 Aug 2019 11:39:57 +0400 Subject: [PATCH 22/48] PHRAS-2688 commit to run ccircle ci test --- lib/Alchemy/Phrasea/Controller/Prod/QueryController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php b/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php index 12685f1119..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); From 0d84aa040afb2c77a83604799e01d84b77cb99e2 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Wed, 14 Aug 2019 16:18:15 +0400 Subject: [PATCH 23/48] PHRAS-2282 #comment fix next page or previous page display for results #time 3h --- .../prod/WorkZone/Browser/Browser.html.twig | 9 ++++++- .../prod/WorkZone/Browser/Results.html.twig | 24 +++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/templates/web/prod/WorkZone/Browser/Browser.html.twig b/templates/web/prod/WorkZone/Browser/Browser.html.twig index 1545366eac..fad351dc25 100644 --- a/templates/web/prod/WorkZone/Browser/Browser.html.twig +++ b/templates/web/prod/WorkZone/Browser/Browser.html.twig @@ -88,5 +88,12 @@ .dialog-Medium { height: 523px!important; } - +.paginator a { + background: none!important; + border: 0; + border-radius: 0; + padding: 0 9px; + font-weight: bold; +} + diff --git a/templates/web/prod/WorkZone/Browser/Results.html.twig b/templates/web/prod/WorkZone/Browser/Results.html.twig index 908de424c2..041a246a41 100644 --- a/templates/web/prod/WorkZone/Browser/Results.html.twig +++ b/templates/web/prod/WorkZone/Browser/Results.html.twig @@ -99,19 +99,35 @@
{% if Page - 1 > 0 %} - - + + < {% endif %} Page {{ Page }} / {{ MaxPage }} {% if Page + 1 <= MaxPage %} - - + + > {% endif %}
+ From 816225036f0c96eb90de58d8d11fe500ec90d33e Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Wed, 14 Aug 2019 16:26:16 +0400 Subject: [PATCH 24/48] PHRAS-2282 add loader on results display --- templates/web/prod/WorkZone/Browser/Browser.html.twig | 6 ++++++ templates/web/prod/WorkZone/Browser/Results.html.twig | 2 ++ 2 files changed, 8 insertions(+) diff --git a/templates/web/prod/WorkZone/Browser/Browser.html.twig b/templates/web/prod/WorkZone/Browser/Browser.html.twig index fad351dc25..91ca5054c5 100644 --- a/templates/web/prod/WorkZone/Browser/Browser.html.twig +++ b/templates/web/prod/WorkZone/Browser/Browser.html.twig @@ -95,5 +95,11 @@ padding: 0 9px; font-weight: bold; } +.result_loader { + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); +} diff --git a/templates/web/prod/WorkZone/Browser/Results.html.twig b/templates/web/prod/WorkZone/Browser/Results.html.twig index 041a246a41..1985bcaec4 100644 --- a/templates/web/prod/WorkZone/Browser/Results.html.twig +++ b/templates/web/prod/WorkZone/Browser/Results.html.twig @@ -119,6 +119,7 @@ //load the next result page jQuery(document).ready(function(){ jQuery('.next_res').click(function(){ + jQuery('.results').append(''); jQuery('.results').load($(this).attr('href')); return false; }); @@ -126,6 +127,7 @@ //load the prev result page jQuery(document).ready(function(){ jQuery('.prev_res').click(function(){ + jQuery('.results').append(''); jQuery('.results').load($(this).attr('href')); return false; }); From 80b4c9a6a6c9e844a5c187471c595f334346b6b3 Mon Sep 17 00:00:00 2001 From: Xavier Rousset Date: Wed, 14 Aug 2019 15:45:04 +0200 Subject: [PATCH 25/48] PHRAS-2127 | Add https in default geoname server url, remove url formatter in register controller --- lib/Alchemy/Phrasea/Application.php | 2 +- lib/Alchemy/Phrasea/Controller/Root/LoginController.php | 2 +- .../Phrasea/Core/Configuration/RegistryFormManipulator.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index f586a4f93a..743f9cc664 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -653,7 +653,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/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' => '', From d0bbea71b9092663c3956826d4936172bc90dbcd Mon Sep 17 00:00:00 2001 From: aynsix Date: Wed, 14 Aug 2019 18:24:22 +0400 Subject: [PATCH 26/48] use configuration pdftotext binary --- lib/Alchemy/Phrasea/Application.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index f586a4f93a..f25e906f57 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -115,6 +115,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormTypeInterface; use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\Process\ExecutableFinder; use Unoconv\UnoconvServiceProvider; use XPDF\PdfToText; use XPDF\XPDFServiceProvider; @@ -237,8 +238,19 @@ class Application extends SilexApplication $this->register(new UnicodeServiceProvider()); $this->register(new ValidatorServiceProvider()); - $this->register(new XPDFServiceProvider()); - $this->setupXpdf(); + + if ($this['configuration.store']->isSetup()) { + $binariesConfig = $this['conf']->get(['main', 'binaries']); + $executableFinder = new ExecutableFinder(); + $this->register(new XPDFServiceProvider(), [ + 'xpdf.configuration' => [ + 'pdftotext.binaries' => isset($binariesConfig['pdftotext_binary']) ? $binariesConfig['pdftotext_binary'] : $executableFinder->find('pdftotext'), + ] + ]); + + $this->setupXpdf(); + } + $this->register(new FileServeServiceProvider()); $this->register(new ManipulatorServiceProvider()); $this->register(new PluginServiceProvider()); From eb938ee9ea19011e424066854b4a0a35dc6848c7 Mon Sep 17 00:00:00 2001 From: aynsix Date: Thu, 15 Aug 2019 11:15:26 +0400 Subject: [PATCH 27/48] formate date from metadata to Y/m/d H:i:s --- .../Phrasea/Metadata/PhraseanetMetadataSetter.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/Metadata/PhraseanetMetadataSetter.php b/lib/Alchemy/Phrasea/Metadata/PhraseanetMetadataSetter.php index 45d098bd11..c72c884203 100644 --- a/lib/Alchemy/Phrasea/Metadata/PhraseanetMetadataSetter.php +++ b/lib/Alchemy/Phrasea/Metadata/PhraseanetMetadataSetter.php @@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\Metadata; use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\Databox\DataboxRepository; use Alchemy\Phrasea\Metadata\Tag\NoSource; +use DateTime; use PHPExiftool\Driver\Metadata\Metadata; class PhraseanetMetadataSetter @@ -66,8 +67,16 @@ class PhraseanetMetadataSetter continue; } - $data['value'] = $value; + if ($field->get_type() == 'date') { + try { + $dateTime = new DateTime($value); + $value = $dateTime->format('Y/m/d H:i:s'); + } catch (\Exception $e) { + // $value unchanged + } + } + $data['value'] = $value; $metadataInRecordFormat[] = $data; } } From 20076df3f8cc5d06fdafae52d615e35a6fb8ddfb Mon Sep 17 00:00:00 2001 From: aynsix Date: Thu, 15 Aug 2019 15:23:03 +0400 Subject: [PATCH 28/48] port to 4.1 date with time on phraseanet --- .../Elastic/AST/KeyValue/FieldKey.php | 5 + .../SearchEngine/Elastic/AST/KeyValue/Key.php | 1 + .../Elastic/AST/KeyValue/MetadataKey.php | 5 + .../Elastic/AST/KeyValue/NativeKey.php | 5 + .../Elastic/AST/KeyValue/RangeExpression.php | 44 +++++--- .../Elastic/AST/KeyValue/TimestampKey.php | 5 + .../Elastic/ElasticSearchEngine.php | 4 +- .../SearchEngine/Elastic/FieldMapping.php | 3 +- .../Elastic/Mapping/DateFieldMapping.php | 5 +- .../SearchEngine/Elastic/RecordHelper.php | 48 ++++++--- .../Elastic/Search/QueryHelper.php | 65 ++++++----- .../Elastic/Search/QueryVisitor.php | 22 ++-- .../Elastic/Structure/ValueChecker.php | 3 +- .../TaskManager/Job/WriteMetadataJob.php | 62 +++++++++-- .../SearchEngine/AST/RangeExpressionTest.php | 2 + .../SearchEngine/resources/queries.csv | 101 +++++++++++++++--- 16 files changed, 287 insertions(+), 93 deletions(-) diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/FieldKey.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/FieldKey.php index f4f8553738..293e8c69dd 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/FieldKey.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/FieldKey.php @@ -30,6 +30,11 @@ class FieldKey implements Key, QueryPostProcessor return $this->getField($context)->getIndexField($raw); } + public function getFieldType(QueryContext $context) + { + return $this->getField($context)->getType(); + } + public function isValueCompatible($value, QueryContext $context) { return ValueChecker::isValueCompatible($this->getField($context), $value); diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/Key.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/Key.php index 20ee045a59..d664fccb94 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/Key.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/Key.php @@ -6,6 +6,7 @@ use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext; interface Key { + public function getFieldType(QueryContext $context); public function getIndexField(QueryContext $context, $raw = false); public function isValueCompatible($value, QueryContext $context); public function __toString(); diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/MetadataKey.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/MetadataKey.php index 292b6e7237..61f9303fe0 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/MetadataKey.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/MetadataKey.php @@ -23,6 +23,11 @@ class MetadataKey implements Key return $this->getTag($context)->getIndexField($raw); } + public function getFieldType(QueryContext $context) + { + return $this->getTag($context)->getType(); + } + public function isValueCompatible($value, QueryContext $context) { return ValueChecker::isValueCompatible($this->getTag($context), $value); diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/NativeKey.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/NativeKey.php index e486483b71..3c2d334f48 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/NativeKey.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/NativeKey.php @@ -52,6 +52,11 @@ class NativeKey implements Key $this->key = $key; } + public function getFieldType(QueryContext $context) + { + return $this->type; + } + public function getIndexField(QueryContext $context, $raw = false) { return $this->key; diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/RangeExpression.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/RangeExpression.php index ec785354ae..17f901a77c 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/RangeExpression.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/RangeExpression.php @@ -2,18 +2,20 @@ namespace Alchemy\Phrasea\SearchEngine\Elastic\AST\KeyValue; +use Alchemy\Phrasea\SearchEngine\Elastic\FieldMapping; +use Alchemy\Phrasea\SearchEngine\Elastic\RecordHelper; +use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Field as StructureField; use Assert\Assertion; -use Alchemy\Phrasea\SearchEngine\Elastic\AST\KeyValue\FieldKey; -use Alchemy\Phrasea\SearchEngine\Elastic\AST\KeyValue\Key; use Alchemy\Phrasea\SearchEngine\Elastic\AST\Node; use Alchemy\Phrasea\SearchEngine\Elastic\Exception\QueryException; use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext; -use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryHelper; use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryPostProcessor; class RangeExpression extends Node { + /** @var FieldKey */ private $key; + private $lower_bound; private $lower_inclusive; private $higher_bound; @@ -55,20 +57,34 @@ class RangeExpression extends Node public function buildQuery(QueryContext $context) { $params = array(); - if ($this->lower_bound !== null) { - $this->assertValueCompatible($this->lower_bound, $context); - if ($this->lower_inclusive) { - $params['gte'] = $this->lower_bound; - } else { - $params['gt'] = $this->lower_bound; + /** @var StructureField $field */ + // $field = $this->key->getField($context); + $lower_bound = $this->lower_bound; + $higher_bound = $this->higher_bound; + + if($this->key->getFieldType($context) === FieldMapping::TYPE_DATE) { + if($lower_bound !== null) { + $lower_bound = RecordHelper::sanitizeDate($lower_bound); + } + if($higher_bound !== null) { + $higher_bound = RecordHelper::sanitizeDate($higher_bound); } } - if ($this->higher_bound !== null) { - $this->assertValueCompatible($this->higher_bound, $context); - if ($this->higher_inclusive) { - $params['lte'] = $this->higher_bound; + + if ($lower_bound !== null) { + $this->assertValueCompatible($lower_bound, $context); + if ($this->lower_inclusive) { + $params['gte'] = $lower_bound; } else { - $params['lt'] = $this->higher_bound; + $params['gt'] = $lower_bound; + } + } + if ($higher_bound !== null) { + $this->assertValueCompatible($higher_bound, $context); + if ($this->higher_inclusive) { + $params['lte'] = $higher_bound; + } else { + $params['lt'] = $higher_bound; } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/TimestampKey.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/TimestampKey.php index b879945982..a5d34909d7 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/TimestampKey.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/TimestampKey.php @@ -34,6 +34,11 @@ class TimestampKey implements Key, Typed return FieldMapping::TYPE_DATE; } + public function getFieldType(QueryContext $context) + { + return FieldMapping::TYPE_DATE; + } + public function getIndexField(QueryContext $context, $raw = false) { return $this->index_field; diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchEngine.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchEngine.php index ed9d3ceeed..63d9ec108e 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchEngine.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchEngine.php @@ -396,10 +396,10 @@ class ElasticSearchEngine implements SearchEngineInterface if ($options->getDateFields() && ($options->getMaxDate() || $options->getMinDate())) { $range = []; if ($options->getMaxDate()) { - $range['lte'] = $options->getMaxDate()->format(FieldMapping::DATE_FORMAT_CAPTION_PHP); + $range['lte'] = $options->getMaxDate()->format('Y-m-d'); } if ($options->getMinDate()) { - $range['gte'] = $options->getMinDate()->format(FieldMapping::DATE_FORMAT_CAPTION_PHP); + $range['gte'] = $options->getMinDate()->format('Y-m-d'); } foreach ($options->getDateFields() as $dateField) { diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/FieldMapping.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/FieldMapping.php index 076034b7b1..7a60b066e6 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/FieldMapping.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/FieldMapping.php @@ -16,8 +16,7 @@ class FieldMapping const DATE_FORMAT_MYSQL = 'yyyy-MM-dd HH:mm:ss'; const DATE_FORMAT_CAPTION = 'yyyy/MM/dd'; // ES format - const DATE_FORMAT_MYSQL_OR_CAPTION = 'yyyy-MM-dd HH:mm:ss||yyyy/MM/dd'; - const DATE_FORMAT_CAPTION_PHP = 'Y/m/d'; // PHP format + const DATE_FORMAT_MYSQL_OR_CAPTION = 'yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||yyyy-MM||yyyy'; // Core types const TYPE_STRING = 'string'; diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Mapping/DateFieldMapping.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Mapping/DateFieldMapping.php index a96ef45f4a..128a16467f 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Mapping/DateFieldMapping.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Mapping/DateFieldMapping.php @@ -57,6 +57,9 @@ class DateFieldMapping extends ComplexFieldMapping */ protected function getProperties() { - return array_merge([ 'format' => $this->format ], parent::getProperties()); + return array_merge([ + 'format' => $this->format, + 'ignore_malformed' => true + ], parent::getProperties()); } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/RecordHelper.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/RecordHelper.php index ffb0c71adf..83ca222593 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/RecordHelper.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/RecordHelper.php @@ -89,31 +89,45 @@ class RecordHelper return $this->collectionMap; } - /** - * @param string $date - * @return bool - */ - public static function validateDate($date) - { - $d = DateTime::createFromFormat(FieldMapping::DATE_FORMAT_CAPTION_PHP, $date); - - return $d && $d->format(FieldMapping::DATE_FORMAT_CAPTION_PHP) == $date; - } - /** * @param string $value * @return null|string */ public static function sanitizeDate($value) { - // introduced in https://github.com/alchemy-fr/Phraseanet/commit/775ce804e0257d3a06e4e068bd17330a79eb8370#diff-bee690ed259e0cf73a31dee5295d2edcR286 - // not sure if it's really needed + $v_fix = null; try { - $date = new \DateTime($value); - - return $date->format(FieldMapping::DATE_FORMAT_CAPTION_PHP); + $a = explode(';', preg_replace('/\D+/', ';', trim($value))); + switch (count($a)) { + case 1: // yyyy + $date = new \DateTime($a[0] . '-01-01'); // will throw if date is not valid + $v_fix = $date->format('Y'); + break; + case 2: // yyyy;mm + $date = new \DateTime( $a[0] . '-' . $a[1] . '-01'); + $v_fix = $date->format('Y-m'); + break; + case 3: // yyyy;mm;dd + $date = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2]); + $v_fix = $date->format('Y-m-d'); + break; + case 4: + $date = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':00:00'); + $v_fix = $date->format('Y-m-d H:i:s'); + break; + case 5: + $date = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':' . $a[4] . ':00'); + $v_fix = $date->format('Y-m-d H:i:s'); + break; + case 6: + $date = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':' . $a[4] . ':' . $a[5]); + $v_fix = $date->format('Y-m-d H:i:s'); + break; + } } catch (\Exception $e) { - return null; + // no-op, v_fix = null } + + return $v_fix; } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Search/QueryHelper.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Search/QueryHelper.php index 1acdd5935c..071ac94b1c 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Search/QueryHelper.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Search/QueryHelper.php @@ -110,41 +110,50 @@ class QueryHelper } } - public static function getRangeFromDateString($string) + public static function getRangeFromDateString($value) { - $formats = ['Y/m/d', 'Y/m', 'Y']; - $deltas = ['+1 day', '+1 month', '+1 year']; - $to = null; - while ($format = array_pop($formats)) { - $delta = array_pop($deltas); - $from = date_create_from_format($format, $string); - if ($from !== false) { - // Rewind to start of range - $month = 1; - $day = 1; - switch ($format) { - case 'Y/m/d': - $day = (int) $from->format('d'); - case 'Y/m': - $month = (int) $from->format('m'); - case 'Y': - $year = (int) $from->format('Y'); - } - date_date_set($from, $year, $month, $day); - date_time_set($from, 0, 0, 0); - // Create end of the the range - $to = date_modify(clone $from, $delta); - break; + $date_from = null; + $date_to = null; + try { + $a = explode(';', preg_replace('/\D+/', ';', trim($value))); + switch (count($a)) { + case 1: // yyyy + $date_to = clone($date_from = new \DateTime($a[0] . '-01-01 00:00:00')); // will throw if date is not valid + $date_to->add(new \DateInterval('P1Y')); + break; + case 2: // yyyy;mm + $date_to = clone($date_from = new \DateTime($a[0] . '-' . $a[1] . '-01 00:00:00')); // will throw if date is not valid + $date_to->add(new \DateInterval('P1M')); + break; + case 3: // yyyy;mm;dd + $date_to = clone($date_from = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' 00:00:00')); // will throw if date is not valid + $date_to->add(new \DateInterval('P1D')); + break; + case 4: + $date_to = clone($date_from = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':00:00')); + $date_to->add(new \DateInterval('PT1H')); + break; + case 5: + $date_to = clone($date_from = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':' . $a[4] . ':00')); + $date_to->add(new \DateInterval('PT1M')); + break; + case 6: + $date_to = clone($date_from = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':' . $a[4] . ':' . $a[5])); + // $date_to->add(new \DateInterval('PT1S')); // no need since precision is 1 sec, a "equal" will be generated when from==to + break; } } + catch (\Exception $e) { + // no-op + } - if (!$from || !$to) { - throw new \InvalidArgumentException(sprintf('Invalid date "%s".', $string)); + if ($date_from === null || $date_to === null) { + throw new \InvalidArgumentException(sprintf('Invalid date "%s".', $value)); } return [ - 'from' => $from->format(FieldMapping::DATE_FORMAT_CAPTION_PHP), - 'to' => $to->format(FieldMapping::DATE_FORMAT_CAPTION_PHP) + 'from' => $date_from->format('Y-m-d H:i:s'), + 'to' => $date_to->format('Y-m-d H:i:s') ]; } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Search/QueryVisitor.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Search/QueryVisitor.php index 522666bcaa..52c0fa54a6 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Search/QueryVisitor.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Search/QueryVisitor.php @@ -5,7 +5,7 @@ namespace Alchemy\Phrasea\SearchEngine\Elastic\Search; use Alchemy\Phrasea\SearchEngine\Elastic\AST; use Alchemy\Phrasea\SearchEngine\Elastic\Exception\Exception; use Alchemy\Phrasea\SearchEngine\Elastic\FieldMapping; -use Alchemy\Phrasea\SearchEngine\Elastic\Mapping; +use Alchemy\Phrasea\SearchEngine\Elastic\RecordHelper; use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Structure; use Hoa\Compiler\Llk\TreeNode; use Hoa\Visitor\Element; @@ -166,6 +166,12 @@ class QueryVisitor implements Visit $key = $node->getChild(0)->accept($this); $boundary = $node->getChild(1)->accept($this); + if ($this->isDateKey($key)) { + if(($v = RecordHelper::sanitizeDate($boundary)) !== null) { + $boundary = $v; + } + } + switch ($node->getId()) { case NodeTypes::LT_EXPR: return AST\KeyValue\RangeExpression::lessThan($key, $boundary); @@ -195,11 +201,15 @@ class QueryVisitor implements Visit try { // Try to create a range for incomplete dates $range = QueryHelper::getRangeFromDateString($right); - return new AST\KeyValue\RangeExpression( - $left, - $range['from'], true, - $range['to'], false - ); + if ($range['from'] === $range['to']) { + return new AST\KeyValue\EqualExpression($left, $range['from']); + } else { + return new AST\KeyValue\RangeExpression( + $left, + $range['from'], true, + $range['to'], false + ); + } } catch (\InvalidArgumentException $e) { // Fall back to equal expression } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/ValueChecker.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/ValueChecker.php index 31f65c580e..f27defa2bb 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/ValueChecker.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/ValueChecker.php @@ -3,7 +3,6 @@ namespace Alchemy\Phrasea\SearchEngine\Elastic\Structure; use Alchemy\Phrasea\SearchEngine\Elastic\FieldMapping; -use Alchemy\Phrasea\SearchEngine\Elastic\Mapping; use Alchemy\Phrasea\SearchEngine\Elastic\RecordHelper; use Assert\Assertion; @@ -20,7 +19,7 @@ class ValueChecker { Assertion::allIsInstanceOf($list, Typed::class); $is_numeric = is_numeric($value); - $is_valid_date = RecordHelper::validateDate($value); + $is_valid_date = (RecordHelper::sanitizeDate($value) !== null); $filtered = []; foreach ($list as $item) { switch ($item->getType()) { diff --git a/lib/Alchemy/Phrasea/TaskManager/Job/WriteMetadataJob.php b/lib/Alchemy/Phrasea/TaskManager/Job/WriteMetadataJob.php index f35b8e806e..795b0b2a83 100644 --- a/lib/Alchemy/Phrasea/TaskManager/Job/WriteMetadataJob.php +++ b/lib/Alchemy/Phrasea/TaskManager/Job/WriteMetadataJob.php @@ -127,7 +127,10 @@ class WriteMetadataJob extends AbstractJob // check exiftool known tags to skip Phraseanet:tf-* try { - TagFactory::getFromRDFTagname($tagName); + $tag = TagFactory::getFromRDFTagname($tagName); + if(!$tag->isWritable()) { + continue; + } } catch (TagUnknown $e) { continue; } @@ -147,21 +150,34 @@ class WriteMetadataJob extends AbstractJob $fieldValue = array_pop($fieldValues); $value = $this->removeNulChar($fieldValue->getValue()); - $value = new Value\Mono($value); + // fix the dates edited into phraseanet + if($fieldStructure->get_type() === $fieldStructure::TYPE_DATE) { + try { + $value = self::fixDate($value); // will return NULL if the date is not valid + } + catch (\Exception $e) { + $value = null; // do NOT write back to iptc + } + } + + if($value !== null) { // do not write invalid dates + $value = new Value\Mono($value); + } } - } catch(\Exception $e) { + } catch (\Exception $e) { // the field is not set in the record, erase it if ($fieldStructure->is_multi()) { $value = new Value\Multi(array('')); - } - else { + } else { $value = new Value\Mono(''); } } - $metadata->add( - new Metadata\Metadata($fieldStructure->get_tag(), $value) - ); + if($value !== null) { // do not write invalid data + $metadata->add( + new Metadata\Metadata($fieldStructure->get_tag(), $value) + ); + } } $writer = $this->getMetadataWriter($jobData->getApplication()); @@ -220,4 +236,34 @@ class WriteMetadataJob extends AbstractJob { return str_replace("\0", "", $value); } + + /** + * re-format a phraseanet date for iptc writing + * return NULL if the date is not valid + * + * @param string $value + * @return string|null + */ + private static function fixDate($value) + { + $date = null; + try { + $a = explode(';', preg_replace('/\D+/', ';', trim($value))); + switch (count($a)) { + case 3: // yyyy;mm;dd + $date = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2]); + $date = $date->format('Y-m-d H:i:s'); + break; + case 6: // yyyy;mm;dd;hh;mm;ss + $date = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':' . $a[4] . ':' . $a[5]); + $date = $date->format('Y-m-d H:i:s'); + break; + } + } + catch (\Exception $e) { + $date = null; + } + + return $date; + } } diff --git a/tests/Alchemy/Tests/Phrasea/SearchEngine/AST/RangeExpressionTest.php b/tests/Alchemy/Tests/Phrasea/SearchEngine/AST/RangeExpressionTest.php index 88a850fe03..d1d376e37b 100644 --- a/tests/Alchemy/Tests/Phrasea/SearchEngine/AST/RangeExpressionTest.php +++ b/tests/Alchemy/Tests/Phrasea/SearchEngine/AST/RangeExpressionTest.php @@ -58,6 +58,7 @@ class RangeExpressionTest extends \PHPUnit_Framework_TestCase { $query_context = $this->prophesize(QueryContext::class)->reveal(); $key_prophecy = $this->prophesize(Key::class); + $key_prophecy->getFieldType($query_context)->willReturn('text'); $key_prophecy->getIndexField($query_context)->willReturn('foo'); $key_prophecy->isValueCompatible('bar', $query_context)->willReturn(true); $key = $key_prophecy->reveal(); @@ -73,6 +74,7 @@ class RangeExpressionTest extends \PHPUnit_Framework_TestCase { $query_context = $this->prophesize(QueryContext::class)->reveal(); $key = $this->prophesize(FieldKey::class); + $key->getFieldType($query_context)->willReturn('text'); $key->getIndexField($query_context)->willReturn('baz'); $key->isValueCompatible('bar', $query_context)->willReturn(true); $key->postProcessQuery(Argument::any(), $query_context)->willReturnArgument(0); diff --git a/tests/Alchemy/Tests/Phrasea/SearchEngine/resources/queries.csv b/tests/Alchemy/Tests/Phrasea/SearchEngine/resources/queries.csv index 9f7d079880..5252788eaa 100644 --- a/tests/Alchemy/Tests/Phrasea/SearchEngine/resources/queries.csv +++ b/tests/Alchemy/Tests/Phrasea/SearchEngine/resources/queries.csv @@ -53,6 +53,7 @@ foo < 42| foo ≤ 42| foo > 42| foo ≥ 42| +foo = 2015/01/01|( == ) foo < 2015/01/01| foo ≤ 2015/01/01| foo > 2015/01/01| @@ -93,19 +94,93 @@ id:90 AND foo|( AND ) id:90 foo|( AND ) recordid:90| -# Timestamps -created_on < "2015/01/01"| -created_on ≤ "2015/01/01"| -created_on = "2015/01/01"| -created_on ≥ "2015/01/01"| -created_on > "2015/01/01"| -updated_on < "2015/01/01"| -updated_on ≤ "2015/01/01"| -updated_on = "2015/01/01"| -updated_on ≥ "2015/01/01"| -updated_on > "2015/01/01"| -created_at > "2015/01/01"| -updated_at > "2015/01/01"| +# Timestamps yyyy +created_on < "2015"| +created_on ≤ "2015"| +created_on = "2015"| +created_on ≥ "2015"| +created_on > "2015"| +updated_on < "2015"| +updated_on ≤ "2015"| +updated_on = "2015"| +updated_on ≥ "2015"| +updated_on > "2015"| +created_at > "2015"| +updated_at > "2015"| + +# Timestamps yyyy/mm +created_on < "2015/01"| +created_on ≤ "2015/01"| +created_on = "2015/01"| +created_on ≥ "2015/01"| +created_on > "2015/01"| +updated_on < "2015/01"| +updated_on ≤ "2015/01"| +updated_on = "2015/01"| +updated_on ≥ "2015/01"| +updated_on > "2015/01"| +created_at > "2015/01"| +updated_at > "2015/01"| + +# Timestamps yyyy/mm/dd +created_on < "2015/01/01"| +created_on ≤ "2015/01/01"| +created_on = "2015/01/01"| +created_on ≥ "2015/01/01"| +created_on > "2015/01/01"| +updated_on < "2015/01/01"| +updated_on ≤ "2015/01/01"| +updated_on = "2015/01/01"| +updated_on ≥ "2015/01/01"| +updated_on > "2015/01/01"| +created_at > "2015/01/01"| +updated_at > "2015/01/01"| + +# Timestamps yyyy/mm/dd hh +created_on < "2015/01/01 12"| +created_on ≤ "2015/01/01 12"| +created_on = "2015/01/01 12"| +created_on ≥ "2015/01/01 12"| +created_on > "2015/01/01 12"| +updated_on < "2015/01/01 12"| +updated_on ≤ "2015/01/01 12"| +updated_on = "2015/01/01 12"| +updated_on ≥ "2015/01/01 12"| +updated_on > "2015/01/01 12"| +created_at > "2015/01/01 12"| +updated_at > "2015/01/01 12"| + +# Timestamps yyyy/mm/dd hh:mm +created_on < "2015/01/01 12.34"| +created_on ≤ "2015/01/01 12.34"| +created_on = "2015/01/01 12.34"| +created_on ≥ "2015/01/01 12.34"| +created_on > "2015/01/01 12.34"| +updated_on < "2015/01/01 12.34"| +updated_on ≤ "2015/01/01 12.34"| +updated_on = "2015/01/01 12.34"| +updated_on ≥ "2015/01/01 12.34"| +updated_on > "2015/01/01 12.34"| +created_at > "2015/01/01 12.34"| +updated_at > "2015/01/01 12.34"| + +# Timestamps yyyy/mm/dd hh.mm.ss +created_on < "2015/01/01 12.34.56"| +created_on ≤ "2015/01/01 12.34.56"| +created_on = "2015/01/01 12.34.56"|( == ) +created_on ≥ "2015/01/01 12.34.56"| +created_on > "2015/01/01 12.34.56"| +updated_on < "2015/01/01 12.34.56"| +updated_on ≤ "2015/01/01 12.34.56"| +updated_on = "2015/01/01 12.34.56"|( == ) +updated_on ≥ "2015/01/01 12.34.56"| +updated_on > "2015/01/01 12.34.56"| +created_at > "2015/01/01 12.34.56"| +updated_at > "2015/01/01 12.34.56"| + +# timestamps missing zeros +created_on = "2015/1/2 1.3.5"|( == ) + # Flag matcher flag.foo:true| From bd53e98b0d8b1529197adb90fb1e55e3dc749829 Mon Sep 17 00:00:00 2001 From: aynsix Date: Thu, 15 Aug 2019 16:09:35 +0400 Subject: [PATCH 29/48] port to 4.1 fix ES index NUL --- .../Elastic/Indexer/BulkOperation.php | 9 ++-- .../Record/Hydrator/MetadataHydrator.php | 52 ++++--------------- .../Indexer/Record/Hydrator/TitleHydrator.php | 45 +++++++++------- .../SearchEngine/Elastic/RecordHelper.php | 27 ++++++++++ 4 files changed, 67 insertions(+), 66 deletions(-) diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/BulkOperation.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/BulkOperation.php index 6ea641492d..b8c834d9f0 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/BulkOperation.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/BulkOperation.php @@ -155,15 +155,16 @@ class BulkOperation // nb: results (items) are returned IN THE SAME ORDER as commands were pushed in the stack // so the items[X] match the operationIdentifiers[X] foreach ($response['items'] as $key => $item) { - foreach($item as $command=>$result) { // command may be "index" or "delete" - if($response['errors'] && $result['status'] >= 400) { // 4xx or 5xx error - throw new Exception(sprintf('%d: %s', $key, var_export($result, true))); + foreach ($item as $command=>$result) { // command may be "index" or "delete" + if ($response['errors'] && $result['status'] >= 400) { // 4xx or 5xx + $err = array_key_exists('error', $result) ? var_export($result['error'], true) : ($command . " error " . $result['status']); + throw new Exception(sprintf('%d: %s', $key, $err)); } } $operationIdentifier = $this->operationIdentifiers[$key]; - if(is_string($operationIdentifier) || is_int($operationIdentifier)) { // dont include null keys + if (is_string($operationIdentifier) || is_int($operationIdentifier)) { // dont include null keys $callbackData[$operationIdentifier] = $response['items'][$key]; } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/MetadataHydrator.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/MetadataHydrator.php index 32b93502d4..5dc2471cb9 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/MetadataHydrator.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/MetadataHydrator.php @@ -39,18 +39,13 @@ class MetadataHydrator implements HydratorInterface public function hydrateRecords(array &$records) { - $sql = <<connection->executeQuery( @@ -62,7 +57,7 @@ SQL; while ($metadata = $statement->fetch()) { // Store metadata value $key = $metadata['key']; - $value = $metadata['value']; + $value = trim($metadata['value']); // Do not keep empty values if ($key === '' || $value === '') { @@ -80,7 +75,7 @@ SQL; case 'caption': // Sanitize fields $value = StringHelper::crlfNormalize($value); - $value = $this->sanitizeValue($value, $this->structure->typeOf($key)); + $value = $this->helper->sanitizeValue($value, $this->structure->typeOf($key)); // Private caption fields are kept apart $type = $metadata['private'] ? 'private_caption' : 'caption'; // Caption are multi-valued @@ -103,7 +98,7 @@ SQL; } $tag = $this->structure->getMetadataTagByName($key); if ($tag) { - $value = $this->sanitizeValue($value, $tag->getType()); + $value = $this->helper->sanitizeValue($value, $tag->getType()); } // EXIF data is single-valued $record['metadata_tags'][$key] = $value; @@ -118,33 +113,6 @@ SQL; $this->clearGpsPositionBuffer(); } - private function sanitizeValue($value, $type) - { - switch ($type) { - case FieldMapping::TYPE_STRING: - return str_replace("\0", "", $value); - - case FieldMapping::TYPE_DATE: - return $this->helper->sanitizeDate($value); - - case FieldMapping::TYPE_FLOAT: - case FieldMapping::TYPE_DOUBLE: - return (float) $value; - - case FieldMapping::TYPE_INTEGER: - case FieldMapping::TYPE_LONG: - case FieldMapping::TYPE_SHORT: - case FieldMapping::TYPE_BYTE: - return (int) $value; - - case FieldMapping::TYPE_BOOLEAN: - return (bool) $value; - - default: - return $value; - } - } - private function handleGpsPosition(&$records, $id, $tag_name, $value) { // Get position object diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/TitleHydrator.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/TitleHydrator.php index 88382aa7a7..76dc4704b4 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/TitleHydrator.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/TitleHydrator.php @@ -11,6 +11,8 @@ namespace Alchemy\Phrasea\SearchEngine\Elastic\Indexer\Record\Hydrator; +use Alchemy\Phrasea\SearchEngine\Elastic\FieldMapping; +use Alchemy\Phrasea\SearchEngine\Elastic\RecordHelper; use Doctrine\DBAL\Connection; use Doctrine\DBAL\Driver\Connection as DriverConnection; @@ -18,31 +20,34 @@ class TitleHydrator implements HydratorInterface { private $connection; - public function __construct(DriverConnection $connection) + /** @var RecordHelper */ + private $helper; + + public function __construct(DriverConnection $connection, RecordHelper $helper) { $this->connection = $connection; + $this->helper = $helper; } public function hydrateRecords(array &$records) { - $sql = <<connection->executeQuery( $sql, array(array_keys($records)), @@ -50,7 +55,7 @@ SQL; ); while ($row = $statement->fetch()) { - $records[$row['record_id']]['title'][$row['locale']] = $row['title']; + $records[$row['record_id']]['title'][$row['locale']] = $this->helper->sanitizeValue($row['title'], FieldMapping::TYPE_STRING); } } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/RecordHelper.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/RecordHelper.php index ffb0c71adf..5debeff82e 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/RecordHelper.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/RecordHelper.php @@ -116,4 +116,31 @@ class RecordHelper return null; } } + + public function sanitizeValue($value, $type) + { + switch ($type) { + case FieldMapping::TYPE_DATE: + return self::sanitizeDate($value); + + case FieldMapping::TYPE_FLOAT: + case FieldMapping::TYPE_DOUBLE: + return (float) $value; + + case FieldMapping::TYPE_INTEGER: + case FieldMapping::TYPE_LONG: + case FieldMapping::TYPE_SHORT: + case FieldMapping::TYPE_BYTE: + return (int) $value; + + case FieldMapping::TYPE_BOOLEAN: + return (bool) $value; + + case FieldMapping::TYPE_STRING: + return str_replace("\0", '', $value); + + default: + return $value; + } + } } From 640cfc969fc51404f001d257968dbc74ef3029e5 Mon Sep 17 00:00:00 2001 From: aynsix Date: Fri, 16 Aug 2019 14:57:48 +0400 Subject: [PATCH 30/48] fix circleci unable to run the job runner --- .circleci/config.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 28843588b3..ce2f8c9a5c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ jobs: CIRCLE_TEST_REPORTS: /tmp/circleci-test-results docker: - image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37 - command: /sbin/init + - image: circleci/rabbitmq:3.7.7 steps: - checkout - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS @@ -24,10 +24,7 @@ jobs: command: nvm install v10.12.0 && nvm alias default v10.12.0 - run: working_directory: ~/alchemy-fr/Phraseanet - command: 'sudo service memcached status || sudo service memcached start; sudo - redis-cli ping >/dev/null 2>&1 || sudo service redis-server start; sudo - service mysql status || sudo service mysql start; sudo service rabbitmq-server - status || sudo service rabbitmq-server start; ' + command: 'sudo service mysql status || sudo service mysql start;' # Dependencies # This would typically go in either a build or a build-and-test job when using workflows # Restore the dependency cache From 80dcf98e1f34abbabce54b470845319deaf7051e Mon Sep 17 00:00:00 2001 From: aynsix Date: Mon, 19 Aug 2019 15:24:04 +0400 Subject: [PATCH 31/48] fix basket browser windows nok --- templates/web/prod/WorkZone/Browser/Results.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/web/prod/WorkZone/Browser/Results.html.twig b/templates/web/prod/WorkZone/Browser/Results.html.twig index 47ba7802dd..71c0cc038a 100644 --- a/templates/web/prod/WorkZone/Browser/Results.html.twig +++ b/templates/web/prod/WorkZone/Browser/Results.html.twig @@ -69,7 +69,7 @@ {% 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 %} From 7b6d322d21ac4156596d3f6d4dfdcc18623e160d Mon Sep 17 00:00:00 2001 From: tomamplius Date: Tue, 20 Aug 2019 11:29:35 +0200 Subject: [PATCH 32/48] Update databox.php --- lib/classes/cache/databox.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/classes/cache/databox.php b/lib/classes/cache/databox.php index 75460fa962..3687deb211 100644 --- a/lib/classes/cache/databox.php +++ b/lib/classes/cache/databox.php @@ -121,9 +121,9 @@ class cache_databox $conn = $app->getApplicationBox()->get_connection(); - $sql = 'UPDATE sitepreff SET memcached_update = :date'; + $sql = 'UPDATE sitepreff SET memcached_update = current_timestamp()'; $stmt = $conn->prepare($sql); - $stmt->execute([':date' => $now]); + $stmt->execute(); $stmt->closeCursor(); self::$refreshing = false; From 645ae0e7779839d71a3e4993d8bbcabd3c7541c3 Mon Sep 17 00:00:00 2001 From: aynsix Date: Wed, 28 Aug 2019 16:41:34 +0400 Subject: [PATCH 33/48] fix api: remove temporary file when upload --- .../Phrasea/Controller/Api/V1Controller.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php index 54c246a897..d8c085fb62 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(); } From b64f677c47f43e88c5a70fc6cb8fe27256b27b05 Mon Sep 17 00:00:00 2001 From: aynsix Date: Mon, 2 Sep 2019 17:30:34 +0400 Subject: [PATCH 34/48] embed-bundle on version 2.0.7 --- composer.json | 2 +- composer.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index ca14bb88f0..47635b0e47 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,7 @@ "php": ">=5.5.9", "ext-intl": "*", "alchemy-fr/tcpdf-clone": "~6.0", - "alchemy/embed-bundle": "^2.0.6", + "alchemy/embed-bundle": "^2.0.7", "alchemy/geonames-api-consumer": "~0.1.0", "alchemy/mediavorus": "^0.4.4", "alchemy/oauth2php": "1.1.0", diff --git a/composer.lock b/composer.lock index 5721974b41..3794bfe80c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "64830cb4d53b32b47e02d4a19df9cef2", + "content-hash": "f3b1fc0a30bf14b05e57ce673550d9c0", "packages": [ { "name": "alchemy-fr/tcpdf-clone", @@ -131,16 +131,16 @@ }, { "name": "alchemy/embed-bundle", - "version": "2.0.6", + "version": "2.0.7", "source": { "type": "git", "url": "https://github.com/alchemy-fr/embed-bundle.git", - "reference": "53ba295dfd0554a31c35e93902a5ef6cb8eca31a" + "reference": "c585ccf18e53a9a6f2b696ddbbc39521732dfdde" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/alchemy-fr/embed-bundle/zipball/53ba295dfd0554a31c35e93902a5ef6cb8eca31a", - "reference": "53ba295dfd0554a31c35e93902a5ef6cb8eca31a", + "url": "https://api.github.com/repos/alchemy-fr/embed-bundle/zipball/c585ccf18e53a9a6f2b696ddbbc39521732dfdde", + "reference": "c585ccf18e53a9a6f2b696ddbbc39521732dfdde", "shasum": "" }, "require-dev": { @@ -178,10 +178,10 @@ ], "description": "Embed resources bundle", "support": { - "source": "https://github.com/alchemy-fr/embed-bundle/tree/2.0.6", + "source": "https://github.com/alchemy-fr/embed-bundle/tree/2.0.7", "issues": "https://github.com/alchemy-fr/embed-bundle/issues" }, - "time": "2019-07-11T12:59:49+00:00" + "time": "2019-09-02T12:28:19+00:00" }, { "name": "alchemy/geonames-api-consumer", @@ -443,8 +443,8 @@ }, { "name": "Benoit Burnichon", - "email": "bburnichon@alchemy.fr", - "role": "Lead Developer" + "role": "Lead Developer", + "email": "bburnichon@alchemy.fr" } ], "description": "Exiftool driver for PHP", From 53272de3f5e8bea2bd3877a48b122daf8d31dbd8 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Tue, 3 Sep 2019 18:07:36 +0200 Subject: [PATCH 35/48] PHRAS-2726_setstatus-api_4.1 : port of PHRAS-2716 setstatus api did change unspecified bits due to string offset error --- lib/Alchemy/Phrasea/Controller/Api/V1Controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php index 54c246a897..5bb3e10614 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php +++ b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php @@ -1984,7 +1984,7 @@ class V1Controller extends Controller return $this->getBadRequestAction($request); } - $datas = substr($datas, 0, ($n)) . $value . substr($datas, ($n + 2)); + $datas = substr($datas, 0, ($n)) . $value . substr($datas, ($n + 1)); } $record->setStatus(strrev($datas)); From fe087a9dc5d6ed4ff97e428eb6eb8f524f1b7d09 Mon Sep 17 00:00:00 2001 From: aynsix Date: Wed, 4 Sep 2019 12:09:53 +0400 Subject: [PATCH 36/48] fix user creation from push and feedback window --- .../Phrasea/Controller/Prod/PushController.php | 11 ++++++++--- templates/web/admin/editusers.html.twig | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) 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/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 }} - + From 16d14462686b053a253cd8efdd971221648cde14 Mon Sep 17 00:00:00 2001 From: aynsix Date: Thu, 5 Sep 2019 18:15:07 +0400 Subject: [PATCH 37/48] fix unit test setstatus --- .../Phrasea/Controller/Api/ApiJsonTest.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php index d78194c4d7..10737230f8 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php @@ -1301,6 +1301,27 @@ class ApiJsonTest extends ApiTestCase $this->assertEquals(substr($record_status, ($n), 1), $tochange[$n]); } + // test record_status in string + $record_status_expected = $record_status; + unset($tochange); + + $pos = strpos($record_status, '1'); + $tochange[$pos] = '1'; + + $response = $this->request('POST', $route, $this->getParameters(['status' => $tochange]), ['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); + $record1->setStatus(str_repeat('0', 32)); } From 4d4e5368b1c1c107397d5936ce36c1d113068e54 Mon Sep 17 00:00:00 2001 From: aynsix Date: Fri, 6 Sep 2019 11:14:20 +0400 Subject: [PATCH 38/48] fix --- tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php index 10737230f8..a9f974abc9 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php @@ -1305,6 +1305,7 @@ class ApiJsonTest extends ApiTestCase $record_status_expected = $record_status; unset($tochange); + $tochange = []; $pos = strpos($record_status, '1'); $tochange[$pos] = '1'; From 432eb7c2554d3c2d3391c56986fe496485e25d84 Mon Sep 17 00:00:00 2001 From: aynsix Date: Fri, 6 Sep 2019 12:26:11 +0400 Subject: [PATCH 39/48] fix unit test setstatus --- .../Phrasea/Controller/Api/ApiJsonTest.php | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php index a9f974abc9..bad05dccc7 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php @@ -1281,6 +1281,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,28 +1322,6 @@ class ApiJsonTest extends ApiTestCase $this->assertEquals(substr($record_status, ($n), 1), $tochange[$n]); } - // test record_status in string - $record_status_expected = $record_status; - unset($tochange); - - $tochange = []; - $pos = strpos($record_status, '1'); - $tochange[$pos] = '1'; - - $response = $this->request('POST', $route, $this->getParameters(['status' => $tochange]), ['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); - $record1->setStatus(str_repeat('0', 32)); } From 418b86c0ba3dc67f856f16bcff3af860a8f7903e Mon Sep 17 00:00:00 2001 From: aynsix Date: Fri, 6 Sep 2019 16:20:17 +0400 Subject: [PATCH 40/48] initialize status structure for test --- .../Phrasea/Controller/Api/ApiJsonTest.php | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiJsonTest.php index bad05dccc7..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()]); @@ -1322,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)); } From 02126193142d6b2314a910297910db5299a02a67 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 10 Sep 2019 14:03:51 +0400 Subject: [PATCH 41/48] PHRAS-2282 #comment upgrade phraseanet-production-client@0.34.63-d #time 2h --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index d93ac787a6..db6d50a49b 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.63-d", "requirejs": "^2.3.5", "tinymce": "^4.0.28", "underscore": "^1.8.3", diff --git a/yarn.lock b/yarn.lock index c469bd7d52..471f86bfba 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.63-d: + version "0.34.63-d" + resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.63-d.tgz#0b74aa2188002effedd143d4c16364007daad672" + integrity sha512-kjySO4v4KALrr7UC/6WacSn/2s4pEaiY98iqejoK2rkzZEsuVOUKyuifxfTaX4xkFSfSwf5F0RA2n43JJbDGHA== dependencies: "@mapbox/mapbox-gl-language" "^0.9.2" "@turf/turf" "^5.1.6" From a1ce905c730cd1d5113b50440983f93cbd20aec1 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Thu, 12 Sep 2019 17:31:01 +0400 Subject: [PATCH 42/48] PHRAS-2282 #comment Add fix #time 3h --- .../www/prod/images/Basket/Browser/archive.png | Bin 682 -> 1756 bytes .../prod/images/Basket/Browser/archived.png | Bin 802 -> 1694 bytes .../prod/WorkZone/Browser/Results.html.twig | 10 +++------- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/resources/www/prod/images/Basket/Browser/archive.png b/resources/www/prod/images/Basket/Browser/archive.png index f7373f9614bb55930cf69743f28ed9193e83aa2c..6015eafc48cb8560f4191eee8397bb7e0ef755b9 100644 GIT binary patch literal 1756 zcmV<21|#{2P)Px*mPtfGR9FeES8qt2RTw|_kGrO06D6CiFISW>om;pmnmV_M6a<1y`_$ZETT#rh z52Jl35CSQJXwrxBOKVAxi2Gnr6OEkz1hh%!HjrGd^hSN^-+e!s{2ynElfd+#>b z1JC>XInQ~{bIy6rbIxnbLvTH0!QHxbE7;uJ93+M4a`Qur8#iu{5Ij@{S65dD&YwRo z8hirE(Ao=h_@y8Ue&XPK9n{Rt%@w=H$H)Jm(AU>z_U_%=OFo{%heFsz1%ab_$f##m zeSN*Jy1M#5DhZpLn_unUzyCe3K^bvuZ0r}0$5S>mG-L(`2hF~H`^?d!N5wchJ6k4V za&vR5soA}Ix8a2D-@h*gYinzLU|iO45T2tQa0iex{s*`M+)^X(0(O}TX$9@Ref#!i zFevefCF0<61tefJ2JDSufe(#n8GosSDdBjfk`rICE7 zk!+ldLyk~eTWgY%lD38IZ-5>)G1l{x?Trl$4cSnw>a^&I8TErlzL0twLY7+kF^`xdAZ_D9OPnc3?vmT`m_F zM1Y;cp{S_H96EH!Qe&l=Ob;{?*V59`=TpctjHV z`}-S_&$S_gm;_P000XA-I-L+m8I=#1*x1;Zf9%+?AHh2S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$F^?F@HtyTj`k~9oH zdtb&0>TNqu$mDO|^JS%loF!1js8p*k^g8mh<7C7{ADaYB6I9T*Bf{KBWD zwbE~dgAhYShk9JveYH6m1wL4h9-5-KLT+1fsJAR4(H|Q7#3xgWkX~3K^Mtl;VJzaq zZg}%~GPP%7DorxjZ_Z#=A#OT$_`vnda{dC%`0PI!Z!UNTo=_xlYVNCel?oKm{}ih{ g>E!pi75)k^0K4h~W746!4gdfE07*qoM6N<$f^SQ2Q2+n{ diff --git a/templates/web/prod/WorkZone/Browser/Results.html.twig b/templates/web/prod/WorkZone/Browser/Results.html.twig index c6f43ee5a8..711b90b73c 100644 --- a/templates/web/prod/WorkZone/Browser/Results.html.twig +++ b/templates/web/prod/WorkZone/Browser/Results.html.twig @@ -14,7 +14,7 @@
{% for Basket in Baskets %} -
+
×
@@ -31,14 +31,10 @@ {% if Basket.getValidation() is empty or Basket.getValidation().isInitiator(app.getAuthenticatedUser()) %} - - - +   - - - +   {% endif %} From de46a85bce1cd83193b3f0c8be16b75a432ccb06 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Mon, 16 Sep 2019 17:58:39 +0400 Subject: [PATCH 43/48] PHRAS-2661 #comment fix menu bar: help menu #time 3h --- templates/web/common/menubar.html.twig | 161 ++++++++++++------------- 1 file changed, 80 insertions(+), 81 deletions(-) diff --git a/templates/web/common/menubar.html.twig b/templates/web/common/menubar.html.twig index 84ab930e7d..8c6f23d7fc 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 }} - -
+ +
From be9220969b037723c108d57441294f4a16b6f995 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 17 Sep 2019 13:34:06 +0400 Subject: [PATCH 44/48] PHRAS-2282 #time 4h --- .../prod/WorkZone/Browser/Browser.html.twig | 18 +++++++++ .../prod/WorkZone/Browser/Results.html.twig | 39 +++++-------------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/templates/web/prod/WorkZone/Browser/Browser.html.twig b/templates/web/prod/WorkZone/Browser/Browser.html.twig index 91ca5054c5..0f40cff488 100644 --- a/templates/web/prod/WorkZone/Browser/Browser.html.twig +++ b/templates/web/prod/WorkZone/Browser/Browser.html.twig @@ -102,4 +102,22 @@ transform: translate(-50%, -50%); } + diff --git a/templates/web/prod/WorkZone/Browser/Results.html.twig b/templates/web/prod/WorkZone/Browser/Results.html.twig index 711b90b73c..4f390a821f 100644 --- a/templates/web/prod/WorkZone/Browser/Results.html.twig +++ b/templates/web/prod/WorkZone/Browser/Results.html.twig @@ -15,18 +15,17 @@
{% for Basket in Baskets %}
- × +  
- - - - - + - -
+
+ +
{% set BasketElement = Basket.getElements().first() %} {% if BasketElement %} {{thumbnail.format(BasketElement.getRecord(app).get_thumbnail(), 150, 106, '', true, false)}} {% endif %} -
  + +

{% if Basket.getValidation() is empty or Basket.getValidation().isInitiator(app.getAuthenticatedUser()) %} @@ -38,7 +37,7 @@ {% endif %} - {{ Basket.getName() }} + {{ Basket.getName() }}
{{ Basket.getElements().count() }} {{ ' records' }}
@@ -70,12 +69,11 @@

{% endif %} -

+
{% endfor %} @@ -111,21 +109,4 @@
- + From a66c813835afe0032c55d7c79c5828781c5bb388 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 17 Sep 2019 14:15:27 +0400 Subject: [PATCH 45/48] PHRAS-2282 change icon --- .../prod/images/Basket/Browser/archive.png | Bin 1756 -> 1694 bytes .../prod/images/Basket/Browser/archived.png | Bin 1694 -> 1756 bytes .../prod/WorkZone/Browser/Results.html.twig | 8 ++------ 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/resources/www/prod/images/Basket/Browser/archive.png b/resources/www/prod/images/Basket/Browser/archive.png index 6015eafc48cb8560f4191eee8397bb7e0ef755b9..ab89643a3538605c68436ef9056dd71cfda6cd17 100644 GIT binary patch delta 1664 zcmV-`27me74W12?tI_O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WgZJM;Sw5aWDdrS}pH|uX92Qnsk zt^$FXD~W@@uuDgd9O)Nrgn!S%!h)Hdoi*5NgA-u#^Yg_D`)>I9VB7rsyxFs7PlVpv zs-B*n55QStQmZ+l+rt~j*VNRMUtC=L6JH-RdRD+kT5oUf8)wg+<&DK{;louf936;M z>IbL2ZwBd>PU&YWjx|`q+V^n zibG96?t3`O7KH57o;XxM2UXcl?QJ?>G|GMqA{MG|SpgN4+6PlzEc&$e5eJPl!2fy? VTmhu>B76V<002ovPDHLkV1n;CLtp>^ diff --git a/resources/www/prod/images/Basket/Browser/archived.png b/resources/www/prod/images/Basket/Browser/archived.png index ab89643a3538605c68436ef9056dd71cfda6cd17..6015eafc48cb8560f4191eee8397bb7e0ef755b9 100644 GIT binary patch delta 1727 zcmV;w20;0q4crZoF@KgxL_t(o39VOeNS##}KlhKjrehN&o2@TblrWuJxG9=Cw}})4 zf=v6=++bT#%&`xneJBtDDS~Lyhw@8nNsx&9U{Di{oc{&OsauFLKZvD)&NWy5yWW1k z$NRi{-@AM7HrNBt`}{f2dCqgrdCqgrYs^D%J!HY%x^*kq+<)90B!%d5^FxapH*Sy+ zJX8i(S62tlpFb}ed;-eQ+6#2}r63A^;^2H8)XdGz6}!jB$N!+v*VkwE?%mr=%#6Q#Ld-WCjNZ&Axs6 z%+aGq#W*`VTYn~Ea&vR5soA}Ix8a2D-@h*gYinzLU|iO45T2tQa0iex{s*`M+)^X( z0(O}TX$9@Ref#!iFevefCF0<61tefJ2JDSufe(#n8G zosSDdBjfk`rICE7k!+ldLyk~eTWgY%lD38IZ-5>)F@M(cl6x7&RfiMatW z4k*dND1UZfLl#{w7Z*f;ox`E1sK^{TbjVU;rI}0*G!oa+($eQvE0}ZV&WV_qxa~JC zF3#Z~WGl-cA1HW468ii58>Hrt&(S5J(x751824*qDFp*s&kMI{+1+ zKQAw@2FeFOZUEQiVQNDls53^!#3AZH+=rvZl+7Z>YFOG_ugGYW#`(C$P#e~HfTZreG(NP%EWOG^Su6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if %} From 20e918175cc3d6a42d863b5a7010911a3fee4327 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 17 Sep 2019 16:17:23 +0400 Subject: [PATCH 46/48] PHRAS-2661 --- resources/www/common/js/components/common.js | 6 +----- resources/www/common/styles/main.scss | 16 ++++++++++++++++ resources/www/report/styles/main.scss | 16 ++++++++++------ templates/web/common/menubar.html.twig | 4 ++++ 4 files changed, 31 insertions(+), 11 deletions(-) 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/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/common/menubar.html.twig b/templates/web/common/menubar.html.twig index 8c6f23d7fc..3821f42e79 100644 --- a/templates/web/common/menubar.html.twig +++ b/templates/web/common/menubar.html.twig @@ -300,6 +300,10 @@