From 5762df8df92249fcf78881ede48fb4d562affc99 Mon Sep 17 00:00:00 2001 From: afornerot Date: Mon, 28 Jul 2025 17:38:40 +0200 Subject: [PATCH] svg --- compose.yaml | 1 + src/Controller/FileController.php | 26 ++ src/Entity/Project.php | 8 +- src/Form/ProjectType.php | 5 + src/Service/FileService.php | 48 +++ templates/issue/edit.html.twig | 46 --- templates/issue/list.html.twig | 465 ------------------------------ templates/issue/view.html.twig | 109 ------- templates/label/edit.html.twig | 37 --- templates/label/list.html.twig | 42 --- templates/project/edit.html.twig | 6 +- templates/project/list.html.twig | 9 +- 12 files changed, 89 insertions(+), 713 deletions(-) create mode 100644 src/Controller/FileController.php create mode 100644 src/Service/FileService.php delete mode 100644 templates/issue/edit.html.twig delete mode 100644 templates/issue/list.html.twig delete mode 100644 templates/issue/view.html.twig delete mode 100644 templates/label/edit.html.twig delete mode 100644 templates/label/list.html.twig 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 %} -

- Modification Issue
-

- {{title}} -
-
- - {{ form_start(form) }} - {{ form_widget(form.submit) }} - Annuler - - {% include('include/error.html.twig') %} - -
-
-
-
Information
-
- {{ form_row(form.color) }} -
-
-
-
- {{ form_end(form) }} - -{% endblock %} - -{% block localscript %} - -{% endblock %} diff --git a/templates/issue/list.html.twig b/templates/issue/list.html.twig deleted file mode 100644 index 0aec247..0000000 --- a/templates/issue/list.html.twig +++ /dev/null @@ -1,465 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block localstyle %} - -{% endblock %} - -{% block title %} - = Liste des Issues -{% endblock %} - -{% block body %} -

- Liste des Issues -

- -
-
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
-
- -
-
- - - - - - - - - - - - - - - - - {% for issue in issues %} - - - - - - - - - - - - - {% endfor %} - -
IdProjetNomStatutSprintVersionTrackerCatégorieAffecté à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}}
-
- - -
-
-{% endblock %} - -{% block localscript %} - -{% endblock %} diff --git a/templates/issue/view.html.twig b/templates/issue/view.html.twig deleted file mode 100644 index 72e7742..0000000 --- a/templates/issue/view.html.twig +++ /dev/null @@ -1,109 +0,0 @@ -
-
-
-
#{{ issue.redmine.id }} = {{ issue.redmine.subject }}
- - -
-
- -
- Projet : {{ issue.redmine.project.name }} • Tracker : {{ issue.redmine.tracker.name }} - {% if issue.redmine.custom_fields is defined %} - {% for field in issue.redmine.custom_fields %} - {% if field.id==11 and field.value!="" %} - {{ field.name }} = {{field.value|split('/')|last}} - {% endif %} - {% endfor %} - {% endif %} -
-
- Modifier -
-
- -
-
-
- Tracker = {{issue.redmine.tracker.name}}
- Catégorie = {{issue.categoryName}}
- Statut = {{ issue.redmine.status.name }}
- Priorité = {{ issue.redmine.priority.name }}

- Sprint = {{issue.sprintName}}
- Version Cible = {{issue.versionName}}
- Story Point = {{issue.redmine.sprint.story_points}}
-
- -
- Auteur = {{ issue.redmine.author.name }}
- Progression = {{ issue.redmine.done_ratio }}%
- Créé le ={{ issue.redmine.created_on|date('d/m/Y H:i') }}
- Mis à jour le ={{ issue.redmine.updated_on|date('d/m/Y H:i') }}
- Date de début = {{ issue.redmine.start_date|date('d/m/Y') }}
- Date de fin = {{ issue.redmine.due_date|date('d/m/Y') }}

- - Affecté à = {{issue.assignedName}}
-
-
- -
- {% if issue.redmine.custom_fields is defined %} - {% for field in issue.redmine.custom_fields %} - {% if field.id==32 %} -
- {{ field.name }}
- {{ field.value|textile_to_html|raw }}
- {% endif %} - {% endfor %} - {% endif %} -
- -
- {% if issue.parent %} -
- Issues Parentes -
- #{{ issue.parent.id }} = {{ issue.parent.redmine.subject }} -
- {% endif %} - - {% for child in issue.childs %} - {% if loop.first %} -
- Issues Liées - {%endif%} -
- #{{ child.id }} = {{ child.redmine.subject }} -
- {% endfor %} -
- - {% if issue.redmine.description %} -
-
- Description : -

{{ issue.redmine.description|textile_to_html|raw }}

-
-
- {% endif %} - - {% if issue.redmine.journals is defined %} - {% for journal in issue.redmine.journals %} - {% if journal.notes != "" %} -
-
- Auteur = {{journal.user.name}}
- Créé le ={{ journal.created_on|date('d/m/Y H:i') }} -
-
- {{ journal.notes |textile_to_html|raw }} -
-
- {% endif %} - {% endfor %} - {% endif %} -
- -

-
-
diff --git a/templates/label/edit.html.twig b/templates/label/edit.html.twig deleted file mode 100644 index 6dde334..0000000 --- a/templates/label/edit.html.twig +++ /dev/null @@ -1,37 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %} = {{title}}{% endblock %} - -{% block body %} -

{{title}}

- - - {{ form_start(form) }} - {{ form_widget(form.submit) }} - Annuler - {%if mode=="update" %}Supprimer{%endif%} - - {% include('include/error.html.twig') %} - -
-
-
-
Information
-
- {{ form_row(form.labelRedmine) }} - {{ form_row(form.labelNinemine) }} -
-
-
-
- {{ form_end(form) }} - -{% endblock %} - -{% block localscript %} - -{% endblock %} diff --git a/templates/label/list.html.twig b/templates/label/list.html.twig deleted file mode 100644 index 153d36c..0000000 --- a/templates/label/list.html.twig +++ /dev/null @@ -1,42 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %} = {{title}}{% endblock %} - -{% block body %} -

{{title}}

- Ajouter - -
- - - - - - - - - - {% for label in labels %} - - - - - - {% endfor %} - -
ActionLabel RedmineLabel Ninemine
{{label.labelRedmine}}{{label.labelNinemine}}
-
-{% endblock %} - -{% block localscript %} - -{% endblock %} diff --git a/templates/project/edit.html.twig b/templates/project/edit.html.twig index 0911823..c3345d3 100644 --- a/templates/project/edit.html.twig +++ b/templates/project/edit.html.twig @@ -19,6 +19,7 @@
Information
{{ form_row(form.title) }} + {{ form_row(form.status) }}
@@ -31,8 +32,11 @@ - + + {% if mode=="update" %} + {{ render(path("app_files",{id:project.id}))}} + {% endif %} {{ form_end(form) }} {% endblock %} diff --git a/templates/project/list.html.twig b/templates/project/list.html.twig index 6041659..51563ec 100644 --- a/templates/project/list.html.twig +++ b/templates/project/list.html.twig @@ -11,9 +11,8 @@ Action - Logo - Modifier - Nom + Title + Modifié le @@ -21,11 +20,9 @@ - - {{project.title}} - {{project.redmine.updated_on}} + {{project.updateAt}} {% endfor %}