Commit 87721785 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Module Dépôt de thèse : diminution du temps d'affichage initial des pages (en...

Module Dépôt de thèse : diminution du temps d'affichage initial des pages (en supprimant le chargement asynchrone par bloc).
parent d9bd5da7
Loading
Loading
Loading
Loading
+1 −0
Changes for CHANGELOG.md: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ Journal des modifications
- La convention de MEL possède désormais son template Twig modifiable (via unicaen/renderer).
- Formulaires Métadonnées et Rdv BU : saisie des mots clés comme des tags réordonnables
- Bandeau et pied de page de couleur rouge sur la version de test/démo et verte sur la version de dev.
- Module Dépôt de thèse : diminution du temps d'affichage initial des pages (en supprimant le chargement asynchrone par bloc).
- Module Doctorant :
  - Recherche des doctorants, avec possibilité de filtrage par ED/UR/Étab (en fonction de l'utilisateur connecté)
  - Tableau de bord visible par le doctorant (dès la page d'accueil), ainsi que par la Maison du doctorat/Gestionnaire d'ED/UR/Responsable d'ED/UR
+17 −17
Changes for module/Application/src/Application/Controller/Plugin/Forward.php: 17 added lines, 17 removed lines.
Original line number Diff line number Diff line
@@ -3,11 +3,12 @@
namespace Application\Controller\Plugin;

use Application\RouteMatch;
use UnicaenApp\Service\EntityManagerAwareInterface;
use UnicaenApp\Service\EntityManagerAwareTrait;
use Laminas\Mvc\Controller\Plugin\Forward as ForwardPlugin;
use Laminas\Mvc\Exception\DomainException;
use Laminas\Mvc\InjectApplicationEventInterface;
use Laminas\Stdlib\Parameters;
use UnicaenApp\Service\EntityManagerAwareInterface;
use UnicaenApp\Service\EntityManagerAwareTrait;

/**
 * Created by PhpStorm.
@@ -33,12 +34,12 @@ class Forward extends ForwardPlugin implements EntityManagerAwareInterface

        // Allow passing parameters to seed the RouteMatch with & copy matched route name
        if ($params !== null) {
            // début modif
//            $routeMatch = new RouteMatch($params);
//            $routeMatch->setMatchedRouteName($event->getRouteMatch()->getMatchedRouteName());
            $routeMatch = $this->createRouteMatch($params, $event->getRouteMatch()->getMatchedRouteName());
            $routeMatch = new RouteMatch($params);
            $routeMatch->setMatchedRouteName($event->getRouteMatch()->getMatchedRouteName());
            ///////////// debut ajout /////////////
            $routeMatch->setEntityManager($this->getEntityManager());
            ///////////// fin ajout /////////////
            $event->setRouteMatch($routeMatch);
            // fin modif
        }

        if ($this->numNestedForwards > $this->maxNestedForwards) {
@@ -50,7 +51,15 @@ class Forward extends ForwardPlugin implements EntityManagerAwareInterface
        $sharedEvents = $event->getApplication()->getEventManager()->getSharedManager();
        $listeners = $this->detachProblemListeners($sharedEvents);

        $return = $controller->dispatch($event->getRequest(), $event->getResponse());
        ///////////// debut modif /////////////
//        $return = $controller->dispatch($request, $event->getResponse());
        // Incroyable mais vrai : les query params passent à l'as !!
        /** @var \Laminas\Http\Request $request */
        $request = $event->getRequest();
        $request->setQuery(new Parameters($params['query'] ?? []));

        $return = $controller->dispatch($request, $event->getResponse());
        ///////////// fin modif /////////////

        // If we detached any listeners, reattach them now:
        $this->reattachProblemListeners($sharedEvents, $listeners);
@@ -59,13 +68,4 @@ class Forward extends ForwardPlugin implements EntityManagerAwareInterface

        return $return;
    }

    private function createRouteMatch($params, $matchedRouteName)
    {
        $routeMatch = new RouteMatch($params);
        $routeMatch->setMatchedRouteName($matchedRouteName);
        $routeMatch->setEntityManager($this->getEntityManager());

        return $routeMatch;
    }
}
 No newline at end of file
