diff --git a/.changes/unreleased/Feature-20240530-160003.yaml b/.changes/unreleased/Feature-20240530-160003.yaml
new file mode 100644
index 000000000..6b6baedc5
--- /dev/null
+++ b/.changes/unreleased/Feature-20240530-160003.yaml
@@ -0,0 +1,6 @@
+kind: Feature
+body: |
+ Upgrade import of address list to the last version of compiled addresses of belgian-best-address
+time: 2024-05-30T16:00:03.440767606+02:00
+custom:
+ Issue: ""
diff --git a/.changes/unreleased/Feature-20240531-190242.yaml b/.changes/unreleased/Feature-20240531-190242.yaml
new file mode 100644
index 000000000..083298a26
--- /dev/null
+++ b/.changes/unreleased/Feature-20240531-190242.yaml
@@ -0,0 +1,6 @@
+kind: Feature
+body: |
+ Upgrade CKEditor and refactor configuration with use of typescript
+time: 2024-05-31T19:02:42.776662753+02:00
+custom:
+ Issue: ""
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
index d58586b79..4a70e81e7 100644
--- a/.php-cs-fixer.dist.php
+++ b/.php-cs-fixer.dist.php
@@ -27,6 +27,7 @@ $config
->setRiskyAllowed(true)
->setCacheFile('.cache/php-cs-fixer.cache')
->setUsingCache(true)
+ ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
;
$rules = $config->getRules();
diff --git a/composer.json b/composer.json
index 142dd8e5f..6cda0e9d0 100644
--- a/composer.json
+++ b/composer.json
@@ -93,7 +93,7 @@
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": ">= 7.5",
- "rector/rector": "^1.0.0",
+ "rector/rector": "^1.1.0",
"symfony/debug-bundle": "^5.4",
"symfony/dotenv": "^5.4",
"symfony/maker-bundle": "^1.20",
@@ -151,6 +151,7 @@
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd"
- }
+ },
+ "php-cs-fixer": "php-cs-fixer fix --config=./.php-cs-fixer.dist.php --show-progress=none"
}
}
diff --git a/docs/source/installation/index.rst b/docs/source/installation/index.rst
index 67a0b6ec6..0328322e4 100644
--- a/docs/source/installation/index.rst
+++ b/docs/source/installation/index.rst
@@ -14,6 +14,352 @@
Installation & Usage
####################
+
+You will learn here how to install a new symfony project with chill, and configure it.
+
+Requirements
+============
+
+The installation is tested on a Debian-like linux distribution. The installation on other operating systems is not documented.
+
+You have to install the following tools on your computer:
+
+- `PHP `_, version 8.3+, with the following extensions: pdo_pgsql, intl, mbstring, zip, bcmath, exif, sockets, redis, ast, gd;
+- `composer `_;
+- `symfony cli `_;
+- `node, we encourage you to use nvm to configure the correct version `_. The project contains an
+ :code:`.nvmrc` file which selects automatically the required version of node (if present).
+- `yarn `_. We use the version 1.22+ for now.
+- `docker and the plugin compose `_ to run the database
+
+Chill needs a redis server and a postgresql database, and a few other things like a "relatorio service" which will
+generate documents from templates. **All these things are available through docker using the plugin compose**. We do not provide
+information on how to run this without docker compose.
+
+
+Install a new project
+=====================
+
+Initialize project and dependencies
+***********************************
+
+.. code-block:: bash
+
+ symfony new --version=5.4 my_chill_project
+ cd my_chill_project
+
+We strongly encourage you to initialize a git repository at this step, to track further changes.
+
+.. code-block:: bash
+
+ # add the flex endpoints required for custom recipes
+ cat <<< "$(jq '.extra.symfony += {"endpoint": ["flex://defaults", "https://gitlab.com/api/v4/projects/57371968/repository/files/index.json/raw?ref=main"]}' composer.json)" > composer.json
+ # install chill and some dependencies
+ # TODO fix the suffix "alpha1" and replace by ^3.0.0 when version 3.0.0 will be released
+ symfony composer require chill-project/chill-bundles v3.0.0-alpha1 champs-libres/wopi-lib dev-master@dev champs-libres/wopi-bundle dev-master@dev
+
+We encourage you to accept the inclusion of the "Docker configuration from recipes": this is the documented way to run the database.
+You must also accept to configure recipes from the contrib repository, unless you want to configure the bundles manually).
+
+.. code-block:: bash
+
+ # fix some configuration
+ ./post-install-chill.sh
+ # install node dependencies
+ yarn install
+ # and compile assets
+ yarn run encore production
+
+.. note::
+
+ If you encounter this error during assets compilation (:code:`yarn run encore production`) (repeated multiple times):
+
+ .. code-block:: txt
+
+ [tsl] ERROR in /tmp/chill/v1/public/bundles/chillcalendar/types.ts(2,65)
+ TS2307: Cannot find module '../../../ChillMainBundle/Resources/public/types' or its corresponding type declarations.
+
+ run:
+
+ .. code-block:: bash
+
+ rm -rf public/bundles/*
+
+ Then restart the compilation of assets (:code:```yarn run encore production```)
+
+Configure your project
+**********************
+
+You should read the configuration files in :code:`chill/config/packages` carefully, especially if you have
+custom developments. But most of the time, this should be fine.
+
+You have to configure some local variables, which are described in the :code:`.env` file. The secrets should not be stored
+in this :code:`.env` file, but instead using the `secrets management tool `_
+or in the :code:`.env.local` file, which should not be commited to the git repository.
+
+You do not need to set variables for the smtp server, redis server and relatorio server, as they are generated automatically
+by the symfony server, from the docker compose services.
+
+The only required variable is the :code:`ADMIN_PASSWORD`. You can generate a hashed and salted admin password using the command
+:code:`symfony console security:hash-password 'Symfony\Component\Security\Core\User\User'`. Then,
+you can either:
+
+- add this password to the :code:`.env.local` file, you must escape the character :code:`$`: if the generated password
+ is :code:`$2y$13$iyvJLuT4YEa6iWXyQV4/N.hNHpNG8kXlYDkkt5MkYy4FXcSwYAwmm`, your :code:`.env.local` file will be:
+
+ .. code-block:: env
+
+ ADMIN_PASSWORD=\$2y\$13\$iyvJLuT4YEa6iWXyQV4/N.hNHpNG8kXlYDkkt5MkYy4FXcSwYAwmm
+
+- add the generated password to the secrets manager (**note**: you must add the generated hashed password to the secrets env,
+ not the password in clear text).
+
+Prepare migrations and other tools
+**********************************
+
+To continue the installation process, you will have to run migrations:
+
+.. code-block:: bash
+
+ # start databases and other services
+ docker compose up -d
+ # the first start, it may last some seconds, you can check with docker compose ps
+ # run migrations
+ symfony console doctrine:migrations:migrate
+ # setup messenger
+ symfony console messenger:setup-transports
+ # prepare some views
+ symfony console chill:db:sync-views
+
+.. warning::
+
+ If you encounter an error while running :code:`symfony console messenger:setup-transports`, you can set up the messenger
+ transport to redis, by adding this in the :code:`.env.local` or :code:`.env` file:
+
+ .. code-block:: env
+
+ MESSENGER_TRANSPORT_DSN=redis://${REDIS_HOST}:${REDIS_PORT}/messages
+
+Start your web server locally
+*****************************
+
+At this step, Chill will be ready to be served locally, but without any configuration. You can run the project
+locally using the `local symfony server `_:
+
+.. code-block:: bash
+
+ # see the whole possibilities at https://symfony.com/doc/current/setup/symfony_server.html
+ symfony server:start -d
+
+
+If you need to test the instance with accounts and some basic configuration, please install the fixtures (see below).
+
+
+Add capabilities for dev
+========================
+
+If you need to add custom bundles, you can develop them in the `src/` directory, like for any other symfony project. You
+can rely on the whole chill framework, meaning there is no need to add them to the original `chill-bundles`.
+
+You will require some bundles to have the following development tools:
+
+- add fixtures
+- add profiler and var-dumper to debug
+
+Install fixtures
+****************
+
+.. code-block:: bash
+
+ # generate fixtures for chill
+ symfony composer require --dev doctrine/doctrine-fixtures-bundle nelmio/alice
+ # now, you can generate fixtures (this will reset your database)
+ symfony console doctrine:fixtures:load
+
+This will generate user accounts, centers, and some basic configuration.
+
+The accounts created are: :code:`center a_social`, :code:`center b_social`, :code:`center a_direction`, ... The full list is
+visibile in the "users" table: :code:`docker compose exec database psql -U app -c "SELECT username FROM users"`.
+
+The password is always :code:`password`.
+
+.. warning::
+
+ The fixtures are not fully functional. See the `corresponding issue `_.
+
+Add web profiler and debugger
+*****************************
+
+.. code-block:: bash
+
+ symfony composer require --dev symfony/web-profiler-bundle symfony/var-dumper
+
+Working on chill bundles
+************************
+
+If you plan to improve the chill-bundles repository, that's great!
+
+You will have to download chill-bundles as a git repository (and not as an archive, which is barely editable).
+
+In your :code:`composer.json` file, add these lines:
+
+.. code-block:: diff
+
+ {
+ "config": {
+ + "preferred-install": {
+ + "chill-project/chill-bundles": "source",
+ "*": "dist"
+ + }
+ }
+
+Then, run :code:`symfony composer reinstall chill-project/chill-bundles` to re-install the package from source.
+
+Code style, code quality and other tools
+****************************************
+
+For development, you will also have to install:
+
+- `php-cs-fixer `_
+
+We also encourage you to use tools like `phpstan `_ and `rector `_.
+
+Commit and share your project
+=============================
+
+If multiple developers work on a project, you can commit your symfony project and share it with other people.
+
+When another developer clones your project, they will have to:
+
+- run :code:`symfony composer install` and :code:`yarn install` to install the same dependencies as the initial developer;
+- run :code:`yarn run encore production` to compile assets;
+- copy any possible variables from the :code:`.env.local` files;
+- start the docker compose stack, using :code:`docker compose`, and run migrations, set up transports, and prepare chill db views
+ (see the corresponding command above)
+
+Update
+======
+
+In order to update your app, you must update dependencies:
+
+- for chill-bundles, you can `set the last version `_ manually
+ in the :code:`composer.json` file, or set the version to `^3.0.0` and run :code:`symfony composer update` regularly
+- run :code:`composer update` and :code:`yarn update` to maintain your dependencies up-to-date.
+
+After each update, you must update your database schema:
+
+.. code-block:: bash
+
+ symfony console doctrine:migrations:migrate
+ symfony console chill:db:sync-views
+
+Operations
+==========
+
+Build assets
+************
+
+run those commands:
+
+.. code-block:: bash
+
+ # for production (or in dev, when you don't need to work on your assets and need some speed)
+ yarn run encore production
+ # in dev, when you wan't to reload the assets on each changes
+ yarn run encore dev --watch
+
+How to execute the console ?
+****************************
+
+.. code-block:: bash
+
+ # start the console with all required variables
+ symfony console
+ # you can add your command after that:
+ symfony console list
+
+How to generate documents
+*************************
+
+Documents are generated asynchronously by `"consuming messages" `_.
+
+You must generate them using a dedicated process:
+
+.. code-block:: bash
+
+ symfony console messenger:consume async priority
+
+To avoid memory issues, we encourage you to also use the :code:`--limit` parameter of the command.
+
+How to read emails sent by the program ?
+*******************************************
+
+In development, there is a built-in "mail catcher". Open it with :code:`symfony open:local:webmail`
+
+How to run cron-jobs ?
+**********************
+
+Some commands must be executed in :ref:`cron jobs `. To execute them:
+
+.. code-block:: bash
+
+ symfony console chill:cron-job:execute
+
+What about materialized views ?
+*******************************
+
+There are some materialized views in chill, to speed up some complex computations in the database.
+
+In order to refresh them, run a cron job or refresh them manually in your database.
+
+How to run tests for chill-bundles
+**********************************
+
+Tests reside inside the installed bundles. You must `cd` into that directory, download the required packages, and execute them from this place.
+
+**Note**: some bundles require the fixtures to be executed. See the dedicated _how-tos_.
+
+Example, for running a unit test inside `main` bundle:
+
+.. code-block:: bash
+
+ # cd into main directory
+ cd vendor/chill-project/chill-bundles
+ composer install
+ # run tests
+ bin/phpunit src/Bundle/path/to/your/test
+
+Or for running tests to check code style and php conventions with csfixer and phpstan:
+
+Troubleshooting
+===============
+
+Error `An exception has been thrown during the rendering of a template ("Asset manifest file "/var/www/app/web/build/manifest.json" does not exist.").` on first run
+********************************************************************************************************************************************************************
+
+Build assets, see above.
+
+Running in production
+=====================
+
+Currently, to run this software in production, the *state of the art* is the following :
+
+1. Run the software locally and tweak the configuration to your needs ;
+2. Build the image and store it in a private container registry.
+
+.. warning::
+
+ In production, you **must** set these variables:
+
+ * ``APP_ENV`` to ``prod``
+ * ``APP_DEBUG`` to ``false``
+
+ There are security issues if you keep the same variables as for production.
+
+
+Going further
+=============
+
.. toctree::
:maxdepth: 2
@@ -21,386 +367,3 @@ Installation & Usage
load-addresses.rst
prod-calendar-sms-sending.rst
msgraph-configure.rst
-
-
-Requirements
-************
-
-- This project use `docker `_ to be run. As a developer, use `docker-compose `_ to bootstrap a dev environment in a glance. You do not need any other dependencies ;
-- Make is used to automate scripts.
-
-Installation
-************
-
-If you plan to run chill in production:
-
-1. install it locally first, and check if everything is ok on your local machine;
-2. once ready, build the image from your local machine, and deploy them.
-
-If you want to develop some bundles, the first step is sufficient (until you deploy on production).
-
-
-1. Get the code
-===============
-
-Clone or download the chill-skeleton project and `cd` into the main directory.
-
-
-.. code-block:: bash
-
- git clone https://gitea.champs-libres.be/Chill-project/chill-skeleton-basic.git
- cd chill-skeleton-basic
-
-
-As a developer, the code will stay on your computer and will be executed in docker container. To avoid permission problem, the code should be run with the same uid/gid from your current user. This is why we get your current user id with the command ``id -u`` in each following scripts.
-
-2. Prepare composer to download the sources
-===========================================
-
-As you are running in dev, you must configure an auth token for getting the source code.
-
-.. warning
-
- If you skip this part, the code will be downloaded from dist instead of source (with git repository). You will probably replace the source manually, but the next time you will run ```composer update```, your repository will be replaced and you might loose something.
-
-1. Create a personal access token from https://gitlab.com/-/profile/personal_access_tokens, with the `read_api` scope.
-2. add a file called ```.composer/auth.json``` with this content:
-
- .. code-block:: json
-
- {
- "gitlab-token": {
- "gitlab.com": "glXXX-XXXXXXXXXXXXXXXXXXXX"
- }
- }
-
-2. Prepare your variables and environment
-=========================================
-
-Copy ```docker-compose.override.dev.yml``` into ```docker-compose.override.yml```
-
-.. code-block:: bash
-
- cp docker-compose.override.dev.template.yml docker-compose.override.yml
-
-2. Prepare your variables and docker-compose
-============================================
-
-Have a look at the variable in ``.env`` and check if you need to adapt them. If they do not adapt with your need, or if some are missing:
-
-1. copy the file as ``.env.local``: ``cp .env .env.local``
-2. you may replace some variables inside ``.env``
-
-Prepare also you docker-compose installation, and adapt it to your needs:
-
-1. If you plan to deploy on dev, copy the file ``docker-compose.override.dev.template.yml`` to ``docker-compose.override.yml``.
-2. adapt to your needs.
-
-
-**Note**: If you intend to use the bundle ``Chill-Doc-Store``, you will need to configure and install an openstack object storage container with temporary url middleware. You will have to configure `secret keys `_.
-
-3. Run the bootstrap script
-===========================
-
-This script can be run using `make`
-
-.. code-block:: bash
-
- make init
-
-This script will :
-
-1. force docker-compose to, eventually, pull the base images and build the image used by this project ;
-2. run an install script to download `composer `_ ;
-3. install the php dependencies
-4. build assets
-
-.. warning::
-
- The script will work only if the binary ``docker-compose`` is located into your ``PATH``. If you use ``compose`` as a docker plugin,
- you can simulate this binary by creating this file at (for instance), ``/usr/local/bin/docker-compose`` (and run ``chmod +x /usr/local/bin/docker-compose``):
-
- .. code-block:: bash
-
- #!/bin/bash
-
- /usr/bin/docker compose "$@"
-
-
-.. note::
-
- In some cases it can happen that an old image (chill_base_php82 or chill_php82) stored in the docker cache will make the script fail. To solve this problem you have to delete the image and the container, before the make init :
-
- .. code-block:: bash
-
- docker-compose images php
- docker rmi -f chill_php82:prod
- docker-compose rm php
-
-
-4. Start the project
-====================
-
-.. code-block:: bash
-
- docker-compose up
-
-**On the first run** (and after each upgrade), you must execute *post update commands* and run database migrations. With a container up and running, execute the following commands:
-
-.. code-block:: bash
-
- # mount into to container
- ./docker-php.sh
- bin/console chill:db:sync-views
- # and load fixtures
- bin/console doctrine:migrations:migrate
-
-
-Chill will be available at ``http://localhost:8001.`` Currently, there isn't any user or data. To add fixtures, run
-
-.. code-block:: bash
-
- # mount into to container
- ./docker-php.sh
- # and load fixtures (do not this for production)
- bin/console doctrine:fixtures:load --purge-with-truncate
-
-There are several users available:
-
-- ``center a_social``
-- ``center b_social``
-
-The password is always ``password``.
-
-Now, read `Operations` below. For running in production, read `prod_`.
-
-
-Operations
-**********
-
-Build assets
-============
-
-run those commands:
-
-.. code-block:: bash
-
- make build-assets
-
-How to execute the console ?
-============================
-
-.. code-block:: bash
-
- # if a container is running
- ./docker-php.sh
- # if not
- docker-compose run --user $(id -u) php bin/console
-
-How to create the database schema (= run migrations) ?
-======================================================
-
-.. code-block:: bash
-
- # if a container is running
- ./docker-php.sh
- bin/console doctrine:migrations:migrate
- bin/console chill:db:sync-views
- # if not
- docker-compose run --user $(id -u) php bin/console doctrine:migrations:migrate
- docker-compose run --user $(id -u) php bin/console chill:db:sync-views
-
-
-How to read the email sent by the program ?
-===========================================
-
-Go at ``http://localhost:8005`` and you should have access to mailcatcher.
-
-In case of you should click on a link in the email, be aware that you should remove the "s" from https.
-
-How to load fixtures ? (development mode only)
-==============================================
-
-.. code-block:: bash
-
- # if a container is running
- ./docker-php.sh
- bin/console doctrine:fixtures:load
- # if not
- docker-compose run --user $(id -u) php bin/console doctrine:fixtures:load
-
-How to open a terminal in the project
-=====================================
-
-.. code-block:: bash
-
- # if a container is running
- ./docker-php.sh
- # if not
- docker-compose run --user $(id -u) php /bin/bash
-
-How to run cron-jobs ?
-======================
-
-Some command must be executed in :ref:`cron jobs `. To execute them:
-
-.. code-block:: bash
-
- # if a container is running
- ./docker-php.sh
- bin/console chill:cron-job:execute
- # some of them are executed only during the night. So, we have to force the execution during the day:
- bin/console chill:cron-job:execute 'name-of-the-cron'
- # if not
- docker-compose run --user $(id -u) php bin/console chill:cron-job:execute
- # some of them are executed only during the night. So, we have to force the execution during the day:
- docker-compose run --user $(id -u) php bin/console chill:cron-job:execute 'name-of-the-cron'
-
-How to run composer ?
-=====================
-
-.. code-block:: bash
-
- # if a container is running
- ./docker-php.sh
- composer
- # if not
- docker-compose run --user $(id -u) php composer
-
-How to access to PGADMIN ?
-==========================
-
-Pgadmin is installed with docker-compose, and is available **only if you uncomment the appropriate lines into ``docker-compose.override.yml``.
-
-You can access it at ``http://localhost:8002``.
-
-Credentials:
-
-- login: from the variable you set into ``docker-composer.override.yml``
-- password: same :-)
-
-How to run tests ?
-==================
-
-Tests reside inside the installed bundles. You must `cd` into that directory, download the required packages, and execute them from this place.
-
-**Note**: some bundle require the fixture to be executed. See the dedicated _how-tos_.
-
-Exemple, for running unit test inside `main` bundle:
-
-.. code-block:: bash
-
- # mount into the php image
- ./docker-php.sh
- # cd into main directory
- cd vendor/chill-project/chill-bundles
- # download deps
- git submodule init
- git submodule update
- composer install
- # run tests
- bin/phpunit src/Bundle/path/to/your/test
-
-Or for running tests to check code style and php conventions with csfixer and phpstan:
-
-.. code-block:: bash
-
- # run code style fixer
- bin/grumphp run --tasks=phpcsfixer
- # run phpstan
- bin/grumphp run --tasks=phpstan
-
-
-.. note::
-
- To avoid phpstan block your commits:
-
- .. code-block:: bash
-
- git commit -n ...
-
- To avoid phpstan block your commits permanently:
-
- .. code-block:: bash
-
- ./bin/grumphp git:deinit
-
-How to run webpack interactively
-================================
-
-Executing :code:`bash docker-node.sh` will open a terminal in a node container, with volumes mounted.
-
-How to switch the branch for chill-bundles, and get new dependencies
-====================================================================
-
-During development, you will switch to new branches for chill-bundles. As long as the dependencies are equals, this does not cause any problem. But sometimes, a new branch introduces a new dependency, and you must download it.
-
-.. warning::
-
- Ensure that you have gitlab-token ready before updating your branches. See above.
-
-In order to do that without pain, use those steps:
-
-0. Ensuire you have a token, set
-1. at the app's root, update the ``composer.json`` to your current branch:
-
-.. code-block:: json
-
- {
- "require": {
- "chill-bundles": "dev-@dev"
- }
-
-2. mount into the php container (``./docker-php.sh``), and run ``composer update``
-
-Error `An exception has been thrown during the rendering of a template ("Asset manifest file "/var/www/app/web/build/manifest.json" does not exist.").` on first run
-====================================================================================================================================================================
-
-Run :code:`make build-assets`
-
-Running in production
-*********************
-
-Currently, to run this software in production, the *state of the art* is the following :
-
-1. Run the software locally and tweak the configuration to your needs ;
-2. Build the image and store them into a private container registry. This can be done using :code:`make build-and-push-image`.
-
- To be sure to target the correct container registry, you have to adapt the image names into your ``docker-compose.override.yml`` file.
-3. Push the image on your registry, or upload them to the destination machine using ``docker image save`` and ``docker image load``.
-3. Run the image on your production server, using docker-compose or eventually docker stack. You have to customize the variable set in docker-compose.
-
- See also the :ref:`running-production-tips-and-tricks` below.
-
-.. warning::
-
- In production, you **must** set those variables:
-
- * ``APP_ENV`` to ``prod``
- * ``APP_DEBUG`` to ``false``
-
- There are security issues if you keep the same variable than for production.
-
-
-.. _running-production-tips-and-tricks:
-
-Tips and tricks
-===============
-
-Operation on database (backups, running custom sql, replication) are easier to set when run outside of a container. If you run into a container, take care of the volume where data are stored.
-
-The PHP sessions are stored inside redis. This is useful if you distribute the traffic amongst different php server: they will share same sessions if a request goes into a different instance of the container.
-
-When the PHP servers are shared across multiple instances, take care that some data is stored into redis: the same redis server should be reachable by all instances.
-
-It is worth having an eye on the configuration of logstash container.
-
-
-Design principles
-*****************
-
-Why the DB URL is also set in environment, and not in .env file ?
-=================================================================
-
-Because, at startup, a script does check the db is up and, if not, wait for a couple of seconds before running ``entrypoint.sh``. For avoiding double configuration, the configuration of the PHP app takes his configuration from environment also (and it will be standard in future releases, with symfony 4.0).
-
diff --git a/package.json b/package.json
index 1a83946b8..0244daedd 100644
--- a/package.json
+++ b/package.json
@@ -6,15 +6,16 @@
"@apidevtools/swagger-cli": "^4.0.4",
"@babel/core": "^7.20.5",
"@babel/preset-env": "^7.20.2",
- "@ckeditor/ckeditor5-build-classic": "^35.3.2",
- "@ckeditor/ckeditor5-dev-utils": "^31.1.13",
+ "@ckeditor/ckeditor5-build-classic": "^41.4.2",
+ "@ckeditor/ckeditor5-dev-utils": "^40.2.0",
"@ckeditor/ckeditor5-dev-webpack-plugin": "^31.1.13",
- "@ckeditor/ckeditor5-markdown-gfm": "^35.3.2",
- "@ckeditor/ckeditor5-theme-lark": "^35.3.2",
- "@ckeditor/ckeditor5-vue": "^4.0.1",
+ "@ckeditor/ckeditor5-dev-translations": "^40.2.0",
+ "@ckeditor/ckeditor5-markdown-gfm": "^41.4.2",
+ "@ckeditor/ckeditor5-theme-lark": "^41.4.2",
+ "@ckeditor/ckeditor5-vue": "^5.1.0",
"@symfony/webpack-encore": "^4.1.0",
"@tsconfig/node14": "^1.0.1",
- "@types/dompurify": "^3.0.5",
+ "@types/dompurify": "^3.0.5",
"bindings": "^1.5.0",
"bootstrap": "5.2.3",
"chokidar": "^3.5.1",
@@ -31,7 +32,7 @@
"select2-bootstrap-theme": "0.1.0-beta.10",
"style-loader": "^3.3.1",
"ts-loader": "^9.3.1",
- "typescript": "^4.7.2",
+ "typescript": "^5.4.5",
"vue-loader": "^17.0.0",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
diff --git a/phpstan-baseline-2024-05.neon b/phpstan-baseline-2024-05.neon
new file mode 100644
index 000000000..12cb03856
--- /dev/null
+++ b/phpstan-baseline-2024-05.neon
@@ -0,0 +1,14 @@
+parameters:
+ ignoreErrors:
+ -
+ message: "#^Parameter \\#1 \\$records of method League\\\\Csv\\\\Writer\\:\\:insertAll\\(\\) expects iterable\\\\>, iterable\\\\> given\\.$#"
+ count: 1
+ path: src/Bundle/ChillMainBundle/Controller/UserExportController.php
+
+ -
+ message: """
+ #^Fetching deprecated class constant ASC of class Doctrine\\\\Common\\\\Collections\\\\Criteria\\:
+ use Order\\:\\:Ascending instead$#
+ """
+ count: 1
+ path: src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
index e09bb5081..ec4045858 100644
--- a/phpstan.neon.dist
+++ b/phpstan.neon.dist
@@ -33,3 +33,5 @@ includes:
- phpstan-baseline-level-5.neon
- phpstan-deprecations-sf54.neon
- phpstan-baseline-deprecations-doctrine-orm.neon
+ - phpstan-baseline-2024-05.neon
+
diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php
index fbcf60bf0..9e2358e8b 100644
--- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php
+++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php
@@ -15,11 +15,10 @@ use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Entity\ActivityPresence;
use Chill\ActivityBundle\Form\Type\PickActivityReasonType;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
-use Chill\DocStoreBundle\Form\StoredObjectType;
+use Chill\DocStoreBundle\Form\CollectionStoredObjectType;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\User;
-use Chill\MainBundle\Form\Type\ChillCollectionType;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\CommentType;
use Chill\MainBundle\Form\Type\PickUserDynamicType;
@@ -276,16 +275,9 @@ class ActivityType extends AbstractType
}
if ($activityType->isVisible('documents')) {
- $builder->add('documents', ChillCollectionType::class, [
- 'entry_type' => StoredObjectType::class,
+ $builder->add('documents', CollectionStoredObjectType::class, [
'label' => $activityType->getLabel('documents'),
'required' => $activityType->isRequired('documents'),
- 'allow_add' => true,
- 'allow_delete' => true,
- 'button_add_label' => 'activity.Insert a document',
- 'button_remove_label' => 'activity.Remove a document',
- 'empty_collection_explain' => 'No documents',
- 'entry_options' => ['has_title' => true],
]);
}
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig
index a000b0c7e..d986f9150 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig
@@ -92,7 +92,9 @@
{% endif %}
{%- if edit_form.documents is defined -%}
- {{ form_row(edit_form.documents) }}
+ {{ form_label(edit_form.documents) }}
+ {{ form_errors(edit_form.documents) }}
+ {{ form_widget(edit_form.documents) }}
{% endif %}
@@ -127,4 +129,4 @@
{% block css %}
{{ encore_entry_link_tags('mod_pickentity_type') }}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php b/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php
index 70aecbe1e..6e105f9ee 100644
--- a/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php
+++ b/src/Bundle/ChillDocStoreBundle/Controller/WebdavController.php
@@ -46,9 +46,7 @@ final readonly class WebdavController
$this->requestAnalyzer = new PropfindRequestAnalyzer();
}
- /**
- * @Route("/dav/{access_token}/get/{uuid}/", methods={"GET", "HEAD"}, name="chill_docstore_dav_directory_get")
- */
+ #[Route(path: '/dav/{access_token}/get/{uuid}/', methods: ['GET', 'HEAD'], name: 'chill_docstore_dav_directory_get')]
public function getDirectory(StoredObject $storedObject, string $access_token): Response
{
if (!$this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)) {
@@ -63,9 +61,7 @@ final readonly class WebdavController
);
}
- /**
- * @Route("/dav/{access_token}/get/{uuid}/", methods={"OPTIONS"})
- */
+ #[Route(path: '/dav/{access_token}/get/{uuid}/', methods: ['OPTIONS'])]
public function optionsDirectory(StoredObject $storedObject): Response
{
if (!$this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)) {
@@ -82,9 +78,7 @@ final readonly class WebdavController
return $response;
}
- /**
- * @Route("/dav/{access_token}/get/{uuid}/", methods={"PROPFIND"})
- */
+ #[Route(path: '/dav/{access_token}/get/{uuid}/', methods: ['PROPFIND'])]
public function propfindDirectory(StoredObject $storedObject, string $access_token, Request $request): Response
{
if (!$this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)) {
@@ -119,9 +113,7 @@ final readonly class WebdavController
return $response;
}
- /**
- * @Route("/dav/{access_token}/get/{uuid}/d", name="chill_docstore_dav_document_get", methods={"GET"})
- */
+ #[Route(path: '/dav/{access_token}/get/{uuid}/d', name: 'chill_docstore_dav_document_get', methods: ['GET'])]
public function getDocument(StoredObject $storedObject): Response
{
if (!$this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)) {
@@ -132,9 +124,7 @@ final readonly class WebdavController
->setEtag($this->storedObjectManager->etag($storedObject));
}
- /**
- * @Route("/dav/{access_token}/get/{uuid}/d", methods={"HEAD"})
- */
+ #[Route(path: '/dav/{access_token}/get/{uuid}/d', methods: ['HEAD'])]
public function headDocument(StoredObject $storedObject): Response
{
if (!$this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)) {
@@ -154,9 +144,7 @@ final readonly class WebdavController
return $response;
}
- /**
- * @Route("/dav/{access_token}/get/{uuid}/d", methods={"OPTIONS"})
- */
+ #[Route(path: '/dav/{access_token}/get/{uuid}/d', methods: ['OPTIONS'])]
public function optionsDocument(StoredObject $storedObject): Response
{
if (!$this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)) {
@@ -172,9 +160,7 @@ final readonly class WebdavController
return $response;
}
- /**
- * @Route("/dav/{access_token}/get/{uuid}/d", methods={"PROPFIND"})
- */
+ #[Route(path: '/dav/{access_token}/get/{uuid}/d', methods: ['PROPFIND'])]
public function propfindDocument(StoredObject $storedObject, string $access_token, Request $request): Response
{
if (!$this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)) {
@@ -206,9 +192,7 @@ final readonly class WebdavController
return $response;
}
- /**
- * @Route("/dav/{access_token}/get/{uuid}/d", methods={"PUT"})
- */
+ #[Route(path: '/dav/{access_token}/get/{uuid}/d', methods: ['PUT'])]
public function putDocument(StoredObject $storedObject, Request $request): Response
{
if (!$this->security->isGranted(StoredObjectRoleEnum::EDIT->value, $storedObject)) {
diff --git a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php
index 2cb2e98f5..e92587f4d 100644
--- a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php
+++ b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php
@@ -39,15 +39,15 @@ class StoredObject implements Document, TrackCreationInterface
final public const STATUS_PENDING = 'pending';
final public const STATUS_FAILURE = 'failure';
- #[Serializer\Groups(['read', 'write'])]
+ #[Serializer\Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'datas')]
private array $datas = [];
- #[Serializer\Groups(['read', 'write'])]
+ #[Serializer\Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $filename = '';
- #[Serializer\Groups(['read', 'write'])]
+ #[Serializer\Groups(['write'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
@@ -56,23 +56,23 @@ class StoredObject implements Document, TrackCreationInterface
/**
* @var int[]
*/
- #[Serializer\Groups(['read', 'write'])]
+ #[Serializer\Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'iv')]
private array $iv = [];
- #[Serializer\Groups(['read', 'write'])]
+ #[Serializer\Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'key')]
private array $keyInfos = [];
- #[Serializer\Groups(['read', 'write'])]
+ #[Serializer\Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'title')]
private string $title = '';
- #[Serializer\Groups(['read', 'write'])]
+ #[Serializer\Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'type', options: ['default' => ''])]
private string $type = '';
- #[Serializer\Groups(['read', 'write'])]
+ #[Serializer\Groups(['write'])]
#[ORM\Column(type: 'uuid', unique: true)]
private UuidInterface $uuid;
@@ -98,7 +98,7 @@ class StoredObject implements Document, TrackCreationInterface
* @param StoredObject::STATUS_* $status
*/
public function __construct(
- #[Serializer\Groups(['read'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => 'ready'])]
+ #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => 'ready'])]
private string $status = 'ready'
) {
$this->uuid = Uuid::uuid4();
@@ -114,7 +114,7 @@ class StoredObject implements Document, TrackCreationInterface
/**
* @deprecated
*/
- #[Serializer\Groups(['read', 'write'])]
+ #[Serializer\Groups(['write'])]
public function getCreationDate(): \DateTime
{
if (null === $this->createdAt) {
diff --git a/src/Bundle/ChillDocStoreBundle/Form/AccompanyingCourseDocumentType.php b/src/Bundle/ChillDocStoreBundle/Form/AccompanyingCourseDocumentType.php
index 7ae41f96e..5d2096ca0 100644
--- a/src/Bundle/ChillDocStoreBundle/Form/AccompanyingCourseDocumentType.php
+++ b/src/Bundle/ChillDocStoreBundle/Form/AccompanyingCourseDocumentType.php
@@ -24,7 +24,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
-class AccompanyingCourseDocumentType extends AbstractType
+final class AccompanyingCourseDocumentType extends AbstractType
{
public function __construct(
private readonly TranslatableStringHelperInterface $translatableStringHelper
diff --git a/src/Bundle/ChillDocStoreBundle/Form/CollectionStoredObjectType.php b/src/Bundle/ChillDocStoreBundle/Form/CollectionStoredObjectType.php
new file mode 100644
index 000000000..fd14897bf
--- /dev/null
+++ b/src/Bundle/ChillDocStoreBundle/Form/CollectionStoredObjectType.php
@@ -0,0 +1,37 @@
+setDefault('entry_type', StoredObjectType::class)
+ ->setDefault('allow_add', true)
+ ->setDefault('allow_delete', true)
+ ->setDefault('button_add_label', 'stored_object.Insert a document')
+ ->setDefault('button_remove_label', 'stored_object.Remove a document')
+ ->setDefault('empty_collection_explain', 'No documents')
+ ->setDefault('entry_options', ['has_title' => true])
+ ->setDefault('js_caller', 'data-collection-stored-object');
+ }
+
+ public function getParent()
+ {
+ return ChillCollectionType::class;
+ }
+}
diff --git a/src/Bundle/ChillDocStoreBundle/Form/DataMapper/StoredObjectDataMapper.php b/src/Bundle/ChillDocStoreBundle/Form/DataMapper/StoredObjectDataMapper.php
new file mode 100644
index 000000000..4f2f177b4
--- /dev/null
+++ b/src/Bundle/ChillDocStoreBundle/Form/DataMapper/StoredObjectDataMapper.php
@@ -0,0 +1,73 @@
+setData($viewData->getTitle());
+ }
+ $forms['stored_object']->setData($viewData);
+ }
+
+ /**
+ * @param FormInterface[]|\Traversable $forms A list of {@link FormInterface} instances
+ */
+ public function mapFormsToData(\Traversable $forms, &$viewData)
+ {
+ $forms = iterator_to_array($forms);
+
+ if (!(null === $viewData || $viewData instanceof StoredObject)) {
+ throw new Exception\UnexpectedTypeException($viewData, StoredObject::class);
+ }
+
+ if (null === $forms['stored_object']->getData()) {
+ return;
+ }
+
+ /** @var StoredObject $viewData */
+ if ($viewData->getFilename() !== $forms['stored_object']->getData()['filename']) {
+ // we do not want to erase the previous object
+ $viewData = new StoredObject();
+ }
+
+ $viewData->setFilename($forms['stored_object']->getData()['filename']);
+ $viewData->setIv($forms['stored_object']->getData()['iv']);
+ $viewData->setKeyInfos($forms['stored_object']->getData()['keyInfos']);
+ $viewData->setType($forms['stored_object']->getData()['type']);
+
+ if (array_key_exists('title', $forms)) {
+ $viewData->setTitle($forms['title']->getData());
+ }
+ }
+}
diff --git a/src/Bundle/ChillDocStoreBundle/Form/DataTransformer/StoredObjectDataTransformer.php b/src/Bundle/ChillDocStoreBundle/Form/DataTransformer/StoredObjectDataTransformer.php
new file mode 100644
index 000000000..e06d8d7cc
--- /dev/null
+++ b/src/Bundle/ChillDocStoreBundle/Form/DataTransformer/StoredObjectDataTransformer.php
@@ -0,0 +1,51 @@
+serializer->serialize($value, 'json', [
+ 'groups' => [
+ StoredObjectNormalizer::ADD_DAV_EDIT_LINK_CONTEXT,
+ ],
+ ]);
+ }
+
+ throw new UnexpectedTypeException($value, StoredObject::class);
+ }
+
+ public function reverseTransform(mixed $value): mixed
+ {
+ if ('' === $value || null === $value) {
+ return null;
+ }
+
+ return json_decode((string) $value, true, 10, JSON_THROW_ON_ERROR);
+ }
+}
diff --git a/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php b/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php
index 414d94f20..3e4ceb163 100644
--- a/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php
+++ b/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php
@@ -11,11 +11,10 @@ declare(strict_types=1);
namespace Chill\DocStoreBundle\Form;
-use Chill\DocStoreBundle\Form\Type\AsyncUploaderType;
use Chill\DocStoreBundle\Entity\StoredObject;
-use Doctrine\ORM\EntityManagerInterface;
+use Chill\DocStoreBundle\Form\DataMapper\StoredObjectDataMapper;
+use Chill\DocStoreBundle\Form\DataTransformer\StoredObjectDataTransformer;
use Symfony\Component\Form\AbstractType;
-use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
@@ -24,9 +23,12 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Form type which allow to join a document.
*/
-class StoredObjectType extends AbstractType
+final class StoredObjectType extends AbstractType
{
- public function __construct(private readonly EntityManagerInterface $em) {}
+ public function __construct(
+ private readonly StoredObjectDataTransformer $storedObjectDataTransformer,
+ private readonly StoredObjectDataMapper $storedObjectDataMapper,
+ ) {}
public function buildForm(FormBuilderInterface $builder, array $options)
{
@@ -37,30 +39,9 @@ class StoredObjectType extends AbstractType
]);
}
- $builder
- ->add('filename', AsyncUploaderType::class)
- ->add('type', HiddenType::class)
- ->add('keyInfos', HiddenType::class)
- ->add('iv', HiddenType::class);
-
- $builder
- ->get('keyInfos')
- ->addModelTransformer(new CallbackTransformer(
- $this->transform(...),
- $this->reverseTransform(...)
- ));
- $builder
- ->get('iv')
- ->addModelTransformer(new CallbackTransformer(
- $this->transform(...),
- $this->reverseTransform(...)
- ));
-
- $builder
- ->addModelTransformer(new CallbackTransformer(
- $this->transformObject(...),
- $this->reverseTransformObject(...)
- ));
+ $builder->add('stored_object', HiddenType::class);
+ $builder->get('stored_object')->addModelTransformer($this->storedObjectDataTransformer);
+ $builder->setDataMapper($this->storedObjectDataMapper);
}
public function configureOptions(OptionsResolver $resolver)
@@ -72,43 +53,4 @@ class StoredObjectType extends AbstractType
->setDefault('has_title', false)
->setAllowedTypes('has_title', ['bool']);
}
-
- public function reverseTransform($value)
- {
- if (null === $value) {
- return null;
- }
-
- return \json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR);
- }
-
- public function reverseTransformObject($object)
- {
- if (null === $object) {
- return null;
- }
-
- if (null === $object->getFilename()) {
- // remove the original object
- $this->em->remove($object);
-
- return null;
- }
-
- return $object;
- }
-
- public function transform($object)
- {
- if (null === $object) {
- return null;
- }
-
- return \json_encode($object, JSON_THROW_ON_ERROR);
- }
-
- public function transformObject($object = null)
- {
- return $object;
- }
}
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/index.js b/src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/index-old.js
similarity index 100%
rename from src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/index.js
rename to src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/index-old.js
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/index.ts b/src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/index.ts
new file mode 100644
index 000000000..b7df11323
--- /dev/null
+++ b/src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/index.ts
@@ -0,0 +1,86 @@
+import {CollectionEventPayload} from "../../../../../ChillMainBundle/Resources/public/module/collection";
+import {createApp} from "vue";
+import DropFileWidget from "../../vuejs/DropFileWidget/DropFileWidget.vue"
+import {StoredObject, StoredObjectCreated} from "../../types";
+import {_createI18n} from "../../../../../ChillMainBundle/Resources/public/vuejs/_js/i18n";
+const i18n = _createI18n({});
+
+const startApp = (divElement: HTMLDivElement, collectionEntry: null|HTMLLIElement): void => {
+ console.log('app started', divElement);
+ const input_stored_object: HTMLInputElement|null = divElement.querySelector("input[data-stored-object]");
+ if (null === input_stored_object) {
+ throw new Error('input to stored object not found');
+ }
+
+ let existingDoc: StoredObject|null = null;
+ if (input_stored_object.value !== "") {
+ existingDoc = JSON.parse(input_stored_object.value);
+ }
+ const app_container = document.createElement("div");
+ divElement.appendChild(app_container);
+
+ const app = createApp({
+ template: '',
+ data(vm) {
+ return {
+ existingDoc: existingDoc,
+ }
+ },
+ components: {
+ DropFileWidget,
+ },
+ methods: {
+ addDocument: function(object: StoredObjectCreated): void {
+ console.log('object added', object);
+ this.$data.existingDoc = object;
+ input_stored_object.value = JSON.stringify(object);
+ },
+ removeDocument: function(object: StoredObject): void {
+ console.log('catch remove document', object);
+ input_stored_object.value = "";
+ this.$data.existingDoc = null;
+ console.log('collectionEntry', collectionEntry);
+
+ if (null !== collectionEntry) {
+ console.log('will remove collection');
+ collectionEntry.remove();
+ }
+ }
+ }
+ });
+
+ app.use(i18n).mount(app_container);
+}
+window.addEventListener('collection-add-entry', ((e: CustomEvent) => {
+ const detail = e.detail;
+ const divElement: null|HTMLDivElement = detail.entry.querySelector('div[data-stored-object]');
+
+ if (null === divElement) {
+ throw new Error('div[data-stored-object] not found');
+ }
+
+ startApp(divElement, detail.entry);
+}) as EventListener);
+
+window.addEventListener('DOMContentLoaded', () => {
+ const upload_inputs: NodeListOf = document.querySelectorAll('div[data-stored-object]');
+
+ upload_inputs.forEach((input: HTMLDivElement): void => {
+ // test for a parent to check if this is a collection entry
+ let collectionEntry: null|HTMLLIElement = null;
+ let parent = input.parentElement;
+ console.log('parent', parent);
+ if (null !== parent) {
+ let grandParent = parent.parentElement;
+ console.log('grandParent', grandParent);
+ if (null !== grandParent) {
+ if (grandParent.tagName.toLowerCase() === 'li' && grandParent.classList.contains('entry')) {
+ collectionEntry = grandParent as HTMLLIElement;
+ }
+ }
+ }
+ startApp(input, collectionEntry);
+ })
+});
+
+export {}
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/types.ts b/src/Bundle/ChillDocStoreBundle/Resources/public/types.ts
index 825055973..25d956312 100644
--- a/src/Bundle/ChillDocStoreBundle/Resources/public/types.ts
+++ b/src/Bundle/ChillDocStoreBundle/Resources/public/types.ts
@@ -17,6 +17,20 @@ export interface StoredObject {
type: string,
uuid: string,
status: StoredObjectStatus,
+ _links?: {
+ dav_link?: {
+ href: string
+ expiration: number
+ },
+ }
+}
+
+export interface StoredObjectCreated {
+ status: "stored_object_created",
+ filename: string,
+ iv: Uint8Array,
+ keyInfos: object,
+ type: string,
}
export interface StoredObjectStatusChange {
@@ -33,3 +47,18 @@ export type WopiEditButtonExecutableBeforeLeaveFunction = {
(): Promise
}
+/**
+ * Object containing information for performering a POST request to a swift object store
+ */
+export interface PostStoreObjectSignature {
+ method: "POST",
+ max_file_size: number,
+ max_file_count: 1,
+ expires: number,
+ submit_delay: 180,
+ redirect: string,
+ prefix: string,
+ url: string,
+ signature: string,
+}
+
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue
index 284ae0f1f..192cdd271 100644
--- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue
+++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue
@@ -1,5 +1,5 @@
-
+
@@ -35,14 +35,14 @@ import DownloadButton from "./StoredObjectButton/DownloadButton.vue";
import WopiEditButton from "./StoredObjectButton/WopiEditButton.vue";
import {is_extension_editable, is_extension_viewable, is_object_ready} from "./StoredObjectButton/helpers";
import {
- StoredObject,
- StoredObjectStatusChange,
- WopiEditButtonExecutableBeforeLeaveFunction
+ StoredObject, StoredObjectCreated,
+ StoredObjectStatusChange,
+ WopiEditButtonExecutableBeforeLeaveFunction
} from "../types";
import DesktopEditButton from "ChillDocStoreAssets/vuejs/StoredObjectButton/DesktopEditButton.vue";
interface DocumentActionButtonsGroupConfig {
- storedObject: StoredObject,
+ storedObject: StoredObject|StoredObjectCreated,
small?: boolean,
canEdit?: boolean,
canDownload?: boolean,
@@ -99,6 +99,7 @@ const checkForReady = function(): void {
if (
'ready' === props.storedObject.status
|| 'failure' === props.storedObject.status
+ || 'stored_object_created' === props.storedObject.status
// stop reloading if the page stays opened for a long time
|| tryiesForReady > maxTryiesForReady
) {
@@ -111,6 +112,11 @@ const checkForReady = function(): void {
};
const onObjectNewStatusCallback = async function(): Promise {
+
+ if (props.storedObject.status === 'stored_object_created') {
+ return Promise.resolve();
+ }
+
const new_status = await is_object_ready(props.storedObject);
if (props.storedObject.status !== new_status.status) {
emit('onStoredObjectStatusChange', new_status);
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFile.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFile.vue
new file mode 100644
index 000000000..94b4f02fb
--- /dev/null
+++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFile.vue
@@ -0,0 +1,155 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Déposez un document ou cliquez ici pour remplacer le document existant
+
Déposez un document ou cliquez ici pour ouvrir le navigateur de fichier