diff --git a/compose.yaml b/compose.yaml index cc53554..d705e1c 100644 --- a/compose.yaml +++ b/compose.yaml @@ -27,6 +27,7 @@ services: - ./templates:/app/templates:delegated - ./config:/app/config:delegated - ./public/uploads:/app/public/uploads:delegated + - ./uploads:/app/uploads:delegated - ./misc:/app/misc:delegated - ./public/lib:/app/public/lib:delegated - ./.env.local:/app/.env.local diff --git a/src/Controller/FileController.php b/src/Controller/FileController.php new file mode 100644 index 0000000..ee1bc15 --- /dev/null +++ b/src/Controller/FileController.php @@ -0,0 +1,26 @@ +query->get('path', ''); + + try { + $files = $fileService->list($id, ''); + + return $this->json(['files' => $files]); + } catch (\Exception $e) { + return $this->json(['error' => $e->getMessage()], 400); + } + } +} diff --git a/src/Entity/Project.php b/src/Entity/Project.php index 08fdaa2..516384e 100644 --- a/src/Entity/Project.php +++ b/src/Entity/Project.php @@ -12,6 +12,7 @@ use Doctrine\ORM\Mapping as ORM; class Project { #[ORM\Id] + #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; @@ -40,13 +41,6 @@ class Project return $this->id; } - public function setId(int $id): static - { - $this->id = $id; - - return $this; - } - public function getTitle(): ?string { return $this->title; diff --git a/src/Form/ProjectType.php b/src/Form/ProjectType.php index 198b4bb..376512a 100644 --- a/src/Form/ProjectType.php +++ b/src/Form/ProjectType.php @@ -6,6 +6,7 @@ use App\Entity\Project; use App\Entity\User; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; @@ -25,6 +26,10 @@ class ProjectType extends AbstractType 'label' => 'Titre', ]) + ->add('status', ChoiceType::class, [ + 'choices' => ['Brouillon' => 0], + ]) + ->add('users', EntityType::class, [ 'label' => 'Propriétaires', 'class' => User::class, diff --git a/src/Service/FileService.php b/src/Service/FileService.php new file mode 100644 index 0000000..9dee7b7 --- /dev/null +++ b/src/Service/FileService.php @@ -0,0 +1,48 @@ +basePath = realpath(__DIR__.'/../../uploads'); + if (!$this->basePath) { + throw new \RuntimeException('Répertoire /uploads introuvable.'); + } + } + + /** + * Liste les fichiers/dossiers pour un projet donné + */ + public function list(string $projectId, string $relativePath = ''): array + { + $targetPath = $this->basePath.'/'.$projectId.'/'.ltrim($relativePath, '/'); + $realPath = realpath($targetPath); + + // Sécurité : protection contre les accès hors du dossier projet + if (!$realPath || !str_starts_with($realPath, $this->basePath.'/'.$projectId)) { + throw new NotFoundHttpException('Répertoire non autorisé ou inexistant.'); + } + + $finder = new Finder(); + $finder->depth('== 0')->in($realPath); + + $results = []; + foreach ($finder as $file) { + $results[] = [ + 'name' => $file->getFilename(), + 'isDirectory' => $file->isDir(), + 'path' => ltrim(str_replace($this->basePath.'/'.$projectId, '', $file->getRealPath()), '/'), + ]; + } + + return $results; + } +} diff --git a/templates/issue/edit.html.twig b/templates/issue/edit.html.twig deleted file mode 100644 index d94cd24..0000000 --- a/templates/issue/edit.html.twig +++ /dev/null @@ -1,46 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block localstyle %} - -{% endblock %} - -{% block title %} - = Modification Issue = {{title}} -{% endblock %} - -{% block body %} -
Id | -Projet | -Nom | -Statut | -Sprint | -Version | -Tracker | -Catégorie | -Affecté à | -Point | -
---|---|---|---|---|---|---|---|---|---|
#{{issue.id}} | -{{issue.project.title}} | -{{issue.redmine.subject}} | -{{'%02d'|format(issue.rowStatus)}}-{{issue.redmine.status.name}} | -{{issue.sprintName}} | -{{issue.versionName}} | -{{issue.redmine.tracker.name}} | -{{issue.categoryName}} | -{{issue.assignedName}} | -{{issue.redmine.sprint.story_points}} | -
{{ issue.redmine.description|textile_to_html|raw }}
-Action | -Label Redmine | -Label Ninemine | -
---|---|---|
- | {{label.labelRedmine}} | -{{label.labelNinemine}} | -