+1 −1
Changes for module/Application/src/Application/View/Renderer/PhpRenderer.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ use UnicaenIdref\View\Helper\IdrefLinkViewHelper;
 * @method string                                                    partialloop($name = null, $values = null)
 * @method \Laminas\View\Helper\Partial|string                          partial($name = null, $values = null)
 * @method \Laminas\View\Helper\Placeholder                             placeholder($name = null)
 * @method string                                                    renderchildmodel($child)
 * @method string                                                    renderChildModel($child)
 * @method \Laminas\View\Helper\RenderToPlaceholder                     rendertoplaceholder($script, $placeholder)
 * @method string                                                    serverurl($requestUri = null)
 * @method \Laminas\View\Helper\ViewModel                               viewmodel()
+7 −0
Changes for module/Depot/config/others/depot.config.php: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -19,6 +19,10 @@ use Depot\Controller\Factory\DepotControllerFactory;
use Depot\Controller\Factory\ObserverControllerFactory;
use Depot\Controller\ObserverController;
use Depot\Controller\Plugin\Url\UrlDepotPluginFactory;
use Depot\Dispatch\Depot\DispatchService as DepotDispatchService;
use Depot\Dispatch\Depot\DispatchServiceFactory as DepotDispatchServiceFactory;
use Depot\Dispatch\Workflow\DispatchService as WorkflowDispatchService;
use Depot\Dispatch\Workflow\DispatchServiceFactory as WorkflowDispatchServiceFactory;
use Depot\Entity\Db\WfEtape;
use Depot\Feature\Features;
use Depot\Feature\FournirExemplairePapierTheseFeature;
@@ -1087,6 +1091,9 @@ return [
            // rules
            RemiseExemplairePapierRule::class => RemiseExemplairePapierRuleFactory::class,
            SuppressionAttestationsRequiseRule::class => SuppressionAttestationsRequiseRuleFactory::class,
            // dispatch
            DepotDispatchService::class => DepotDispatchServiceFactory::class,
            WorkflowDispatchService::class => WorkflowDispatchServiceFactory::class,
        ],
        //PageDeCouverturePdfExporter ne doit pas être un singleton afin d'éviter des erreurs de chemins de templates
        'shared' => [
+122 −35
Changes for module/Depot/src/Depot/Controller/DepotController.php: 122 added lines, 35 removed lines.
Original line number Diff line number Diff line
@@ -5,9 +5,6 @@ namespace Depot\Controller;
use Application\Command\Exception\TimedOutCommandException;
use Application\Controller\AbstractController;
use Application\Entity\Db\Role;
use DateTime;
use Depot\Rule\RemiseExemplairePapierRuleAwareTrait;
use Validation\Entity\Db\TypeValidation;
use Application\Entity\Db\Variable;
use Application\Filter\IdifyFilterAwareTrait;
use Application\Service\DomaineHal\DomaineHalServiceAwareTrait;
@@ -15,9 +12,11 @@ use Application\Service\MailConfirmationServiceAwareTrait;
use Application\Service\Role\ApplicationRoleServiceAwareTrait;
use Application\Service\UserContextServiceAwareTrait;
use Application\Service\Utilisateur\UtilisateurServiceAwareTrait;
use Validation\Service\ValidationThese\ValidationTheseServiceAwareTrait;
use Application\Service\Variable\VariableServiceAwareTrait;
use Application\Utils\FormUtils;
use DateTime;
use Depot\Dispatch\Depot\DispatchServiceAwareTrait as DepotDispatchServiceAwareTrait;
use Depot\Dispatch\Workflow\DispatchServiceAwareTrait as WorkflowDispatchServiceAwareTrait;
use Depot\Entity\Db\Attestation;
use Depot\Entity\Db\Diffusion;
use Depot\Entity\Db\FichierThese;
@@ -33,10 +32,10 @@ use Depot\Form\Metadonnees\MetadonneeTheseFieldset;
use Depot\Form\PointsDeVigilanceForm;
use Depot\Form\RdvBuTheseDoctorantForm;
use Depot\Form\RdvBuTheseForm;
use Depot\Rule\RemiseExemplairePapierRuleAwareTrait;
use Depot\Service\FichierThese\Exception\ValidationImpossibleException;
use Depot\Service\FichierThese\FichierTheseServiceAwareTrait;
use Depot\Service\Notification\DepotNotificationFactoryAwareTrait;
use Depot\Service\These\Convention\ConventionPdfExporter;
use Depot\Service\These\DepotServiceAwareTrait;
use Depot\Service\Validation\DepotValidationServiceAwareTrait;
use Depot\Service\Workflow\WorkflowServiceAwareTrait;
@@ -44,7 +43,6 @@ use Doctrine\ORM\OptimisticLockException;
use Fichier\Entity\Db\NatureFichier;
use Fichier\Entity\Db\VersionFichier;
use Fichier\Service\Fichier\FichierStorageServiceAwareTrait;
use Fichier\Service\Storage\Adapter\Exception\StorageAdapterException;
use Fichier\Service\VersionFichier\VersionFichierServiceAwareTrait;
use Laminas\EventManager\Event;
use Laminas\Form\Element\Hidden;
@@ -55,7 +53,6 @@ use Laminas\InputFilter\InputFilter;
use Laminas\Stdlib\ParametersInterface;
use Laminas\View\Model\ViewModel;
use Laminas\View\Renderer\PhpRenderer;
use Mpdf\MpdfException;
use Notification\Service\NotifierServiceAwareTrait;
use Structure\Service\Etablissement\EtablissementServiceAwareTrait;
use Structure\Service\UniteRecherche\UniteRechercheServiceAwareTrait;
@@ -65,6 +62,8 @@ use UnicaenApp\Exception\RuntimeException;
use UnicaenApp\Service\EntityManagerAwareTrait;
use UnicaenApp\Service\MessageCollectorAwareTrait;
use UnicaenApp\Traits\MessageAwareInterface;
use Validation\Entity\Db\TypeValidation;
use Validation\Service\ValidationThese\ValidationTheseServiceAwareTrait;

class DepotController extends AbstractController
{
@@ -90,6 +89,9 @@ class DepotController extends AbstractController
    use UtilisateurServiceAwareTrait;
    use DomaineHalServiceAwareTrait;

    use DepotDispatchServiceAwareTrait;
    use WorkflowDispatchServiceAwareTrait;

    use RemiseExemplairePapierRuleAwareTrait;

    private $timeoutRetraitement;
@@ -247,7 +249,7 @@ class DepotController extends AbstractController
        return $view;
    }

    public function detailDescriptionAction()
    public function detailDescriptionAction(): ViewModel
    {
        $these = $this->requestedThese();

@@ -259,6 +261,14 @@ class DepotController extends AbstractController
                WfEtape::PSEUDO_ETAPE_FINALE,
            ]),
        ]);

        /** @see \Depot\Controller\WorkflowController::nextStepBoxAction() */
        $nextStepBoxViewModel = $this->workflowDispatchService->dispatchNextStepBox($this, $these, null, [
            WfEtape::CODE_SIGNALEMENT_THESE,
            WfEtape::PSEUDO_ETAPE_FINALE,
        ]);
        $view->addChild($nextStepBoxViewModel, 'nextStepBoxViewModel');

        $view->setTemplate('depot/depot/description');

        return $view;
