mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'master' into 'issue440_mesparcours_brouillon'
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
9bcf4cce9f
64
.env
64
.env
@ -1,64 +0,0 @@
|
|||||||
##
|
|
||||||
## Manually dump .env files in .env.local.php with
|
|
||||||
## `$ composer symfony:dump-env prod`
|
|
||||||
##
|
|
||||||
|
|
||||||
## Project environment
|
|
||||||
APP_ENV=dev
|
|
||||||
|
|
||||||
## Enable debug
|
|
||||||
APP_DEBUG=true
|
|
||||||
|
|
||||||
## Locale
|
|
||||||
LOCALE=fr
|
|
||||||
|
|
||||||
## Framework secret
|
|
||||||
APP_SECRET=ThisTokenIsNotSoSecretChangeIt
|
|
||||||
|
|
||||||
## Symfony/swiftmailer
|
|
||||||
MAILER_TRANSPORT=smtp
|
|
||||||
MAILER_HOST=smtp
|
|
||||||
MAILER_PORT=1025
|
|
||||||
MAILER_CRYPT=
|
|
||||||
MAILER_AUTH=
|
|
||||||
MAILER_USER=
|
|
||||||
MAILER_PASSWORD=
|
|
||||||
MAILER_URL=${MAILER_TRANSPORT}://${MAILER_HOST}:${MAILER_PORT}?encryption=${MAILER_CRYPT}&auth_mode=${MAILER_AUTH}&username=${MAILER_USER}&password=${MAILER_PASSWORD}
|
|
||||||
|
|
||||||
## Notifications
|
|
||||||
NOTIFICATION_HOST=localhost:8001
|
|
||||||
NOTIFICATION_FROM_EMAIL=admin@chill.social
|
|
||||||
NOTIFICATION_FROM_NAME=Chill
|
|
||||||
|
|
||||||
## Gelf
|
|
||||||
GELF_HOST=gelf
|
|
||||||
GELF_PORT=12201
|
|
||||||
|
|
||||||
## OVH OpenStack Storage User/Role
|
|
||||||
OS_USERNAME=
|
|
||||||
OS_PASSWORD=
|
|
||||||
OS_TENANT_ID=
|
|
||||||
OS_REGION_NAME=GRA
|
|
||||||
OS_AUTH_URL=https://auth.cloud.ovh.net/v2.0/
|
|
||||||
|
|
||||||
## OVH OpenStack Storage Container
|
|
||||||
ASYNC_UPLOAD_TEMP_URL_KEY=
|
|
||||||
ASYNC_UPLOAD_TEMP_URL_BASE_PATH=
|
|
||||||
ASYNC_UPLOAD_TEMP_URL_CONTAINER=
|
|
||||||
|
|
||||||
## Redis Cache
|
|
||||||
REDIS_HOST=redis
|
|
||||||
REDIS_PORT=6379
|
|
||||||
REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT}
|
|
||||||
|
|
||||||
## Twilio
|
|
||||||
TWILIO_SID=~
|
|
||||||
TWILIO_SECRET=~
|
|
||||||
|
|
||||||
## DOCKER IMAGES REGISTRY
|
|
||||||
#IMAGE_PHP=
|
|
||||||
#IMAGE_NGINX=
|
|
||||||
|
|
||||||
## DOCKER IMAGES VERSION
|
|
||||||
#VERSION=test
|
|
||||||
VERSION=prod
|
|
@ -11,12 +11,14 @@ and this project adheres to
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
<!-- write down unreleased development here -->
|
<!-- write down unreleased development here -->
|
||||||
|
* fix normalisation of accompanying course requestor api (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/378)
|
||||||
* [person] add a returnPath when clicking on some Person or ThirdParty badge (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/427)
|
* [person] add a returnPath when clicking on some Person or ThirdParty badge (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/427)
|
||||||
* [person] accompanying course work: fix on-the-fly update of thirdParty
|
* [person] accompanying course work: fix on-the-fly update of thirdParty
|
||||||
* [on-the-fly] close modal only after validation
|
* [on-the-fly] close modal only after validation
|
||||||
* [person] correct thirdparty PATCH url + add email and altnames in AddPerson and serializer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/433)
|
* [person] correct thirdparty PATCH url + add email and altnames in AddPerson and serializer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/433)
|
||||||
* change order for accompanying course work list
|
* change order for accompanying course work list
|
||||||
* [parcours]: Mes parcours brouillon added to user menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/440)
|
* [parcours]: Mes parcours brouillon added to user menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/440)
|
||||||
|
* [Documents]: List view adapted to display more information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/414)
|
||||||
* [person]: style fix in parcours listing per person. (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/432)
|
* [person]: style fix in parcours listing per person. (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/432)
|
||||||
* [household]: display address of current household (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/415)
|
* [household]: display address of current household (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/415)
|
||||||
* ajoute un ordre dans les localisation (api)
|
* ajoute un ordre dans les localisation (api)
|
||||||
@ -25,6 +27,7 @@ and this project adheres to
|
|||||||
* [person]: create person and household added to button dropdown (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/454)
|
* [person]: create person and household added to button dropdown (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/454)
|
||||||
* display full address in address.text in normalization. Adapt AddressRenderBox
|
* display full address in address.text in normalization. Adapt AddressRenderBox
|
||||||
* [address]: Correction residential address 'depuis le' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/459)
|
* [address]: Correction residential address 'depuis le' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/459)
|
||||||
|
* [Documents]: List view adapted to display more information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/414)
|
||||||
|
|
||||||
## Test releases
|
## Test releases
|
||||||
|
|
||||||
@ -38,7 +41,7 @@ and this project adheres to
|
|||||||
* [parcours]: validation + message for closing parcours adjusted.
|
* [parcours]: validation + message for closing parcours adjusted.
|
||||||
* [household]: household composition double edit button replaced by a delete action (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/426)
|
* [household]: household composition double edit button replaced by a delete action (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/426)
|
||||||
[fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
|
[fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
|
||||||
[homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
[homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
||||||
* [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421)
|
* [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421)
|
||||||
* [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424)
|
* [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424)
|
||||||
* [bugfix]: modal closes and newly created person/thirdparty is selected when multiple persons/thirdparties are created through the modal (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/429)
|
* [bugfix]: modal closes and newly created person/thirdparty is selected when multiple persons/thirdparties are created through the modal (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/429)
|
||||||
@ -46,7 +49,7 @@ and this project adheres to
|
|||||||
* [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal
|
* [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal
|
||||||
* [AddAddress] disable multiselect search, and rely only on most pertinent Cities and Street computed backend
|
* [AddAddress] disable multiselect search, and rely only on most pertinent Cities and Street computed backend
|
||||||
* [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
|
* [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
|
||||||
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
||||||
|
|
||||||
### test release 2021-01-31
|
### test release 2021-01-31
|
||||||
|
|
||||||
@ -95,7 +98,7 @@ and this project adheres to
|
|||||||
* [popover] add popover html popup mechanism (used by workflow breadcrumb)
|
* [popover] add popover html popup mechanism (used by workflow breadcrumb)
|
||||||
* [templates] improve updatedBy macro in item metadatas
|
* [templates] improve updatedBy macro in item metadatas
|
||||||
* [parcours]: bug fix when comment is pinned all other comments remain in the collection (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/385)
|
* [parcours]: bug fix when comment is pinned all other comments remain in the collection (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/385)
|
||||||
* [workflow]
|
* [workflow]
|
||||||
* add My workflow section with my opened subscriptions
|
* add My workflow section with my opened subscriptions
|
||||||
* apply workflow on documents, accompanyingCourseWork and Evaluations
|
* apply workflow on documents, accompanyingCourseWork and Evaluations
|
||||||
* [wopi-link] a new vue component allow to open wopi link in a fullscreen chill-themed modal
|
* [wopi-link] a new vue component allow to open wopi link in a fullscreen chill-themed modal
|
||||||
|
@ -408,24 +408,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php
|
path: src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php
|
||||||
|
|
||||||
-
|
|
||||||
message:
|
|
||||||
"""
|
|
||||||
#^Call to deprecated method getReachableScopes\\(\\) of class Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:
|
|
||||||
Use getReachableCircles$#
|
|
||||||
"""
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message:
|
|
||||||
"""
|
|
||||||
#^Parameter \\$translator of method Chill\\\\DocStoreBundle\\\\Controller\\\\DocumentPersonController\\:\\:__construct\\(\\) has typehint with deprecated interface Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\:
|
|
||||||
since Symfony 4\\.2, use Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface instead$#
|
|
||||||
"""
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message:
|
message:
|
||||||
"""
|
"""
|
||||||
|
@ -13,7 +13,9 @@ namespace Chill\DocStoreBundle\Controller;
|
|||||||
|
|
||||||
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
|
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
|
||||||
use Chill\DocStoreBundle\Form\AccompanyingCourseDocumentType;
|
use Chill\DocStoreBundle\Form\AccompanyingCourseDocumentType;
|
||||||
|
use Chill\DocStoreBundle\Repository\AccompanyingCourseDocumentRepository;
|
||||||
use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter;
|
use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
@ -29,20 +31,15 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
class DocumentAccompanyingCourseController extends AbstractController
|
class DocumentAccompanyingCourseController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
protected AuthorizationHelper $authorizationHelper;
|
||||||
* @var AuthorizationHelper
|
|
||||||
*/
|
|
||||||
protected $authorizationHelper;
|
|
||||||
|
|
||||||
/**
|
protected EventDispatcherInterface $eventDispatcher;
|
||||||
* @var EventDispatcherInterface
|
|
||||||
*/
|
|
||||||
protected $eventDispatcher;
|
|
||||||
|
|
||||||
/**
|
protected TranslatorInterface $translator;
|
||||||
* @var TranslatorInterface
|
|
||||||
*/
|
private AccompanyingCourseDocumentRepository $courseRepository;
|
||||||
protected $translator;
|
|
||||||
|
private PaginatorFactory $paginatorFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DocumentAccompanyingCourseController constructor.
|
* DocumentAccompanyingCourseController constructor.
|
||||||
@ -50,11 +47,15 @@ class DocumentAccompanyingCourseController extends AbstractController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
TranslatorInterface $translator,
|
TranslatorInterface $translator,
|
||||||
EventDispatcherInterface $eventDispatcher,
|
EventDispatcherInterface $eventDispatcher,
|
||||||
AuthorizationHelper $authorizationHelper
|
AuthorizationHelper $authorizationHelper,
|
||||||
|
PaginatorFactory $paginatorFactory,
|
||||||
|
AccompanyingCourseDocumentRepository $courseRepository
|
||||||
) {
|
) {
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
|
$this->paginatorFactory = $paginatorFactory;
|
||||||
|
$this->courseRepository = $courseRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,11 +131,15 @@ class DocumentAccompanyingCourseController extends AbstractController
|
|||||||
|
|
||||||
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::SEE, $course);
|
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::SEE, $course);
|
||||||
|
|
||||||
$documents = $em
|
$total = $this->courseRepository->countByCourse($course);
|
||||||
->getRepository('ChillDocStoreBundle:AccompanyingCourseDocument')
|
$pagination = $this->paginatorFactory->create($total);
|
||||||
|
|
||||||
|
$documents = $this->courseRepository
|
||||||
->findBy(
|
->findBy(
|
||||||
['course' => $course],
|
['course' => $course],
|
||||||
['date' => 'DESC']
|
['date' => 'DESC'],
|
||||||
|
$pagination->getItemsPerPage(),
|
||||||
|
$pagination->getCurrentPageFirstItemNumber()
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->render(
|
return $this->render(
|
||||||
@ -142,6 +147,7 @@ class DocumentAccompanyingCourseController extends AbstractController
|
|||||||
[
|
[
|
||||||
'documents' => $documents,
|
'documents' => $documents,
|
||||||
'accompanyingCourse' => $course,
|
'accompanyingCourse' => $course,
|
||||||
|
'pagination' => $pagination,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,8 @@ namespace Chill\DocStoreBundle\Controller;
|
|||||||
|
|
||||||
use Chill\DocStoreBundle\Entity\PersonDocument;
|
use Chill\DocStoreBundle\Entity\PersonDocument;
|
||||||
use Chill\DocStoreBundle\Form\PersonDocumentType;
|
use Chill\DocStoreBundle\Form\PersonDocumentType;
|
||||||
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
use Chill\DocStoreBundle\Repository\PersonDocumentACLAwareRepositoryInterface;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||||
@ -24,7 +25,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Component\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DocumentPersonController.
|
* Class DocumentPersonController.
|
||||||
@ -35,20 +36,15 @@ use Symfony\Component\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
class DocumentPersonController extends AbstractController
|
class DocumentPersonController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
protected AuthorizationHelper $authorizationHelper;
|
||||||
* @var AuthorizationHelper
|
|
||||||
*/
|
|
||||||
protected $authorizationHelper;
|
|
||||||
|
|
||||||
/**
|
protected EventDispatcherInterface $eventDispatcher;
|
||||||
* @var EventDispatcherInterface
|
|
||||||
*/
|
|
||||||
protected $eventDispatcher;
|
|
||||||
|
|
||||||
/**
|
protected TranslatorInterface $translator;
|
||||||
* @var TranslatorInterface
|
|
||||||
*/
|
private PaginatorFactory $paginatorFactory;
|
||||||
protected $translator;
|
|
||||||
|
private PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DocumentPersonController constructor.
|
* DocumentPersonController constructor.
|
||||||
@ -56,11 +52,15 @@ class DocumentPersonController extends AbstractController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
TranslatorInterface $translator,
|
TranslatorInterface $translator,
|
||||||
EventDispatcherInterface $eventDispatcher,
|
EventDispatcherInterface $eventDispatcher,
|
||||||
AuthorizationHelper $authorizationHelper
|
AuthorizationHelper $authorizationHelper,
|
||||||
|
PaginatorFactory $paginatorFactory,
|
||||||
|
PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository
|
||||||
) {
|
) {
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
|
$this->paginatorFactory = $paginatorFactory;
|
||||||
|
$this->personDocumentACLAwareRepository = $personDocumentACLAwareRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,19 +156,15 @@ class DocumentPersonController extends AbstractController
|
|||||||
|
|
||||||
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
||||||
|
|
||||||
$reachableScopes = $this->authorizationHelper
|
$total = $this->personDocumentACLAwareRepository->countByPerson($person);
|
||||||
->getReachableScopes(
|
$pagination = $this->paginatorFactory->create($total);
|
||||||
$this->getUser(),
|
|
||||||
PersonDocumentVoter::SEE,
|
|
||||||
$person->getCenter()
|
|
||||||
);
|
|
||||||
|
|
||||||
$documents = $em
|
$documents = $this->personDocumentACLAwareRepository->findByPerson(
|
||||||
->getRepository('ChillDocStoreBundle:PersonDocument')
|
$person,
|
||||||
->findBy(
|
[],
|
||||||
['person' => $person, 'scope' => $reachableScopes],
|
$pagination->getItemsPerPage(),
|
||||||
['date' => 'DESC']
|
$pagination->getCurrentPageFirstItemNumber()
|
||||||
);
|
);
|
||||||
|
|
||||||
$event = new PrivacyEvent($person, [
|
$event = new PrivacyEvent($person, [
|
||||||
'element_class' => PersonDocument::class,
|
'element_class' => PersonDocument::class,
|
||||||
@ -181,6 +177,7 @@ class DocumentPersonController extends AbstractController
|
|||||||
[
|
[
|
||||||
'documents' => $documents,
|
'documents' => $documents,
|
||||||
'person' => $person,
|
'person' => $person,
|
||||||
|
'pagination' => $pagination,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ class ChillDocStoreExtension extends Extension implements PrependExtensionInterf
|
|||||||
$loader->load('services/menu.yaml');
|
$loader->load('services/menu.yaml');
|
||||||
$loader->load('services/fixtures.yaml');
|
$loader->load('services/fixtures.yaml');
|
||||||
$loader->load('services/form.yaml');
|
$loader->load('services/form.yaml');
|
||||||
|
$loader->load('services/templating.yaml');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepend(ContainerBuilder $container)
|
public function prepend(ContainerBuilder $container)
|
||||||
|
@ -11,7 +11,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\DocStoreBundle\Entity;
|
namespace Chill\DocStoreBundle\Entity;
|
||||||
|
|
||||||
|
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
||||||
use Chill\MainBundle\Entity\HasScopeInterface;
|
use Chill\MainBundle\Entity\HasScopeInterface;
|
||||||
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
@ -20,8 +26,12 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
/**
|
/**
|
||||||
* @ORM\MappedSuperclass
|
* @ORM\MappedSuperclass
|
||||||
*/
|
*/
|
||||||
class Document implements HasScopeInterface
|
class Document implements HasScopeInterface, TrackCreationInterface, TrackUpdateInterface
|
||||||
{
|
{
|
||||||
|
use TrackCreationTrait;
|
||||||
|
|
||||||
|
use TrackUpdateTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\DocStoreBundle\Entity\DocumentCategory")
|
* @ORM\ManyToOne(targetEntity="Chill\DocStoreBundle\Entity\DocumentCategory")
|
||||||
* @ORM\JoinColumns({
|
* @ORM\JoinColumns({
|
||||||
@ -67,6 +77,11 @@ class Document implements HasScopeInterface
|
|||||||
*/
|
*/
|
||||||
private $scope;
|
private $scope;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate")
|
||||||
|
*/
|
||||||
|
private $template;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
* @Assert\Length(
|
* @Assert\Length(
|
||||||
@ -82,9 +97,6 @@ class Document implements HasScopeInterface
|
|||||||
*/
|
*/
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
/**
|
|
||||||
* @return DocumentCategory
|
|
||||||
*/
|
|
||||||
public function getCategory(): ?DocumentCategory
|
public function getCategory(): ?DocumentCategory
|
||||||
{
|
{
|
||||||
return $this->category;
|
return $this->category;
|
||||||
@ -115,11 +127,16 @@ class Document implements HasScopeInterface
|
|||||||
*
|
*
|
||||||
* @return \Chill\MainBundle\Entity\Scope
|
* @return \Chill\MainBundle\Entity\Scope
|
||||||
*/
|
*/
|
||||||
public function getScope()
|
public function getScope(): ?Scope
|
||||||
{
|
{
|
||||||
return $this->scope;
|
return $this->scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTemplate(): ?DocGeneratorTemplate
|
||||||
|
{
|
||||||
|
return $this->template;
|
||||||
|
}
|
||||||
|
|
||||||
public function getTitle(): ?string
|
public function getTitle(): ?string
|
||||||
{
|
{
|
||||||
return $this->title;
|
return $this->title;
|
||||||
@ -165,6 +182,13 @@ class Document implements HasScopeInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setTemplate(?DocGeneratorTemplate $template): self
|
||||||
|
{
|
||||||
|
$this->template = $template;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function setTitle(string $title): self
|
public function setTitle(string $title): self
|
||||||
{
|
{
|
||||||
$this->title = $title;
|
$this->title = $title;
|
||||||
|
@ -18,10 +18,12 @@ use Chill\MainBundle\Form\Type\ChillDateType;
|
|||||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||||
use Chill\MainBundle\Form\Type\ScopePickerType;
|
use Chill\MainBundle\Form\Type\ScopePickerType;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
|
use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\Persistence\ObjectManager;
|
use Doctrine\Persistence\ObjectManager;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@ -51,14 +53,25 @@ class PersonDocumentType extends AbstractType
|
|||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
|
private ParameterBagInterface $parameterBag;
|
||||||
|
|
||||||
|
private ScopeResolverDispatcher $scopeResolverDispatcher;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
TranslatableStringHelper $translatableStringHelper
|
TranslatableStringHelper $translatableStringHelper,
|
||||||
|
ScopeResolverDispatcher $scopeResolverDispatcher,
|
||||||
|
ParameterBagInterface $parameterBag
|
||||||
) {
|
) {
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
|
$this->scopeResolverDispatcher = $scopeResolverDispatcher;
|
||||||
|
$this->parameterBag = $parameterBag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
|
$document = $options['data'];
|
||||||
|
$isScopeConcerned = $this->scopeResolverDispatcher->isConcerned($document);
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('title', TextType::class)
|
->add('title', TextType::class)
|
||||||
->add('description', ChillTextareaType::class, [
|
->add('description', ChillTextareaType::class, [
|
||||||
@ -67,10 +80,6 @@ class PersonDocumentType extends AbstractType
|
|||||||
->add('object', StoredObjectType::class, [
|
->add('object', StoredObjectType::class, [
|
||||||
'error_bubbling' => true,
|
'error_bubbling' => true,
|
||||||
])
|
])
|
||||||
->add('scope', ScopePickerType::class, [
|
|
||||||
'center' => $options['center'],
|
|
||||||
'role' => $options['role'],
|
|
||||||
])
|
|
||||||
->add('date', ChillDateType::class)
|
->add('date', ChillDateType::class)
|
||||||
->add('category', EntityType::class, [
|
->add('category', EntityType::class, [
|
||||||
'placeholder' => 'Choose a document category',
|
'placeholder' => 'Choose a document category',
|
||||||
@ -84,6 +93,13 @@ class PersonDocumentType extends AbstractType
|
|||||||
return $entity ? $this->translatableStringHelper->localize($entity->getName()) : '';
|
return $entity ? $this->translatableStringHelper->localize($entity->getName()) : '';
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if ($isScopeConcerned && $this->parameterBag->get('chill_main')['acl']['form_show_scopes']) {
|
||||||
|
$builder->add('scope', ScopePickerType::class, [
|
||||||
|
'center' => $options['center'],
|
||||||
|
'role' => $options['role'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\DocStoreBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Doctrine\Persistence\ObjectRepository;
|
||||||
|
|
||||||
|
class AccompanyingCourseDocumentRepository implements ObjectRepository
|
||||||
|
{
|
||||||
|
private EntityManagerInterface $em;
|
||||||
|
|
||||||
|
private EntityRepository $repository;
|
||||||
|
|
||||||
|
public function __construct(EntityManagerInterface $em)
|
||||||
|
{
|
||||||
|
$this->em = $em;
|
||||||
|
$this->repository = $em->getRepository(AccompanyingCourseDocument::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildQueryByCourse(AccompanyingPeriod $course): QueryBuilder
|
||||||
|
{
|
||||||
|
$qb = $this->repository->createQueryBuilder('d');
|
||||||
|
|
||||||
|
$qb
|
||||||
|
->where($qb->expr()->eq('d.course', ':course'))
|
||||||
|
->setParameter('course', $course);
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countByCourse(AccompanyingPeriod $course): int
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryByCourse($course)->select('COUNT(d)');
|
||||||
|
|
||||||
|
return $qb->getQuery()->getSingleScalarResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function find($id): ?AccompanyingCourseDocument
|
||||||
|
{
|
||||||
|
return $this->repository->find($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findAll(): array
|
||||||
|
{
|
||||||
|
return $this->repository->findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
{
|
||||||
|
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findOneBy(array $criteria): ?AccompanyingCourseDocument
|
||||||
|
{
|
||||||
|
return $this->findOneBy($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClassName()
|
||||||
|
{
|
||||||
|
return AccompanyingCourseDocument::class;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\DocStoreBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\DocStoreBundle\Entity\PersonDocument;
|
||||||
|
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
||||||
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||||
|
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
|
||||||
|
class PersonDocumentACLAwareRepository implements PersonDocumentACLAwareRepositoryInterface
|
||||||
|
{
|
||||||
|
private AuthorizationHelperInterface $authorizationHelper;
|
||||||
|
|
||||||
|
private CenterResolverDispatcher $centerResolverDispatcher;
|
||||||
|
|
||||||
|
private EntityManagerInterface $em;
|
||||||
|
|
||||||
|
private Security $security;
|
||||||
|
|
||||||
|
public function __construct(EntityManagerInterface $em, AuthorizationHelperInterface $authorizationHelper, CenterResolverDispatcher $centerResolverDispatcher, Security $security)
|
||||||
|
{
|
||||||
|
$this->em = $em;
|
||||||
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
|
$this->centerResolverDispatcher = $centerResolverDispatcher;
|
||||||
|
$this->security = $security;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildQueryByPerson(Person $person): QueryBuilder
|
||||||
|
{
|
||||||
|
$qb = $this->em->getRepository(PersonDocument::class)->createQueryBuilder('d');
|
||||||
|
|
||||||
|
$qb
|
||||||
|
->where($qb->expr()->eq('d.person', ':person'))
|
||||||
|
->setParameter('person', $person);
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countByPerson(Person $person): int
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryByPerson($person)->select('COUNT(d)');
|
||||||
|
|
||||||
|
$this->addACL($qb, $person);
|
||||||
|
|
||||||
|
return $qb->getQuery()->getSingleScalarResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findByPerson(Person $person, array $orderBy = [], int $limit = 20, int $offset = 0): array
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryByPerson($person)->select('d');
|
||||||
|
|
||||||
|
$this->addACL($qb, $person);
|
||||||
|
|
||||||
|
foreach ($orderBy as [$field, $order]) {
|
||||||
|
$qb->addOrderBy($field, $order);
|
||||||
|
}
|
||||||
|
|
||||||
|
$qb->setFirstResult($offset)->setMaxResults($limit);
|
||||||
|
|
||||||
|
return $qb->getQuery()->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function addACL(QueryBuilder $qb, Person $person): void
|
||||||
|
{
|
||||||
|
$center = $this->centerResolverDispatcher->resolveCenter($person);
|
||||||
|
|
||||||
|
$reachableScopes = $this->authorizationHelper
|
||||||
|
->getReachableScopes(
|
||||||
|
$this->security->getUser(),
|
||||||
|
PersonDocumentVoter::SEE,
|
||||||
|
$center
|
||||||
|
);
|
||||||
|
|
||||||
|
$qb->andWhere($qb->expr()->in('d.scope', ':scopes'))
|
||||||
|
->setParameter('scopes', $reachableScopes);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\DocStoreBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
|
||||||
|
interface PersonDocumentACLAwareRepositoryInterface
|
||||||
|
{
|
||||||
|
public function countByPerson(Person $person): int;
|
||||||
|
|
||||||
|
public function findByPerson(Person $person, array $orderBy = [], int $limit = 20, int $offset = 0): array;
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||||
|
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
||||||
|
|
||||||
<div class="flex-table accompanying_course_work-list">
|
<div class="flex-table accompanying_course_work-list">
|
||||||
<div class="item-bloc document-item bg-chill-llight-gray">
|
<div class="item-bloc document-item bg-chill-llight-gray">
|
||||||
@ -9,8 +10,10 @@
|
|||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<h3>{{ document.title }}</h3>
|
<h3>{{ document.title }}</h3>
|
||||||
|
|
||||||
|
{{ mm.mimeIcon(document.object.type) }}
|
||||||
|
|
||||||
{% if document.description is not empty %}
|
{% if document.description is not empty %}
|
||||||
<blockquote class="chill-user-quote mt-2">
|
<blockquote class="chill-user-quote mt-4">
|
||||||
{{ document.description }}
|
{{ document.description }}
|
||||||
</blockquote>
|
</blockquote>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -42,26 +45,14 @@
|
|||||||
{{ m.download_button(document.object, document.title) }}
|
{{ m.download_button(document.object, document.title) }}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
{% if not freezed %}
|
{% if chill_document_is_editable(document.object) %}
|
||||||
{% set button = {
|
{% if not freezed %}
|
||||||
'changeIcon': 'fa-unlock',
|
{{ document.object|chill_document_edit_button({'title': document.title|e('html') }) }}
|
||||||
} %}{#
|
{% else %}
|
||||||
'changeClass' string
|
<a class="btn btn-wopilink disabled" href="#" title="{{ 'workflow.freezed document'|trans }}">
|
||||||
'noText' boolean
|
{{ 'Update document'|trans }}
|
||||||
#}
|
</a>
|
||||||
{# vue component
|
{% endif %}
|
||||||
<span
|
|
||||||
data-module="wopi-link"
|
|
||||||
data-wopi-url="{{ path('chill_wopi_file_edit', {'fileId': document.object.uuid}) }}"
|
|
||||||
data-doc-title="{{ document.title|e('html_attr') }}"
|
|
||||||
data-doc-type="{{ document.object.type|e('html_attr') }}"
|
|
||||||
data-button="{{ button|json_encode }}"
|
|
||||||
></span> #}
|
|
||||||
<a class="btn btn-update" href="{{ chill_path_add_return_path('chill_wopi_file_edit', {'fileId': document.object.uuid}) }}">{{ 'Edit'|trans }}</a>
|
|
||||||
{% else %}
|
|
||||||
<a class="btn btn-update change-icon disabled" href="#" title="{{ 'workflow.freezed document'|trans }}">
|
|
||||||
<i class="fa fa-lock me-2"></i>{{ 'Update document'|trans }}
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %}
|
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %}
|
||||||
<li>
|
<li>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
{{ form_row(form.description) }}
|
{{ form_row(form.description) }}
|
||||||
{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }}
|
{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }}
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
||||||
{{ 'Back to the list' | trans }}
|
{{ 'Back to the list' | trans }}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
{% set activeRouteKey = '' %}
|
{% set activeRouteKey = '' %}
|
||||||
|
|
||||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{{ 'Documents' }}
|
{{ 'Documents' }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -11,64 +9,35 @@
|
|||||||
{% block js %}
|
{% block js %}
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
{{ encore_entry_script_tags('mod_async_upload') }}
|
{{ encore_entry_script_tags('mod_async_upload') }}
|
||||||
{{ encore_entry_script_tags('mod_docgen_picktemplate') }}
|
{{ encore_entry_script_tags('mod_docgen_picktemplate') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
{{ encore_entry_link_tags('mod_async_upload') }}
|
{{ encore_entry_link_tags('mod_async_upload') }}
|
||||||
{{ encore_entry_link_tags('mod_docgen_picktemplate') }}
|
{{ encore_entry_link_tags('mod_docgen_picktemplate') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<div class="col-md-10 col-xxl">
|
||||||
<h1>{{ 'Documents' }}</h1>
|
<h1>{{ 'Documents' }}</h1>
|
||||||
|
|
||||||
<table class="table table-bordered border-dark table-striped">
|
{% if documents|length == 0 %}
|
||||||
|
<p class="chill-no-data-statement">{{ 'No documents'|trans }}</p>
|
||||||
<thead>
|
{% else %}
|
||||||
<tr>
|
<div class="flex-table chill-task-list">
|
||||||
<th>{{ 'Title' | trans }}</th>
|
|
||||||
<th>{{ 'Category'|trans }}</th>
|
|
||||||
<th>{{ 'Actions' | trans }}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for document in documents %}
|
{% for document in documents %}
|
||||||
<tr>
|
{% include 'ChillDocStoreBundle:List:list_item.html.twig' %}
|
||||||
<td>{{ document.title }}</td>
|
|
||||||
<td>{% if document.category %}{{ document.category.name|localize_translatable_string }}{% endif %}</td>
|
|
||||||
<td>
|
|
||||||
<ul class="record_actions">
|
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS', document) %}
|
|
||||||
<li>
|
|
||||||
{{ m.download_button(document.object, document.title) }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': accompanyingCourse.id, 'id': document.id}) }}" class="btn btn-show"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('accompanying_course_document_edit', {'course': accompanyingCourse.id, 'id': document.id }) }}" class="btn btn-update"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% else %}
|
|
||||||
<tr>
|
|
||||||
<td colspan="9" style="text-align:center;">
|
|
||||||
<span class="chill-no-data-statement">{{ 'Any document found'|trans }}</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
{% endif %}
|
||||||
|
|
||||||
<div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\PersonBundle\Entity\AccompanyingPeriod" data-entity-id="{{ accompanyingCourse.id }}"></div>
|
{{ chill_pagination(pagination) }}
|
||||||
|
|
||||||
|
<div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\PersonBundle\Entity\AccompanyingPeriod" data-entity-id="{{ accompanyingCourse.id }}"></div>
|
||||||
|
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE', accompanyingCourse) %}
|
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE', accompanyingCourse) %}
|
||||||
<ul class="record_actions">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="create">
|
<li class="create">
|
||||||
<a href="{{ path('accompanying_course_document_new', {'course': accompanyingCourse.id}) }}" class="btn btn-create">
|
<a href="{{ path('accompanying_course_document_new', {'course': accompanyingCourse.id}) }}" class="btn btn-create">
|
||||||
{{ 'Create'|trans }}
|
{{ 'Create'|trans }}
|
||||||
@ -76,4 +45,6 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
{% set activeRouteKey = '' %}
|
{% set activeRouteKey = '' %}
|
||||||
|
|
||||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||||
|
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{# {{ 'Detail of document of %name%'|trans({ '%name%': accompanyingCourse|chill_entity_render_string } ) }} #}
|
{# {{ 'Detail of document of %name%'|trans({ '%name%': accompanyingCourse|chill_entity_render_string } ) }} #}
|
||||||
@ -18,16 +19,18 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="document-show">
|
<div class="document-show">
|
||||||
<h1>{{ block('title') }}</h1>
|
<h1>{{ block('title') }}</h1>
|
||||||
|
|
||||||
<dl class="chill_view_data">
|
{{ mm.mimeIcon(document.object.type) }}
|
||||||
|
|
||||||
|
<dl class="chill_view_data mt-4">
|
||||||
<dt>{{ 'Title'|trans }}</dt>
|
<dt>{{ 'Title'|trans }}</dt>
|
||||||
<dd>{{ document.title }}</dd>
|
<dd>{{ document.title }}</dd>
|
||||||
|
|
||||||
{% if document.category is not null %}
|
{% if document.category is not null %}
|
||||||
<dt>{{ 'Category'|trans }}</dt>
|
<dt>{{ 'Category'|trans }}</dt>
|
||||||
<dd>{{ document.category.name|localize_translatable_string }}</dd>
|
<dd>{{ document.category.name|localize_translatable_string }}</dd>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<dt>{{ 'Description' | trans }}</dt>
|
<dt>{{ 'Description' | trans }}</dt>
|
||||||
<dd>
|
<dd>
|
||||||
{% if document.description is empty %}
|
{% if document.description is empty %}
|
||||||
@ -39,7 +42,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
||||||
@ -49,11 +52,15 @@
|
|||||||
<li>
|
<li>
|
||||||
{{ m.download_button(document.object, document.title) }}
|
{{ m.download_button(document.object, document.title) }}
|
||||||
</li>
|
</li>
|
||||||
|
{% if chill_document_is_editable(document.object) %}
|
||||||
|
<li>
|
||||||
|
{{ document.object|chill_document_edit_button }}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('accompanying_course_document_edit', {'id': document.id, 'course': accompanyingCourse.id}) }}" class="btn btn-edit">
|
<a href="{{ path('accompanying_course_document_edit', {'id': document.id, 'course': accompanyingCourse.id}) }}"
|
||||||
{{ 'Edit' | trans }}
|
class="btn btn-edit" title="{{ 'Edit attributes' | trans }}"></a>
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set workflows_frame = chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) %}
|
{% set workflows_frame = chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) %}
|
||||||
@ -65,7 +72,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block block_post_menu %}
|
{% block block_post_menu %}
|
||||||
<div class="post-menu pt-4"></div>
|
<div class="post-menu pt-4"></div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -74,4 +81,4 @@
|
|||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
{{ encore_entry_script_tags('mod_async_upload') }}
|
{{ encore_entry_script_tags('mod_async_upload') }}
|
||||||
{{ encore_entry_script_tags('mod_entity_workflow_pick') }}
|
{{ encore_entry_script_tags('mod_entity_workflow_pick') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
{# Twig way
|
||||||
|
TODO: une route, un template avec un header CHILL et un iframe
|
||||||
|
#}
|
||||||
|
<a href="{{ chill_path_add_return_path('chill_wopi_file_edit', {'fileId': document.uuid}) }}"
|
||||||
|
class="btn btn-wopilink">
|
||||||
|
{{ 'online_edit_document'|trans }}
|
||||||
|
</a>
|
||||||
|
|
@ -0,0 +1,83 @@
|
|||||||
|
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||||
|
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
||||||
|
<div class="item-bloc">
|
||||||
|
<div class="item-row">
|
||||||
|
<div class="item-col">
|
||||||
|
<div class="denomination h2">
|
||||||
|
{{ document.title }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ mm.mimeIcon(document.object.type) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p>{{ document.category.name|localize_translatable_string }}</p>
|
||||||
|
</div>
|
||||||
|
{% if document.template is not null %}
|
||||||
|
<div>
|
||||||
|
<p>{{ document.template.name.fr }}</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="item-col">
|
||||||
|
<div class="container">
|
||||||
|
{% if document.date is not null %}
|
||||||
|
<div class="dates row" style="float: right;">
|
||||||
|
<span>{{ document.createdAt|format_date('short') }}</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if document.description is not empty %}
|
||||||
|
<div class="item-row separator">
|
||||||
|
<blockquote class="chill-user-quote">
|
||||||
|
{{ document.description|chill_markdown_to_html }}
|
||||||
|
</blockquote>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="item-row separator">
|
||||||
|
<div class="item-col item-meta">
|
||||||
|
<div class="updatedBy">
|
||||||
|
{{ 'Created by'|trans }}:
|
||||||
|
<span class="user">{{ document.createdBy|chill_entity_render_string }}</span>
|
||||||
|
<span class="date">le {{ document.createdAt|format_date('long') }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{% if document.course is defined %}
|
||||||
|
<ul class="record_actions">
|
||||||
|
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS', document) %}
|
||||||
|
<li>
|
||||||
|
{{ m.download_button(document.object, document.title) }}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': accompanyingCourse.id, 'id': document.id}) }}" class="btn btn-show"></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('accompanying_course_document_edit', {'course': accompanyingCourse.id, 'id': document.id }) }}" class="btn btn-update"></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
{% else %}
|
||||||
|
<ul class="record_actions">
|
||||||
|
{% if is_granted('CHILL_PERSON_DOCUMENT_SEE_DETAILS', document) %}
|
||||||
|
<li>
|
||||||
|
{{ m.download_button(document.object, document.title) }}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('person_document_show', {'person': person.id, 'id': document.id}) }}" class="btn btn-show"></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('person_document_edit', {'person': person.id, 'id': document.id}) }}" class="btn btn-update"></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,55 @@
|
|||||||
|
{% macro mimeIcon(type) %}
|
||||||
|
|
||||||
|
{# mapping
|
||||||
|
forkawesome and mime type https://gist.github.com/colemanw/9c9a12aae16a4bfe2678de86b661d922
|
||||||
|
#}
|
||||||
|
{% set mapmime = {
|
||||||
|
'image': 'fa-file-image-o',
|
||||||
|
'audio': 'fa-file-audio-o',
|
||||||
|
'video': 'fa-file-video-o',
|
||||||
|
'application/pdf': 'fa-file-pdf-o',
|
||||||
|
'application/msword': 'fa-file-word-o',
|
||||||
|
'application/vnd.ms-word': 'fa-file-word-o',
|
||||||
|
'application/vnd.oasis.opendocument.text': 'fa-file-word-o',
|
||||||
|
'application/vnd.openxmlformats-officedocument.wordprocessingml': 'fa-file-word-o',
|
||||||
|
'application/vnd.ms-excel': 'fa-file-excel-o',
|
||||||
|
'application/vnd.openxmlformats-officedocument.spreadsheetml': 'fa-file-excel-o',
|
||||||
|
'application/vnd.oasis.opendocument.spreadsheet': 'fa-file-excel-o',
|
||||||
|
'application/vnd.ms-powerpoint': 'fa-file-powerpoint-o',
|
||||||
|
'application/vnd.openxmlformats-officedocument.presentationml': 'fa-file-powerpoint-o',
|
||||||
|
'application/vnd.oasis.opendocument.presentation': 'fa-file-powerpoint-o',
|
||||||
|
'text/plain': 'fa-file-text-o',
|
||||||
|
'text/html': 'fa-file-code-o',
|
||||||
|
'application/json': 'fa-file-code-o',
|
||||||
|
'application/gzip': 'fa-file-archive-o',
|
||||||
|
'application/zip': 'fa-file-archive-o',
|
||||||
|
} %}
|
||||||
|
|
||||||
|
{% set icon = 'fa-file-o' %}
|
||||||
|
{% for key,val in mapmime %}
|
||||||
|
{% if type starts with key %}
|
||||||
|
{% set icon = val %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{# TODO improve mapping
|
||||||
|
mime type and friendly name https://gist.github.com/rosskmurphy/3724501
|
||||||
|
#}
|
||||||
|
{% set maptype = {
|
||||||
|
'fa-file-word-o': 'office document/texte',
|
||||||
|
'fa-file-excel-o': 'office document/tableur',
|
||||||
|
'fa-file-powerpoint-o': 'office document/presentation',
|
||||||
|
} %}
|
||||||
|
|
||||||
|
{% set label = type %}
|
||||||
|
{% for key, val in maptype %}
|
||||||
|
{% if icon == key %}
|
||||||
|
{% set label = val %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<div class="metadata">
|
||||||
|
<i class="fa {{ icon }} fa-lg me-1"></i>
|
||||||
|
{{ label|capitalize }}
|
||||||
|
</div>
|
||||||
|
{% endmacro %}
|
@ -30,7 +30,9 @@
|
|||||||
{{ form_row(form.title) }}
|
{{ form_row(form.title) }}
|
||||||
{{ form_row(form.date) }}
|
{{ form_row(form.date) }}
|
||||||
{{ form_row(form.category) }}
|
{{ form_row(form.category) }}
|
||||||
{{ form_row(form.scope) }}
|
{% if form.scope is defined %}
|
||||||
|
{{ form_row(form.scope) }}
|
||||||
|
{% endif %}
|
||||||
{{ form_row(form.description) }}
|
{{ form_row(form.description) }}
|
||||||
{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }}
|
{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }}
|
||||||
|
|
||||||
|
@ -30,54 +30,24 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
|
|
||||||
|
<div class="col-md-10 col-xxl">
|
||||||
<h1>{{ 'Documents for %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}</h1>
|
<h1>{{ 'Documents for %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}</h1>
|
||||||
|
|
||||||
<table class="table table-bordered border-dark table-striped">
|
{% if documents|length == 0 %}
|
||||||
|
<p class="chill-no-data-statement">{{ 'No documents'|trans }}</p>
|
||||||
<thead>
|
{% else %}
|
||||||
<tr>
|
<div class="flex-table chill-task-list">
|
||||||
<th>{{ 'Title' | trans }}</th>
|
|
||||||
<th>{{ 'Category'|trans }}</th>
|
|
||||||
<th>{{ 'Circle' | trans }}</th>
|
|
||||||
<th>{{ 'Actions' | trans }}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for document in documents %}
|
{% for document in documents %}
|
||||||
<tr>
|
{% include 'ChillDocStoreBundle:List:list_item.html.twig' %}
|
||||||
<td>{{ document.title }}</td>
|
|
||||||
<td>{{ document.category.name|localize_translatable_string }}</td>
|
|
||||||
<td>{{ document.scope.name|localize_translatable_string }}</td>
|
|
||||||
<td>
|
|
||||||
<ul class="record_actions">
|
|
||||||
{% if is_granted('CHILL_PERSON_DOCUMENT_SEE_DETAILS', document) %}
|
|
||||||
<li>
|
|
||||||
{{ m.download_button(document.object, document.title) }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('person_document_show', {'person': person.id, 'id': document.id}) }}" class="btn btn-show"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('person_document_edit', {'person': person.id, 'id': document.id}) }}" class="btn btn-update"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% else %}
|
|
||||||
<tr>
|
|
||||||
<td colspan="9" style="text-align:center;">
|
|
||||||
<span class="chill-no-data-statement">{{ 'Any document found'|trans }}</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
{% endif %}
|
||||||
|
|
||||||
|
{{ chill_pagination(pagination) }}
|
||||||
|
|
||||||
{% if is_granted('CHILL_PERSON_DOCUMENT_CREATE', person) %}
|
{% if is_granted('CHILL_PERSON_DOCUMENT_CREATE', person) %}
|
||||||
<ul class="record_actions">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="create">
|
<li class="create">
|
||||||
<a href="{{ path('person_document_new', {'person': person.id}) }}" class="btn btn-create">
|
<a href="{{ path('person_document_new', {'person': person.id}) }}" class="btn btn-create">
|
||||||
{{ 'Create new document' | trans }}
|
{{ 'Create new document' | trans }}
|
||||||
@ -85,4 +55,6 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
{% set activeRouteKey = '' %}
|
{% set activeRouteKey = '' %}
|
||||||
|
|
||||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||||
|
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
||||||
|
|
||||||
{% block title %}{{ 'Detail of document of %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}{% endblock %}
|
{% block title %}{{ 'Detail of document of %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}{% endblock %}
|
||||||
|
|
||||||
@ -29,12 +30,16 @@
|
|||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
<h1>{{ 'Document %title%' | trans({ '%title%': document.title }) }}</h1>
|
<h1>{{ 'Document %title%' | trans({ '%title%': document.title }) }}</h1>
|
||||||
|
|
||||||
|
{{ mm.mimeIcon(document.object.type) }}
|
||||||
|
|
||||||
<dl class="chill_view_data">
|
<dl class="chill_view_data">
|
||||||
<dt>{{ 'Title'|trans }}</dt>
|
<dt>{{ 'Title'|trans }}</dt>
|
||||||
<dd>{{ document.title }}</dd>
|
<dd>{{ document.title }}</dd>
|
||||||
|
|
||||||
|
{% if document.scope is not null %}
|
||||||
<dt>{{ 'Scope' | trans }}</dt>
|
<dt>{{ 'Scope' | trans }}</dt>
|
||||||
<dd>{{ document.scope.name | localize_translatable_string }}</dd>
|
<dd>{{ document.scope.name | localize_translatable_string }}</dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<dt>{{ 'Category'|trans }}</dt>
|
<dt>{{ 'Category'|trans }}</dt>
|
||||||
<dd>{{ document.category.name|localize_translatable_string }}</dd>
|
<dd>{{ document.category.name|localize_translatable_string }}</dd>
|
||||||
@ -52,7 +57,7 @@
|
|||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a href="{{ path('person_document_index', {'person': person.id}) }}" class="btn btn-cancel">
|
<a href="{{ path('person_document_index', {'person': person.id}) }}" class="btn btn-cancel">
|
||||||
{{ 'Back to the list' | trans }}
|
{{ 'Back to the list' | trans }}
|
||||||
@ -63,6 +68,12 @@
|
|||||||
{{ m.download_button(document.object, document.title) }}
|
{{ m.download_button(document.object, document.title) }}
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
{% if chill_document_is_editable(document.object) %}
|
||||||
|
<li>
|
||||||
|
{{ document.object|chill_document_edit_button }}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
|
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('person_document_edit', {'id': document.id, 'person': person.id}) }}" class="btn btn-edit">
|
<a href="{{ path('person_document_edit', {'id': document.id, 'person': person.id}) }}" class="btn btn-edit">
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\DocStoreBundle\Templating;
|
||||||
|
|
||||||
|
use Twig\Extension\AbstractExtension;
|
||||||
|
use Twig\TwigFilter;
|
||||||
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
|
class WopiEditTwigExtension extends AbstractExtension
|
||||||
|
{
|
||||||
|
public function getFilters(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
new TwigFilter('chill_document_edit_button', [WopiEditTwigExtensionRuntime::class, 'renderEditButton'], [
|
||||||
|
'needs_environment' => true,
|
||||||
|
'is_safe' => ['html'],
|
||||||
|
]),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFunctions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
new TwigFunction('chill_document_is_editable', [WopiEditTwigExtensionRuntime::class, 'isEditable']),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\DocStoreBundle\Templating;
|
||||||
|
|
||||||
|
use ChampsLibres\WopiLib\Contract\Service\Discovery\DiscoveryInterface;
|
||||||
|
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||||
|
use Twig\Environment;
|
||||||
|
use Twig\Extension\RuntimeExtensionInterface;
|
||||||
|
use function array_key_exists;
|
||||||
|
|
||||||
|
class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface
|
||||||
|
{
|
||||||
|
public const TEMPLATE = '@ChillDocStore/Button/wopi_edit_document.html.twig';
|
||||||
|
|
||||||
|
private DiscoveryInterface $discovery;
|
||||||
|
|
||||||
|
public function __construct(DiscoveryInterface $discovery)
|
||||||
|
{
|
||||||
|
$this->discovery = $discovery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isEditable(StoredObject $document): bool
|
||||||
|
{
|
||||||
|
$mime_type = $this->discovery->discoverMimeType($document->getType());
|
||||||
|
|
||||||
|
if ([] === $mime_type) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($mime_type as $item) {
|
||||||
|
if (array_key_exists('default', $item) && 'true' === $item['default']) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function renderEditButton(Environment $environment, StoredObject $document, ?array $options = null): string
|
||||||
|
{
|
||||||
|
return $environment->render(self::TEMPLATE, [
|
||||||
|
'document' => $document,
|
||||||
|
'options' => $options,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,6 @@ services:
|
|||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
resource: "../Repository/"
|
resource: "../Repository/"
|
||||||
tags: ["doctrine.repository_service"]
|
|
||||||
|
|
||||||
Chill\DocStoreBundle\Form\DocumentCategoryType:
|
Chill\DocStoreBundle\Form\DocumentCategoryType:
|
||||||
class: Chill\DocStoreBundle\Form\DocumentCategoryType
|
class: Chill\DocStoreBundle\Form\DocumentCategoryType
|
||||||
@ -16,8 +15,10 @@ services:
|
|||||||
|
|
||||||
Chill\DocStoreBundle\Form\PersonDocumentType:
|
Chill\DocStoreBundle\Form\PersonDocumentType:
|
||||||
class: Chill\DocStoreBundle\Form\PersonDocumentType
|
class: Chill\DocStoreBundle\Form\PersonDocumentType
|
||||||
arguments:
|
autowire: true
|
||||||
- "@chill.main.helper.translatable_string"
|
autoconfigure: true
|
||||||
|
# arguments:
|
||||||
|
# - "@chill.main.helper.translatable_string"
|
||||||
tags:
|
tags:
|
||||||
- { name: form.type, alias: chill_docstorebundle_form_document }
|
- { name: form.type, alias: chill_docstorebundle_form_document }
|
||||||
|
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
services:
|
||||||
|
|
||||||
|
Chill\DocStoreBundle\Templating\:
|
||||||
|
resource: ../../Templating
|
||||||
|
autoconfigure: true
|
||||||
|
autowire: true
|
@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\DocStore;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementations of create and update traits for Document entity + template property added.
|
||||||
|
*/
|
||||||
|
final class Version20220131093117 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C5DA0FB8');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C3174800F');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C65FF1AEC');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP template_id');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP createdAt');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP updatedAt');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP createdBy_id');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP updatedBy_id');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F65DA0FB8');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F63174800F');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F665FF1AEC');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP template_id');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP createdAt');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP updatedAt');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP createdBy_id');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP updatedBy_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Implementations of create and update traits for Document entity + template property added';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD template_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD createdBy_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD updatedBy_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_doc.accompanyingcourse_document.createdAt IS \'(DC2Type:datetime_immutable)\'');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_doc.accompanyingcourse_document.updatedAt IS \'(DC2Type:datetime_immutable)\'');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F65DA0FB8 FOREIGN KEY (template_id) REFERENCES chill_docgen_template (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F63174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F665FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE INDEX IDX_A45098F65DA0FB8 ON chill_doc.accompanyingcourse_document (template_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_A45098F63174800F ON chill_doc.accompanyingcourse_document (createdBy_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_A45098F665FF1AEC ON chill_doc.accompanyingcourse_document (updatedBy_id)');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD template_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD createdBy_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD updatedBy_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_doc.person_document.createdAt IS \'(DC2Type:datetime_immutable)\'');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_doc.person_document.updatedAt IS \'(DC2Type:datetime_immutable)\'');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C5DA0FB8 FOREIGN KEY (template_id) REFERENCES chill_docgen_template (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C3174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C65FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE INDEX IDX_41DA53C5DA0FB8 ON chill_doc.person_document (template_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_41DA53C3174800F ON chill_doc.person_document (createdBy_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_41DA53C65FF1AEC ON chill_doc.person_document (updatedBy_id)');
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@ New document for %name%: Nouveau document pour %name%
|
|||||||
Editing document for %name%: Modification d'un document pour %name%
|
Editing document for %name%: Modification d'un document pour %name%
|
||||||
Edit Document: Modification d'un document
|
Edit Document: Modification d'un document
|
||||||
Update document: Modifier le document
|
Update document: Modifier le document
|
||||||
|
Edit attributes: Modifier les propriétés du document
|
||||||
Existing document: Document existant
|
Existing document: Document existant
|
||||||
No document to download: Aucun document à télécharger
|
No document to download: Aucun document à télécharger
|
||||||
'Choose a document category': Choisissez une catégorie de document
|
'Choose a document category': Choisissez une catégorie de document
|
||||||
@ -51,4 +52,7 @@ Id inside bundle: Identifiant
|
|||||||
Document class: Classe de document
|
Document class: Classe de document
|
||||||
no records found:
|
no records found:
|
||||||
Create new category: Créer une nouvelle catégorie
|
Create new category: Créer une nouvelle catégorie
|
||||||
Back to the category list: Retour à la liste
|
Back to the category list: Retour à la liste
|
||||||
|
|
||||||
|
# WOPI EDIT
|
||||||
|
online_edit_document: Éditer en ligne
|
||||||
|
@ -15,6 +15,7 @@ $chill-theme-buttons: (
|
|||||||
"action": $chill-orange,
|
"action": $chill-orange,
|
||||||
"edit": $chill-orange,
|
"edit": $chill-orange,
|
||||||
"update": $chill-orange,
|
"update": $chill-orange,
|
||||||
|
"wopilink": $chill-orange,
|
||||||
"show": $chill-blue,
|
"show": $chill-blue,
|
||||||
"view": $chill-blue,
|
"view": $chill-blue,
|
||||||
"misc": $gray-300,
|
"misc": $gray-300,
|
||||||
@ -54,6 +55,7 @@ $chill-theme-buttons: (
|
|||||||
&.btn-action,
|
&.btn-action,
|
||||||
&.btn-edit,
|
&.btn-edit,
|
||||||
&.btn-tpchild,
|
&.btn-tpchild,
|
||||||
|
&.btn-wopilink,
|
||||||
&.btn-update {
|
&.btn-update {
|
||||||
&, &:hover {
|
&, &:hover {
|
||||||
color: $light;
|
color: $light;
|
||||||
@ -66,6 +68,7 @@ $chill-theme-buttons: (
|
|||||||
&.btn-create::before,
|
&.btn-create::before,
|
||||||
&.btn-edit::before,
|
&.btn-edit::before,
|
||||||
&.btn-update::before,
|
&.btn-update::before,
|
||||||
|
&.btn-wopilink::before,
|
||||||
&.btn-show::before,
|
&.btn-show::before,
|
||||||
&.btn-view::before,
|
&.btn-view::before,
|
||||||
&.btn-save::before,
|
&.btn-save::before,
|
||||||
@ -98,6 +101,7 @@ $chill-theme-buttons: (
|
|||||||
&.btn-create::before { content: "\f067"; } // fa-plus
|
&.btn-create::before { content: "\f067"; } // fa-plus
|
||||||
&.btn-edit::before,
|
&.btn-edit::before,
|
||||||
&.btn-update::before { content: "\f040"; } // fa-pencil
|
&.btn-update::before { content: "\f040"; } // fa-pencil
|
||||||
|
&.btn-wopilink::before { content: "\f1dd"; } // fa-paragraph
|
||||||
&.btn-show::before,
|
&.btn-show::before,
|
||||||
&.btn-view::before { content: "\f06e"; } // fa-eye
|
&.btn-view::before { content: "\f06e"; } // fa-eye
|
||||||
&.btn-save::before { content: "\f0c7"; } // fa-floppy-o
|
&.btn-save::before { content: "\f0c7"; } // fa-floppy-o
|
||||||
|
@ -4,20 +4,34 @@ import {_createI18n} from "ChillMainAssets/vuejs/_js/i18n";
|
|||||||
|
|
||||||
const i18n = _createI18n({});
|
const i18n = _createI18n({});
|
||||||
|
|
||||||
|
|
||||||
|
//TODO move to chillDocStore or ChillWopi
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
tags to load module:
|
||||||
|
|
||||||
|
<span data-module="wopi-link"
|
||||||
|
data-wopi-url="{{ path('chill_wopi_file_edit', {'fileId': document.uuid}) }}"
|
||||||
|
data-doc-type="{{ document.type|e('html_attr') }}"
|
||||||
|
data-options="{{ options|json_encode }}"
|
||||||
|
></span>
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', function (e) {
|
window.addEventListener('DOMContentLoaded', function (e) {
|
||||||
document.querySelectorAll('span[data-module="wopi-link"]')
|
document.querySelectorAll('span[data-module="wopi-link"]')
|
||||||
.forEach(function (el) {
|
.forEach(function (el) {
|
||||||
createApp({
|
createApp({
|
||||||
template: '<open-wopi-link :wopiUrl="wopiUrl" :title="title" :type="type" :button="button"></open-wopi-link>',
|
template: '<open-wopi-link :wopiUrl="wopiUrl" :type="type" :options="options"></open-wopi-link>',
|
||||||
components: {
|
components: {
|
||||||
OpenWopiLink
|
OpenWopiLink
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
wopiUrl: el.dataset.wopiUrl,
|
wopiUrl: el.dataset.wopiUrl,
|
||||||
title: el.dataset.docTitle,
|
|
||||||
type: el.dataset.docType,
|
type: el.dataset.docType,
|
||||||
button: el.dataset.button ? JSON.parse(el.dataset.button) : {}
|
options: el.dataset.options !== 'null' ? JSON.parse(el.dataset.options) : {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -26,4 +40,4 @@ window.addEventListener('DOMContentLoaded', function (e) {
|
|||||||
;
|
;
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
});
|
});
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<a v-if="isOpenDocument"
|
<a v-if="isOpenDocument"
|
||||||
class="btn change-icon" :class="[isChangeClass ? button.changeClass : 'btn-edit']"
|
class="btn" :class="[
|
||||||
|
isChangeIcon ? 'change-icon' : '',
|
||||||
|
isChangeClass ? options.changeClass : 'btn-wopilink' ]"
|
||||||
@click="openModal">
|
@click="openModal">
|
||||||
|
|
||||||
<i class="fa me-2" :class="[isChangeIcon ? button.changeIcon : 'fa-pencil']"></i>
|
<i v-if="isChangeIcon" class="fa me-2" :class="options.changeIcon"></i>
|
||||||
|
|
||||||
<span v-if="!noText">
|
<span v-if="!noText">
|
||||||
{{ $t('Update_document') }}
|
{{ $t('online_edit_document') }}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@ -20,12 +22,14 @@
|
|||||||
<template v-slot:header>
|
<template v-slot:header>
|
||||||
<img class="logo" :src="logo" height="45"/>
|
<img class="logo" :src="logo" height="45"/>
|
||||||
<span class="ms-auto me-3">
|
<span class="ms-auto me-3">
|
||||||
{{ this.title }}
|
<span v-if="options.title">{{ options.title }}</span>
|
||||||
</span>
|
</span>
|
||||||
|
<!--
|
||||||
<a class="btn btn-outline-light">
|
<a class="btn btn-outline-light">
|
||||||
<i class="fa fa-save fa-fw"></i>
|
<i class="fa fa-save fa-fw"></i>
|
||||||
{{ $t('save_and_quit') }}
|
{{ $t('save_and_quit') }}
|
||||||
</a>
|
</a>
|
||||||
|
-->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:body>
|
<template v-slot:body>
|
||||||
@ -71,15 +75,11 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
title: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
button: {
|
options: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: false
|
required: false
|
||||||
}
|
}
|
||||||
@ -175,20 +175,20 @@ export default {
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
noText() {
|
noText() {
|
||||||
if (typeof this.button.noText !== 'undefined') {
|
if (typeof this.options.noText !== 'undefined') {
|
||||||
return this.button.noText === true;
|
return this.options.noText === true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
isChangeIcon() {
|
isChangeIcon() {
|
||||||
if (typeof this.button.changeIcon !== 'undefined') {
|
if (typeof this.options.changeIcon !== 'undefined') {
|
||||||
return (!(this.button.changeIcon === null || this.button.changeIcon === ''))
|
return (!(this.options.changeIcon === null || this.options.changeIcon === ''))
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
isChangeClass() {
|
isChangeClass() {
|
||||||
if (typeof this.button.changeClass !== 'undefined') {
|
if (typeof this.options.changeClass !== 'undefined') {
|
||||||
return (!(this.button.changeClass === null || this.button.changeClass === ''))
|
return (!(this.options.changeClass === null || this.options.changeClass === ''))
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ export default {
|
|||||||
i18n: {
|
i18n: {
|
||||||
messages: {
|
messages: {
|
||||||
fr: {
|
fr: {
|
||||||
Update_document: "Modifier le document",
|
online_edit_document: "Éditer en ligne",
|
||||||
save_and_quit: "Enregistrer et quitter",
|
save_and_quit: "Enregistrer et quitter",
|
||||||
loading: "Chargement de l'éditeur en ligne",
|
loading: "Chargement de l'éditeur en ligne",
|
||||||
invalid_title: "Format incompatible",
|
invalid_title: "Format incompatible",
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
|
|
||||||
{{ encore_entry_script_tags('mod_async_upload') }}
|
{{ encore_entry_script_tags('mod_async_upload') }}
|
||||||
{{ encore_entry_script_tags('mod_pickentity_type') }}
|
{{ encore_entry_script_tags('mod_pickentity_type') }}
|
||||||
{{ encore_entry_script_tags('mod_entity_workflow_subscribe') }}
|
{{ encore_entry_script_tags('mod_entity_workflow_subscribe') }}
|
||||||
|
@ -12,6 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\MainBundle\Serializer\Normalizer;
|
namespace Chill\MainBundle\Serializer\Normalizer;
|
||||||
|
|
||||||
use LogicException;
|
use LogicException;
|
||||||
|
use Symfony\Component\Serializer\Exception\NotNormalizableValueException;
|
||||||
use Symfony\Component\Serializer\Exception\RuntimeException;
|
use Symfony\Component\Serializer\Exception\RuntimeException;
|
||||||
use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
|
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
|
||||||
@ -44,7 +45,7 @@ class DiscriminatedObjectDenormalizer implements ContextAwareDenormalizerInterfa
|
|||||||
if ($this->denormalizer->supportsDenormalization($data, $localType, $format)) {
|
if ($this->denormalizer->supportsDenormalization($data, $localType, $format)) {
|
||||||
try {
|
try {
|
||||||
return $this->denormalizer->denormalize($data, $localType, $format, $context);
|
return $this->denormalizer->denormalize($data, $localType, $format, $context);
|
||||||
} catch (RuntimeException $e) {
|
} catch (RuntimeException|NotNormalizableValueException $e) {
|
||||||
$lastException = $e;
|
$lastException = $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ use Chill\MainBundle\Entity\Scope;
|
|||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Serializer\Model\Collection;
|
use Chill\MainBundle\Serializer\Model\Collection;
|
||||||
use Chill\MainBundle\Serializer\Model\Counter;
|
use Chill\MainBundle\Serializer\Model\Counter;
|
||||||
|
use Chill\MainBundle\Serializer\Normalizer\DiscriminatedObjectDenormalizer;
|
||||||
use Chill\PersonBundle\AccompanyingPeriod\Suggestion\ReferralsSuggestionInterface;
|
use Chill\PersonBundle\AccompanyingPeriod\Suggestion\ReferralsSuggestionInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||||
@ -234,17 +235,19 @@ final class AccompanyingCourseApiController extends ApiController
|
|||||||
$requestor = null;
|
$requestor = null;
|
||||||
$exceptions = [];
|
$exceptions = [];
|
||||||
|
|
||||||
foreach ([Person::class, ThirdParty::class] as $class) {
|
try {
|
||||||
try {
|
$requestor = $this->getSerializer()->deserialize(
|
||||||
$requestor = $this->getSerializer()
|
$request->getContent(),
|
||||||
->deserialize($request->getContent(), $class, $_format, []);
|
'@multi',
|
||||||
} catch (RuntimeException $e) {
|
$_format,
|
||||||
$exceptions[] = $e;
|
[DiscriminatedObjectDenormalizer::ALLOWED_TYPES => [Person::class, ThirdParty::class]]
|
||||||
}
|
);
|
||||||
|
} catch (RuntimeException $e) {
|
||||||
|
$exceptions[] = $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $requestor) {
|
if (null === $requestor) {
|
||||||
throw new BadRequestException('Could not find any person or requestor', 0, $exceptions[0]);
|
throw new BadRequestException('Could not find any person or thirdparty', 0, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
$accompanyingPeriod->setRequestor($requestor);
|
$accompanyingPeriod->setRequestor($requestor);
|
||||||
|
@ -44,7 +44,7 @@ class UserAccompanyingPeriodController extends AbstractController
|
|||||||
);
|
);
|
||||||
|
|
||||||
return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [
|
return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [
|
||||||
'accompanyingPeriods' => $accompanyingPeriods,
|
'accompanyingds' => $accompanyingPeriods,
|
||||||
'pagination' => $pagination,
|
'pagination' => $pagination,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,11 @@ class AccompanyingPeriodWorkVoter extends Voter
|
|||||||
case self::SEE:
|
case self::SEE:
|
||||||
return $this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $subject->getAccompanyingPeriod());
|
return $this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $subject->getAccompanyingPeriod());
|
||||||
|
|
||||||
|
case self::CREATE:
|
||||||
|
case self::UPDATE:
|
||||||
|
return $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod());
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new UnexpectedValueException("attribute {$attribute} is not supported");
|
throw new UnexpectedValueException("attribute {$attribute} is not supported");
|
||||||
}
|
}
|
||||||
@ -66,6 +71,9 @@ class AccompanyingPeriodWorkVoter extends Voter
|
|||||||
case self::SEE:
|
case self::SEE:
|
||||||
return $this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $subject);
|
return $this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $subject);
|
||||||
|
|
||||||
|
case self::CREATE:
|
||||||
|
return $this->security->isGranted(AccompanyingPeriodVoter::CREATE, $subject);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new UnexpectedValueException(sprintf(
|
throw new UnexpectedValueException(sprintf(
|
||||||
"attribute {$attribute} is not supported on instance %s",
|
"attribute {$attribute} is not supported on instance %s",
|
||||||
@ -79,6 +87,6 @@ class AccompanyingPeriodWorkVoter extends Voter
|
|||||||
|
|
||||||
private function getRoles(): array
|
private function getRoles(): array
|
||||||
{
|
{
|
||||||
return [self::SEE];
|
return [self::SEE, self::CREATE, self::UPDATE];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,8 @@ class AccompanyingPeriodContext implements
|
|||||||
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
|
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
|
||||||
{
|
{
|
||||||
$doc = new AccompanyingCourseDocument();
|
$doc = new AccompanyingCourseDocument();
|
||||||
$doc->setTitle($this->translatableStringHelper->localize($template->getName()))
|
$doc->setTemplate($template)
|
||||||
|
->setTitle($this->translatableStringHelper->localize($template->getName()))
|
||||||
->setDate(new DateTime())
|
->setDate(new DateTime())
|
||||||
->setDescription($this->translatableStringHelper->localize($template->getName()))
|
->setDescription($this->translatableStringHelper->localize($template->getName()))
|
||||||
->setCourse($entity)
|
->setCourse($entity)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user