+
+ + Last modified: {{ record.modifiedAt.format('Y-m-d') }} + at {{ record.modifiedAt.format('H:i:s') }} +
+Editor: {{ record.editor }}
+diff --git a/assets/styles/app.css b/assets/styles/app.css index 2e71726..54149c9 100755 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -22,3 +22,12 @@ body { .sf-toolbar-clearer { display: none !important; } + +.table.record td, +.table.record th { + border: none; +} + +.table.record th { + min-width: 220px; +} diff --git a/src/Controller/BibliographyController.php b/src/Controller/BibliographyController.php new file mode 100644 index 0000000..93d5b05 --- /dev/null +++ b/src/Controller/BibliographyController.php @@ -0,0 +1,25 @@ +render('bibliography/index.html.twig', [ + 'controller_name' => 'BibliographyController', + 'record' => $bibliography, + ]); + } +} + diff --git a/src/Controller/VocabFuncContextController.php b/src/Controller/VocabFuncContextController.php index 50c7c22..1091a05 100644 --- a/src/Controller/VocabFuncContextController.php +++ b/src/Controller/VocabFuncContextController.php @@ -10,8 +10,10 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Security\Core\Exception\AccessDeniedException; -use Symfony\Component\Security\Http\Attribute\IsGranted; +/** + * @todo Make edit endpoints JSON? + */ class VocabFuncContextController extends AbstractController { #[Route('/vocabs/functional_context', name: 'app_vocab_func_context')] @@ -57,6 +59,14 @@ class VocabFuncContextController extends AbstractController #[Route('/vocabs/functional_context/update', name: 'app_vocab_func_context_upd')] public function updateTerm(Request $request, EntityManagerInterface $em): Response { + $vocab = new VocabFuncContext; + try { + $this->denyAccessUnlessGranted(VocabVoter::EDIT, $vocab); + } + catch (AccessDeniedException) { + $this->addFlash('warning', 'Only revisors and administrators can edit vocabularies'); + return $this->redirectToRoute('app_home'); + } $id = $request->getPayload()->get('_id'); $newTerm = $request->getPayload()->get('_new_term'); @@ -74,6 +84,15 @@ class VocabFuncContextController extends AbstractController #[Route('/vocabs/functional_context/del', name: 'app_vocab_func_context_del')] public function deleteTerm(Request $request, EntityManagerInterface $em): Response { + $vocab = new VocabFuncContext; + try { + $this->denyAccessUnlessGranted(VocabVoter::EDIT, $vocab); + } + catch (AccessDeniedException) { + $this->addFlash('warning', 'Only revisors and administrators can delete vocabularies'); + return $this->redirectToRoute('app_home'); + } + $id = $request->getPayload()->get('_id'); $repo = $em->getRepository(VocabFuncContext::class); $term = $repo->find($id); diff --git a/src/Entity/Bibliography.php b/src/Entity/Bibliography.php new file mode 100644 index 0000000..f03ec70 --- /dev/null +++ b/src/Entity/Bibliography.php @@ -0,0 +1,134 @@ +id; + } + + public function getStatus(): ?string + { + $status = RecordStatus::tryFrom($this->status); + return $status->toString(); + } + + public function setStatus(int $status): static + { + $this->status = $status; + + return $this; + } + + public function getModifiedAt(): ?DateTimeImmutable + { + return $this->modifiedAt; + } + + public function setModifiedAt(DateTimeImmutable $modifiedAt): static + { + $this->modifiedAt = $modifiedAt; + + return $this; + } + + public function getOwner(): ?string + { + return $this->owner; + } + + public function setOwner(string $owner): static + { + $this->owner = $owner; + + return $this; + } + + public function getEditor(): ?string + { + return $this->editor; + } + + public function setEditor(string $editor): static + { + $this->editor = $editor; + + return $this; + } + + public function getCitation(): ?string + { + return $this->citation; + } + + public function setCitation(string $citation): static + { + $this->citation = $citation; + + return $this; + } + + public function getReference(): ?string + { + return $this->reference; + } + + public function setReference(string $reference): static + { + $this->reference = $reference; + + return $this; + } + + public function getNotes(): ?string + { + return $this->notes; + } + + public function setNotes(string $notes): static + { + $this->notes = $notes; + + return $this; + } +} diff --git a/src/RecordStatus.php b/src/RecordStatus.php new file mode 100644 index 0000000..1ddaca8 --- /dev/null +++ b/src/RecordStatus.php @@ -0,0 +1,25 @@ + 'Draft', + $this::Complete => 'Complete', + $this::Excluded => 'Excluded', + $this::Unindexed => 'Unindexed', + $this::Published => 'Published', + default => 'Draft' + }; + } + +} diff --git a/src/Repository/BibliographyRepository.php b/src/Repository/BibliographyRepository.php new file mode 100644 index 0000000..a00ccda --- /dev/null +++ b/src/Repository/BibliographyRepository.php @@ -0,0 +1,19 @@ + + */ +class BibliographyRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Bibliography::class); + } +} + diff --git a/templates/bibliography/index.html.twig b/templates/bibliography/index.html.twig new file mode 100644 index 0000000..ec16327 --- /dev/null +++ b/templates/bibliography/index.html.twig @@ -0,0 +1,54 @@ +{% extends 'data_entry.html.twig' %} + +{% block title %}Bibliography | ArCOA{% endblock %} + +{% block rightpanel %} +
Record ID | {{ record.id }} |
---|---|
Status | {{ record.getStatus() }} |
Editor(s) | {{ record.editor }} |
Citation | {{ record.citation }} |
Reference | {{ record.reference }} |
Editorial notes | {{ record.notes }} |