@@ -275,7 +285,7 @@ class DepotController extends AbstractController

        $informations = $this->theseService->fetchInformationsPageDeCouverture($these);

        return new ViewModel([
        $view = new ViewModel([
            'these'            => $these,
            'validation'       => $validation ?: null,
            'apercevoirPdcUrl' => $this->urlFichierThese()->apercevoirPageDeCouverture($these),
@@ -286,9 +296,15 @@ class DepotController extends AbstractController
            'informations'     => $informations,
            'msgCollector'     => $this->getServiceMessageCollector(),
        ]);

        /** @see \Depot\Controller\WorkflowController::nextStepBoxAction() */
        $nextStepBoxViewModel = $this->workflowDispatchService->dispatchNextStepBox($this, $these, null, [WfEtape::CODE_VALIDATION_PAGE_DE_COUVERTURE]);
        $view->addChild($nextStepBoxViewModel, 'nextStepBoxViewModel');

        return $view;
    }

    public function detailDepotAction()
    public function detailDepotAction(): ViewModel
    {
        return $this->detailDepotActionViewModel();
    }
@@ -298,11 +314,7 @@ class DepotController extends AbstractController
        return $this->detailDepotActionViewModel(true);
    }

    /**
     * @param bool $versionCorrigee
     * @return ViewModel
     */
    private function detailDepotActionViewModel($versionCorrigee = false)
    private function detailDepotActionViewModel(bool $versionCorrigee = false): ViewModel
    {
        $these = $this->requestedThese();

@@ -313,6 +325,7 @@ class DepotController extends AbstractController
        $view = new ViewModel([
            'these' => $these,
            'versionCorrigee' => $versionCorrigee,

            'theseUrl'         => $this->urlDepot()->depotFichiers($these, NatureFichier::CODE_THESE_PDF, $codeVersion),
            'annexesUrl'       => $this->urlDepot()->depotFichiers($these, NatureFichier::CODE_FICHIER_NON_PDF, $codeVersion),
            'attestationUrl'   => $this->urlDepot()->attestationThese($these, $codeVersion),
@@ -325,6 +338,35 @@ class DepotController extends AbstractController
            ]),
        ]);

        /** @see \Depot\Controller\DepotController::theseAction() */
        $theseViewModel = $this->depotDispatchService->depotFichiersDispatch($this, $these, NatureFichier::CODE_THESE_PDF, $codeVersion);
        $view->addChild($theseViewModel, 'theseViewModel');

        /** @see \Depot\Controller\DepotController::annexesAction() */
        $annexesViewModel = $this->depotDispatchService->depotFichiersDispatch($this, $these, NatureFichier::CODE_FICHIER_NON_PDF, $codeVersion);
        $view->addChild($annexesViewModel, 'annexesViewModel');

        /** @see \Depot\Controller\DepotController::diffusionAction() */
        $diffusionViewModel = $this->depotDispatchService->diffusionTheseDispatch($this, $these, $codeVersion);
        if ($diffusionViewModel instanceof ViewModel) {
            $view->addChild($diffusionViewModel, 'diffusionViewModel');
        }

        /** @see \Depot\Controller\DepotController::attestationAction() */
        $attestationViewModel = $this->depotDispatchService->attestationTheseDispatch($this, $these, $codeVersion);
        if ($attestationViewModel instanceof ViewModel) {
            $view->addChild($attestationViewModel, 'attestationViewModel');
        }

        /** @see \Depot\Controller\WorkflowController::nextStepBoxAction() */
        $nextStepBoxViewModel = $this->workflowDispatchService->dispatchNextStepBox($this, $these, null, [
            $versionCorrigee ? WfEtape::CODE_DEPOT_VERSION_ORIGINALE_CORRIGEE : WfEtape::CODE_DEPOT_VERSION_ORIGINALE,
            $versionCorrigee ? WfEtape::CODE_ATTESTATIONS_VERSION_CORRIGEE : WfEtape::CODE_ATTESTATIONS,
            $versionCorrigee ? WfEtape::CODE_AUTORISATION_DIFFUSION_THESE_VERSION_CORRIGEE : WfEtape::CODE_AUTORISATION_DIFFUSION_THESE,
            WfEtape::PSEUDO_ETAPE_FINALE,
        ]);
        $view->addChild($nextStepBoxViewModel, 'nextStepBoxViewModel');

        $view->setTemplate('depot/depot/depot');

        return $view;
@@ -371,7 +413,7 @@ class DepotController extends AbstractController
     * @param bool $versionCorrigee
     * @return Response|ViewModel
     */
    private function detailArchivageActionViewModel($versionCorrigee = false)
    private function detailArchivageActionViewModel(bool $versionCorrigee = false): Response|ViewModel
    {
        $these = $this->requestedThese();

@@ -432,8 +474,39 @@ class DepotController extends AbstractController
                WfEtape::PSEUDO_ETAPE_FINALE,
            ]),
        ]);

        $view->setTemplate('depot/depot/archivage');

        /** @see \Depot\Controller\DepotController::testArchivabiliteAction() */
        $testArchivabiliteViewModel = $this->depotDispatchService->testArchivabiliteDispatch($this, $these, $version);
        $view->addChild($testArchivabiliteViewModel, 'testArchivabiliteViewModel');

        /** @see \Depot\Controller\DepotController::theseRetraiteeAction() */
        $theseRetraiteeViewModel = $this->depotDispatchService->depotFichiersDispatch($this, $these, NatureFichier::CODE_THESE_PDF, $version, true);
        $view->addChild($theseRetraiteeViewModel, 'theseRetraiteeViewModel');

        /** @see \Depot\Controller\DepotController::archivabiliteTheseAction() */
        $archivabiliteTheseViewModel = $this->depotDispatchService->archivabiliteTheseDispatch($this, $these, $version, true);
        $view->addChild($archivabiliteTheseViewModel, 'archivabiliteTheseViewModel');

        /** @see \Depot\Controller\DepotController::conformiteTheseRetraiteeAction() */
        $conformiteTheseRetraiteeViewModel = $this->depotDispatchService->conformiteTheseRetraiteeDispatch($this, $these, $version, true);
        $view->addChild($conformiteTheseRetraiteeViewModel, 'conformiteTheseRetraiteeViewModel');

        /** @see \Depot\Controller\WorkflowController::nextStepBoxAction() */
        $nextStepBoxViewModel = $this->workflowDispatchService->dispatchNextStepBox($this, $these, null, [
            WfEtape::CODE_ARCHIVABILITE_VERSION_ORIGINALE,
            WfEtape::CODE_ARCHIVABILITE_VERSION_ORIGINALE_CORRIGEE,
            WfEtape::CODE_ARCHIVABILITE_VERSION_ARCHIVAGE,
            WfEtape::CODE_ARCHIVABILITE_VERSION_ARCHIVAGE_CORRIGEE,
            WfEtape::CODE_DEPOT_VERSION_ARCHIVAGE,
            WfEtape::CODE_DEPOT_VERSION_ARCHIVAGE_CORRIGEE,
            WfEtape::CODE_VERIFICATION_VERSION_ARCHIVAGE,
            WfEtape::CODE_VERIFICATION_VERSION_ARCHIVAGE_CORRIGEE,
            WfEtape::PSEUDO_ETAPE_FINALE,
        ]);
        $view->addChild($nextStepBoxViewModel, 'nextStepBoxViewModel');

        return $view;
    }

@@ -476,6 +549,13 @@ class DepotController extends AbstractController
            'remiseExemplairePapierRequiredResult' => $remiseExemplairePapierRequiredResult,
        ]);

        /** @see \Depot\Controller\WorkflowController::nextStepBoxAction() */
        $nextStepBoxViewModel = $this->workflowDispatchService->dispatchNextStepBox($this, $these, null, [
            WfEtape::CODE_RDV_BU_SAISIE_DOCTORANT,
            WfEtape::CODE_RDV_BU_VALIDATION_BU,
        ]);
        $view->addChild($nextStepBoxViewModel, 'nextStepBoxViewModel');

        $view->setTemplate('depot/depot/rdv-bu' . ($estDoctorant ? '-doctorant' : null));

        return $view;
@@ -735,13 +815,13 @@ class DepotController extends AbstractController
            sprintf("Thèse %s au format PDF", $estCorrige ? "corrigée" : "");

        $form = $this->uploader()->getForm();
        $form->setAttribute('id', uniqid('form-'));
//        $form->addElement((new Hidden('annexe'))->setValue(0));
        $form->addElement((new Hidden('nature'))->setValue($this->idify($nature)));
        $form->addElement((new Hidden('version'))->setValue($this->idify($version)));
        if ($validerAuto) {
            $form->addElement((new Hidden('validerAuto'))->setValue(1));
        }
//        $form->setAttribute('id', uniqid('form-'));
////        $form->addElement((new Hidden('annexe'))->setValue(0));
//        $form->addElement((new Hidden('nature'))->setValue($this->idify($nature)));
//        $form->addElement((new Hidden('version'))->setValue($this->idify($version)));
//        if ($validerAuto) {
//            $form->addElement((new Hidden('validerAuto'))->setValue(1));
//        }

        $view = new ViewModel([
            'titre'          => $titre,
@@ -751,7 +831,9 @@ class DepotController extends AbstractController
            'theseListUrl'   => $this->urlFichierThese()->listerFichiers($these, $nature, $version, false, ['inclureValidite' => $inclureValidite]),
            'nature'         => $nature,
            'versionFichier' => $version,
            'validerAuto' => $validerAuto,
        ]);

        $view->setTemplate('depot/depot/depot/these');

        return $view;
@@ -852,11 +934,11 @@ class DepotController extends AbstractController
            sprintf("Fichiers %s expurgés hors PDF", $estCorrige ? "corrigés" : "") :
            sprintf("Fichiers %s hors PDF", $estCorrige ? "corrigés" : "");

        $form = $this->uploader()->getForm();
        $form->setAttribute('id', uniqid('form-'));
        $form->addElement((new Hidden('annexe'))->setValue(1));
        $form->addElement((new Hidden('nature'))->setValue($this->idify($nature)));
        $form->addElement((new Hidden('version'))->setValue($this->idify($version)));
//        $form = $this->uploader()->getForm();
//        $form->setAttribute('id', uniqid('form-'));
//        $form->addElement((new Hidden('annexe'))->setValue(1));
//        $form->addElement((new Hidden('nature'))->setValue($this->idify($nature)));
//        $form->addElement((new Hidden('version'))->setValue($this->idify($version)));

        $view = new ViewModel([
            'titre'          => $titre,
@@ -1252,16 +1334,21 @@ class DepotController extends AbstractController
        return $this->attestationTheseForm;
    }

    private function isEtapeDiffusionVisible(These $these, VersionFichier $version)
    private function isEtapeDiffusionVisible(These $these, VersionFichier $version): bool
    {
        $versionInitialeAtteignable = $this->workflowService->findOneByEtape($these, WfEtape::CODE_AUTORISATION_DIFFUSION_THESE)->getAtteignable();
        $versionCorrigeeAtteignable = $this->workflowService->findOneByEtape($these, WfEtape::CODE_AUTORISATION_DIFFUSION_THESE_VERSION_CORRIGEE)->getAtteignable();
        return
            $version->estVersionCorrigee() && $versionCorrigeeAtteignable ||
            !$version->estVersionCorrigee() && $versionInitialeAtteignable /*&& !$versionCorrigeeAtteignable*/;
//        $versionInitialeAtteignable = $this->workflowService->findOneByEtape($these, WfEtape::CODE_AUTORISATION_DIFFUSION_THESE)->getAtteignable();
//        $versionCorrigeeAtteignable = $this->workflowService->findOneByEtape($these, WfEtape::CODE_AUTORISATION_DIFFUSION_THESE_VERSION_CORRIGEE)->getAtteignable();
//        return
//            $version->estVersionCorrigee() && $versionCorrigeeAtteignable ||
//            !$version->estVersionCorrigee() && $versionInitialeAtteignable /*&& !$versionCorrigeeAtteignable*/;
        if ($version->estVersionCorrigee()) {
            return $this->workflowService->findOneByEtape($these, WfEtape::CODE_AUTORISATION_DIFFUSION_THESE_VERSION_CORRIGEE)->getAtteignable();
        } else {
            return $this->workflowService->findOneByEtape($these, WfEtape::CODE_AUTORISATION_DIFFUSION_THESE)->getAtteignable();
        }
    }

    public function diffusionAction()
    public function diffusionAction(): false|ViewModel
    {
        $these = $this->requestedThese();
        $version = $this->fichierTheseService->fetchVersionFichier($this->params()->fromQuery('version'));
Loading