Compare commits

..

15 Commits

Author SHA1 Message Date
8ba8dca0fa Update views + biblio-doc rel 2024-12-10 17:12:30 +01:00
17270bcd00 Add Document (WIP) 2024-12-10 09:21:39 +01:00
82e397cbc2 Update site (WIP) + renaming 2024-12-09 10:19:29 +01:00
5fa894e56a Add Site entity (draft) 2024-11-15 16:32:01 +01:00
70f1b7090a Crude geo data for conservatipn place 2024-11-14 15:54:47 +01:00
99383daf3e Add conservation place 2024-11-13 16:30:03 +01:00
184991e8cf Add entity for conservation place (draft) 2024-11-12 17:18:01 +01:00
458fd3e562 More delete record fixes... 2024-11-12 09:05:12 +01:00
55588c1f4c Add Leaflet for maps 2024-11-11 17:22:05 +01:00
097bf6a272 Implement voting for editor permissions (draft) 2024-11-11 17:21:36 +01:00
adee0f6d0f Fix delete record JS mess 2024-11-11 17:21:00 +01:00
0a0f553510 Set status to draft when copying record 2024-11-09 18:28:24 +01:00
91940f1e26 Data entry menu JS (finally...) 2024-11-09 18:21:21 +01:00
a622b3c256 Implement vocab delete in Stimulus
TODO: show modal warning before deleting
2024-11-09 11:19:18 +01:00
dce0e1b693 Copy collection; Stimulus controller for vocabs (incomplete) 2024-11-08 17:32:45 +01:00
42 changed files with 3409 additions and 486 deletions

View File

@@ -5,17 +5,28 @@ import { Controller } from '@hotwired/stimulus';
* [template: {entity}/index.html.twig] * [template: {entity}/index.html.twig]
*/ */
export default class extends Controller { export default class extends Controller {
static targets = ['modal', 'path']; static targets = ['modal', 'path', 'name', 'message'];
/** /**
* @todo Refactor with actions for modal * @todo Refactor with actions for modal
* @param {object} event * @param {object} event
*/ */
show(event) { warn(event) {
event.preventDefault(); event.preventDefault();
const id = event.currentTarget.getAttribute('data-url').match(/\d+$/)[0];
const modal = this.modalTarget; const modal = this.modalTarget;
let name = '';
// For record list in landing pages
if (this.nameTargets.length > 1) {
name = this.nameTargets.find(a => a.href.includes(id)).textContent;
} else {
name = this.nameTarget.textContent;
}
const message = `The record '<strong>${name.trim()}</strong>' will be permanently deleted. Proceed?`;
modal.classList.add('is-active'); modal.classList.add('is-active');
this.messageTarget.innerHTML = message;
modal.querySelector('.delete').addEventListener('click', () => { modal.querySelector('.delete').addEventListener('click', () => {
modal.classList.remove('is-active'); modal.classList.remove('is-active');
}); });
@@ -28,8 +39,8 @@ export default class extends Controller {
} }
// Proceed with deletion... // Proceed with deletion...
delete(event) { delete() {
const delPath = this.pathTarget.href; const delPath = this.pathTarget.getAttribute('data-url');
location.href = delPath; location.href = delPath;
} }
} }

View File

@@ -0,0 +1,63 @@
import { Controller } from '@hotwired/stimulus';
import L from "leaflet";
/**
*/
export default class extends Controller {
static targets = [ 'map', 'modal', 'coords', 'name', 'container'];
initialize() {
this.setIcon();
this.coordinates = this.coordsTarget.textContent.split(', ');
const map = L.map(this.mapTarget.id, {
attributionControl: false,
minZoom: 5,
}).setView(this.coordinates, 17);
map.crs = L.CRS.EPSG4326;
this.map = map;
this.addOsMap();
this.addMarker();
}
open() {
this.modalTarget.classList.add('is-active');
let map = this.map;
map.invalidateSize();
}
close() {
this.modalTarget.classList.remove('is-active');
}
addOsMap() {
let osmap = new L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxNativeZoom : 22,
maxZoom: 22,
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
});
osmap.addTo(this.map);
}
setIcon() {
this.icon = L.icon({
iconUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/images/marker-icon.png',
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/images/marker-shadow.png'
});
}
addMarker() {
L.marker(
this.coordinates,
{icon: this.icon}
)
.bindTooltip(this.nameTarget.textContent)
.openTooltip()
.addTo(this.map);
}
}

View File

@@ -3,20 +3,51 @@ import { Controller } from '@hotwired/stimulus';
/** /**
* Show / hide items in left-hand menu * Show / hide items in left-hand menu
* [template: data_entry.html.twig] * [template: data_entry.html.twig]
* @todo Handle open / closed state
*/ */
export default class extends Controller { export default class extends Controller {
static targets = ['vocabs', 'records']; static targets = [
'vocabs',
'records',
'vocabIcon',
'recordIcon'
];
static values = {
state: Number,
};
initialize() {
const recordsClass = localStorage.getItem('recordsClass');
const vocabsClass = localStorage.getItem('vocabsClass');
if (recordsClass) {
this.recordsTarget.className = recordsClass;
this.recordIconTarget.className = recordsClass.includes('hidden') ?
this.closeIcon(this.recordIconTarget) :
this.openIcon(this.recordIconTarget);
}
if (vocabsClass) {
this.vocabsTarget.className = vocabsClass;
this.vocabIconTarget.className = vocabsClass.includes('hidden') ?
this.closeIcon(this.vocabIconTarget) :
this.openIcon(this.vocabIconTarget);
}
}
toggle(event) { toggle(event) {
if (event.currentTarget.id === 'for-vocabs') { if (event.currentTarget.id === 'for-vocabs') {
this.vocabsTarget.classList.toggle('is-hidden'); this.vocabsTarget.classList.toggle('is-hidden');
localStorage.setItem('vocabsClass', this.vocabsTarget.className);
} }
if (event.currentTarget.id === 'for-records') { if (event.currentTarget.id === 'for-records') {
this.recordsTarget.classList.toggle('is-hidden'); this.recordsTarget.classList.toggle('is-hidden');
localStorage.setItem('recordsClass', this.recordsTarget.className);
} }
const icon = event.currentTarget.firstElementChild; this.changeIcon(event.currentTarget.firstElementChild);
}
changeIcon(icon) {
const iconState = icon.className.includes('right') ? 'right' : 'down'; const iconState = icon.className.includes('right') ? 'right' : 'down';
const iconAction = { const iconAction = {
@@ -29,6 +60,15 @@ export default class extends Controller {
}; };
iconAction[iconState](); iconAction[iconState]();
}
this.iconClass = icon.className;
} }
openIcon(icon) {
return icon.className.replace('right', 'down');
}
closeIcon(icon) {
return icon.className.replace('down', 'right');
}
}

View File

@@ -0,0 +1,111 @@
import { Controller } from '@hotwired/stimulus';
export default class extends Controller {
static targets = [
'row',
'term',
'input',
'save',
'edit',
'cancel',
];
static values = {
saveUrl: String,
};
/**
* @todo Simpler way?
*/
edit(event) {
const id = event.currentTarget.getAttribute('data-id');
this.saveTargets.forEach((btn, index) => {
if (btn.getAttribute('data-id') === id) {
btn.classList.toggle('is-hidden');
this.inputTargets[index].disabled = false;
this.cancelTargets[index].classList.toggle('is-hidden');
}
});
event.currentTarget.classList.add('is-hidden');
}
async save(event) {
const id = event.currentTarget.getAttribute('data-id');
let term = '';
for (let input of this.inputTargets) {
if (input.getAttribute('data-id') === id) {
term = input.value;
}
}
let data = new FormData;
data.append("_id", id);
data.append("_new_term", term);
const url = event.currentTarget.getAttribute('data-url');
const res = await fetch(url, {
method: "POST",
body: data,
});
if (res.status === 200) {
let notif = document.getElementById('ajax-saved');
notif.classList.toggle('is-hidden');
};
this.cancelTargets.find(btn => btn.getAttribute('data-id') === id)
.classList.toggle('is-hidden');
this.editTargets.find(btn => btn.getAttribute('data-id') === id)
.classList.toggle('is-hidden');
const input = this.inputTargets.find(input => input.getAttribute('data-id') === id)
input.disabled = true;
event.target.classList.toggle('is-hidden');
}
/**
*
* @todo Show modal before deleting! Show delete error (500)!
*/
async delete(event) {
const id = event.currentTarget.getAttribute('data-id');
const url = event.currentTarget.getAttribute('data-url');
let data = new FormData;
data.append("_id", id);
const res = await fetch(url, {
method: "POST",
body: data,
});
if (res.status === 200) {
let notif = document.getElementById('ajax-deleted');
notif.classList.toggle('is-hidden');
this.rowTargets.find(row => row.getAttribute('data-id') === id)
.classList.add('is-hidden');
};
if (res.status === 500) {
let notif = document.getElementById('ajax-error');
notif.classList.toggle('is-hidden');
}
}
cancel(event) {
const id = event.currentTarget.getAttribute('data-id');
this.editTargets.forEach((btn, index) => {
if (btn.getAttribute('data-id') === id) {
btn.classList.toggle('is-hidden');
this.inputTargets[index].disabled = true;
this.saveTargets[index].classList.toggle('is-hidden');
this.cancelTargets[index].classList.toggle('is-hidden');
}
});
}
}

View File

@@ -1,6 +1,7 @@
@import url('../fonts/stylesheet.css'); @import url('../fonts/stylesheet.css');
@import url('../fontawesome-free-6.6.0-web/css/all.min.css'); @import url('../fontawesome-free-6.6.0-web/css/all.min.css');
@import url('../vendor/bulma/css/bulma.min.css'); @import url('../vendor/bulma/css/bulma.min.css');
@import url('../vendor/leaflet/dist/leaflet.min.css');
:root { :root {
--arcoa-blue: rgba(66,135,199,0.98); --arcoa-blue: rgba(66,135,199,0.98);

View File

@@ -40,6 +40,7 @@ security:
- { path: ^/bibliography, roles: ROLE_USER } - { path: ^/bibliography, roles: ROLE_USER }
- { path: ^/collection, roles: ROLE_USER } - { path: ^/collection, roles: ROLE_USER }
- { path: ^/collector, roles: ROLE_USER } - { path: ^/collector, roles: ROLE_USER }
- { path: ^/conservation_place, roles: ROLE_USER }
- { path: ^/document, roles: ROLE_USER } - { path: ^/document, roles: ROLE_USER }
- { path: ^/object, roles: ROLE_USER } - { path: ^/object, roles: ROLE_USER }
- { path: ^/site, roles: ROLE_USER } - { path: ^/site, roles: ROLE_USER }

View File

@@ -16,17 +16,24 @@ return [
'path' => './assets/app.js', 'path' => './assets/app.js',
'entrypoint' => true, 'entrypoint' => true,
], ],
'@hotwired/stimulus' => [
'version' => '3.2.2',
],
'@symfony/stimulus-bundle' => [ '@symfony/stimulus-bundle' => [
'path' => './vendor/symfony/stimulus-bundle/assets/dist/loader.js', 'path' => './vendor/symfony/stimulus-bundle/assets/dist/loader.js',
], ],
'@hotwired/stimulus' => [
'version' => '3.2.2',
],
'@hotwired/turbo' => [ '@hotwired/turbo' => [
'version' => '7.3.0', 'version' => '8.0.12',
], ],
'bulma/css/bulma.min.css' => [ 'bulma/css/bulma.min.css' => [
'version' => '1.0.2', 'version' => '1.0.2',
'type' => 'css', 'type' => 'css',
], ],
'leaflet' => [
'version' => '1.9.4',
],
'leaflet/dist/leaflet.min.css' => [
'version' => '1.9.4',
'type' => 'css',
],
]; ];

View File

@@ -7,16 +7,34 @@ use App\Entity\Collection;
use App\Entity\Collector; use App\Entity\Collector;
use App\Form\BibliographyType; use App\Form\BibliographyType;
use App\Security\Voter\RecordVoter; use App\Security\Voter\RecordVoter;
use App\RecordStatus;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use DateTimeImmutable;
class BibliographyController extends AbstractController class BibliographyController extends AbstractController
{ {
#[Route('/bibliography/{id<\d+>}', name: 'app_bibliography')] #[Route('/bibliography', name: 'app_bibliography')]
public function index(Bibliography $bibliography, EntityManagerInterface $em): Response public function index(EntityManagerInterface $em): Response
{
$repo = $em->getRepository(Bibliography::class);
$records = $repo->findBy([], ['id' => 'DESC']);
$count = count($records);
$records = array_slice($records, 0, 15);
return $this->render('bibliography/index.html.twig', [
'controller_name' => 'BibliographyController',
'records' => $records,
'count' => $count,
]);
}
#[Route('/bibliography/{id<\d+>}', name: 'app_bibliography_view')]
public function view(Bibliography $bibliography, EntityManagerInterface $em): Response
{ {
$repo = $em->getRepository(Collection::class); $repo = $em->getRepository(Collection::class);
$collections = $repo->findAllByBibliography($bibliography->getId()); $collections = $repo->findAllByBibliography($bibliography->getId());
@@ -26,28 +44,17 @@ class BibliographyController extends AbstractController
$bibliography->setCollections($collections); $bibliography->setCollections($collections);
$bibliography->setCollectors($collectors); $bibliography->setCollectors($collectors);
return $this->render('bibliography/index.html.twig', [ $repo = $em->getRepository(Bibliography::class);
$isEditable = $repo->hasCreatorEditor($bibliography->getCreator());
$bibliography->setEditableStatus($isEditable);
return $this->render('bibliography/view.html.twig', [
'controller_name' => 'BibliographyController', 'controller_name' => 'BibliographyController',
'record' => $bibliography, 'record' => $bibliography,
]); ]);
} }
#[Route('/bibliography', name: 'app_bibliography_landing')]
public function landing(EntityManagerInterface $em): Response
{
$repo = $em->getRepository(Bibliography::class);
$records = $repo->findBy([], ['id' => 'DESC']);
$count = count($records);
$records = array_slice($records, 0, 15);
return $this->render('bibliography/landing.html.twig', [
'controller_name' => 'BibliographyController',
'records' => $records,
'count' => $count,
]);
}
#[Route('/bibliography/search', name: 'app_bibliography_search')] #[Route('/bibliography/search', name: 'app_bibliography_search')]
public function search(): Response public function search(): Response
{ {
@@ -83,22 +90,23 @@ class BibliographyController extends AbstractController
return $this->redirectToRoute('app_home'); return $this->redirectToRoute('app_home');
} }
if ($bibliography) {
$em->remove($bibliography); $em->remove($bibliography);
$em->flush(); $em->flush();
$this->addFlash('notice', 'Record deleted successfully'); $this->addFlash('notice', 'Record deleted successfully');
}
return $this->redirectToRoute('app_bibliography_landing'); return $this->redirectToRoute('app_bibliography');
} }
/** /**
* @todo Permissions! Return JSON with 403 when AJAX * @todo Move clone logic to __clone() in Entity or Repository
*/ */
#[Route('/bibliography/copy/{id<\d+>}', name: 'app_bibliography_copy')] #[Route('/bibliography/copy/{id<\d+>}', name: 'app_bibliography_copy')]
public function copy(Bibliography $bibliography, EntityManagerInterface $em): Response public function copy(Bibliography $bibliography, EntityManagerInterface $em): Response
{ {
try { try {
$this->denyAccessUnlessGranted(RecordVoter::EDIT, $bibliography); $this->denyAccessUnlessGranted(RecordVoter::COPY, $bibliography);
} }
catch (AccessDeniedException) { catch (AccessDeniedException) {
$this->addFlash('warning', 'You are not authorized to copy this record'); $this->addFlash('warning', 'You are not authorized to copy this record');
@@ -108,7 +116,6 @@ class BibliographyController extends AbstractController
$user = $this->getUser(); $user = $this->getUser();
$editor = "{$user->getFirstname()} {$user->getLastName()}"; $editor = "{$user->getFirstname()} {$user->getLastName()}";
// TODO Move clone logic to __clone() in Entity or Repository
$copy = clone $bibliography; $copy = clone $bibliography;
$copy->setEditor($editor); $copy->setEditor($editor);
$copy->setOwner($editor); $copy->setOwner($editor);
@@ -122,10 +129,14 @@ class BibliographyController extends AbstractController
$repo->findAllByBibliography($bibliography->getId()) $repo->findAllByBibliography($bibliography->getId())
); );
$copy->setCitation("{$bibliography->getCitation()} - Copy"); $copy->setCitation("{$bibliography->getCitation()} - Copy");
$copy->setModifiedAt(new DateTimeImmutable());
$copy->setStatus(RecordStatus::Draft->value);
$em->persist($copy); $em->persist($copy);
$em->flush(); $em->flush();
return $this->redirectToRoute('app_bibliography', ['id' => $copy->getId()]); $this->addFlash('notice', 'Record copied successfully');
return $this->redirectToRoute('app_bibliography_view', ['id' => $copy->getId()]);
} }
} }

View File

@@ -4,6 +4,8 @@ namespace App\Controller;
use App\Entity\Collection; use App\Entity\Collection;
use App\Entity\Bibliography; use App\Entity\Bibliography;
use App\Entity\Collector;
use App\RecordStatus;
use App\Security\Voter\RecordVoter; use App\Security\Voter\RecordVoter;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -13,22 +15,8 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException;
class CollectionController extends AbstractController class CollectionController extends AbstractController
{ {
#[Route('/collection/{id<\d+>}', name: 'app_collection')] #[Route('/collection', name: 'app_collection')]
public function index(Collection $collection, EntityManagerInterface $em): Response public function index(EntityManagerInterface $em): Response
{
$repo = $em->getRepository(Bibliography::class);
$bibliographies = $repo->findAllByCollection($collection->getId());
$collection->setBibliographies($bibliographies);
return $this->render('collection/index.html.twig', [
'controller_name' => 'CollectionController',
'record' => $collection,
]);
}
#[Route('/collection', name: 'app_collection_landing')]
public function landing(EntityManagerInterface $em): Response
{ {
$repo = $em->getRepository(Collection::class); $repo = $em->getRepository(Collection::class);
$records = $repo->findBy([], ['modifiedAt' => 'DESC']); $records = $repo->findBy([], ['modifiedAt' => 'DESC']);
@@ -36,13 +24,30 @@ class CollectionController extends AbstractController
$records = array_slice($records, 0, 15); $records = array_slice($records, 0, 15);
return $this->render('collection/landing.html.twig', [ return $this->render('collection/index.html.twig', [
'controller_name' => 'CollectionController', 'controller_name' => 'CollectionController',
'records' => $records, 'records' => $records,
'count' => $count, 'count' => $count,
]); ]);
} }
#[Route('/collection/{id<\d+>}', name: 'app_collection_view')]
public function view(Collection $collection, EntityManagerInterface $em): Response
{
$repo = $em->getRepository(Bibliography::class);
$bibliographies = $repo->findAllByCollection($collection->getId());
$collection->setBibliographies($bibliographies);
$repo = $em->getRepository(Collection::class);
$isEditable = $repo->hasCreatorEditor($collection->getCreator());
$collection->setEditableStatus($isEditable);
return $this->render('collection/view.html.twig', [
'controller_name' => 'CollectionController',
'record' => $collection,
]);
}
#[Route('/collection/delete/{id<\d+>}', name: 'app_collection_del')] #[Route('/collection/delete/{id<\d+>}', name: 'app_collection_del')]
public function delete(Collection $collection, EntityManagerInterface $em): Response public function delete(Collection $collection, EntityManagerInterface $em): Response
{ {
@@ -54,11 +59,55 @@ class CollectionController extends AbstractController
return $this->redirectToRoute('app_home'); return $this->redirectToRoute('app_home');
} }
if ($collection) {
$em->remove($collection); $em->remove($collection);
$em->flush(); $em->flush();
}
$this->addFlash('notice', 'Record deleted successfully'); $this->addFlash('notice', 'Record deleted successfully');
return $this->redirectToRoute('app_collection_landing'); return $this->redirectToRoute('app_collection');
}
/**
* @todo Move clone logic to __clone() in Entity or Repository
*/
#[Route('/collection/copy/{id<\d+>}', name: 'app_collection_copy')]
public function copy(Collection $collection, EntityManagerInterface $em): Response
{
try {
$this->denyAccessUnlessGranted(RecordVoter::EDIT, $collection);
}
catch (AccessDeniedException) {
$this->addFlash('warning', 'You are not authorized to copy this record');
return $this->redirectToRoute('app_home');
}
$user = $this->getUser();
$editor = "{$user->getFirstname()} {$user->getLastName()}";
$copy = clone $collection;
$copy->setEditor($editor);
$copy->setOwner($editor);
$copy->setCreator($user->getUsername());
$repo = $em->getRepository(Bibliography::class);
$copy->setBibliographies(
$repo->findAllByCollection($collection->getId())
);
/*
$repo = $em->getRepository(Collector::class);
$copy->setCollectors(
$repo->findAllByBibliography($bibliography->getId())
);
*/
$copy->setTitle("{$collection->getTitle()} - Copy");
$copy->setModifiedAt(new \DateTimeImmutable());
$copy->setStatus(RecordStatus::Draft->value);
$em->persist($copy);
$em->flush();
$this->addFlash('notice', 'Record copied successfully');
return $this->redirectToRoute('app_collection_view', ['id' => $copy->getId()]);
} }
} }

View File

@@ -5,6 +5,7 @@ namespace App\Controller;
use App\Entity\Collector; use App\Entity\Collector;
use App\Entity\Collection; use App\Entity\Collection;
use App\Entity\Bibliography; use App\Entity\Bibliography;
use App\RecordStatus;
use App\Security\Voter\RecordVoter; use App\Security\Voter\RecordVoter;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -14,21 +15,25 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException;
class CollectorController extends AbstractController class CollectorController extends AbstractController
{ {
#[Route('/collector/{id<\d+>}', name: 'app_collector')] #[Route('/collector/{id<\d+>}', name: 'app_collector_view')]
public function index(Collector $collector, EntityManagerInterface $em): Response public function view(Collector $collector, EntityManagerInterface $em): Response
{ {
$repo = $em->getRepository(Bibliography::class); $repo = $em->getRepository(Bibliography::class);
$bibliographies = $repo->findAllByCollector($collector->getId()); $bibliographies = $repo->findAllByCollector($collector->getId());
$collector->setBibliographies($bibliographies); $collector->setBibliographies($bibliographies);
return $this->render('collector/index.html.twig', [ $repo = $em->getRepository(Collector::class);
$isEditable = $repo->hasCreatorEditor($collector->getCreator());
$collector->setEditableStatus($isEditable);
return $this->render('collector/view.html.twig', [
'controller_name' => 'CollectorController', 'controller_name' => 'CollectorController',
'record' => $collector, 'record' => $collector,
]); ]);
} }
#[Route('/collector', name: 'app_collector_landing')] #[Route('/collector', name: 'app_collector')]
public function landing(EntityManagerInterface $em): Response public function index(EntityManagerInterface $em): Response
{ {
$repo = $em->getRepository(Collector::class); $repo = $em->getRepository(Collector::class);
$records = $repo->findBy([], ['modifiedAt' => 'DESC']); $records = $repo->findBy([], ['modifiedAt' => 'DESC']);
@@ -36,7 +41,7 @@ class CollectorController extends AbstractController
$records = array_slice($records, 0, 15); $records = array_slice($records, 0, 15);
return $this->render('collector/landing.html.twig', [ return $this->render('collector/index.html.twig', [
'controller_name' => 'CollectorController', 'controller_name' => 'CollectorController',
'records' => $records, 'records' => $records,
'count' => $count, 'count' => $count,
@@ -59,6 +64,42 @@ class CollectorController extends AbstractController
$this->addFlash('notice', 'Record deleted successfully'); $this->addFlash('notice', 'Record deleted successfully');
return $this->redirectToRoute('app_collector_landing'); return $this->redirectToRoute('app_collector');
}
/**
* @todo Move clone logic to __clone() in Entity or Repository
*/
#[Route('/collector/copy/{id<\d+>}', name: 'app_collector_copy')]
public function copy(Collector $collector, EntityManagerInterface $em): Response
{
try {
$this->denyAccessUnlessGranted(RecordVoter::EDIT, $collector);
}
catch (AccessDeniedException) {
$this->addFlash('warning', 'You are not authorized to copy this record');
return $this->redirectToRoute('app_home');
}
$user = $this->getUser();
$editor = "{$user->getFirstname()} {$user->getLastName()}";
$copy = clone $collector;
$copy->setEditor($editor);
$copy->setOwner($editor);
$copy->setCreator($user->getUsername());
$repo = $em->getRepository(Bibliography::class);
$copy->setBibliographies(
$repo->findAllByCollector($collector->getId())
);
$copy->setName("{$collector->getName()} - Copy");
$copy->setModifiedAt(new \DateTimeImmutable());
$copy->setStatus(RecordStatus::Draft->value);
$em->persist($copy);
$em->flush();
$this->addFlash('notice', 'Record copied successfully');
return $this->redirectToRoute('app_collector_view', ['id' => $copy->getId()]);
} }
} }

View File

@@ -0,0 +1,111 @@
<?php
namespace App\Controller;
use App\Entity\Collection;
use App\Security\Voter\RecordVoter;
use App\Entity\ConservationPlace;
use App\RecordStatus;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
class ConservationPlaceController extends AbstractController
{
#[Route('/conservation_place', name: 'app_conservation_place')]
public function index(EntityManagerInterface $em): Response
{
$repo = $em->getRepository(ConservationPlace::class);
$records = $repo->findBy([], ['id' => 'DESC']);
$count = count($records);
$records = array_slice($records, 0, 15);
return $this->render('conservation_place/index.html.twig', [
'controller_name' => 'ConservationPlaceController',
'records' => $records,
'count' => $count,
]);
}
#[Route('/conservation_place/{id<\d+>}', name: 'app_conservation_place_view')]
public function view(ConservationPlace $conservationPlace, EntityManagerInterface $em): Response
{
$repo = $em->getRepository(ConservationPlace::class);
$coords = $repo->coordinates($conservationPlace->getId());
$conservationPlace->setLat((float) $coords['lat']);
$conservationPlace->setLng((float) $coords['lng']);
return $this->render('conservation_place/view.html.twig', [
'controller_name' => 'ConservationPlaceController',
'record' => $conservationPlace,
]);
}
#[Route('/conservation_place/delete/{id<\d+>}', name: 'app_conservation_place_del')]
public function delete(ConservationPlace $conservationPlace, EntityManagerInterface $em): Response
{
try {
$this->denyAccessUnlessGranted(RecordVoter::DELETE, $conservationPlace);
}
catch (AccessDeniedException) {
$this->addFlash('warning', 'You are not authorized to delete this record');
return $this->redirectToRoute('app_home');
}
if ($conservationPlace) {
$em->remove($conservationPlace);
$em->flush();
}
$this->addFlash('notice', 'Record deleted successfully');
return $this->redirectToRoute('app_conservation_place');
}
/**
* @todo Move clone logic to __clone() in Entity or Repository
*/
#[Route('/conservation_place/copy/{id<\d+>}', name: 'app_conservation_place_copy')]
public function copy(ConservationPlace $conservationPlace, EntityManagerInterface $em): Response
{
try {
$this->denyAccessUnlessGranted(RecordVoter::EDIT, $conservationPlace);
}
catch (AccessDeniedException) {
$this->addFlash('warning', 'You are not authorized to copy this record');
return $this->redirectToRoute('app_home');
}
$user = $this->getUser();
$editor = "{$user->getFirstname()} {$user->getLastName()}";
$copy = clone $conservationPlace;
$copy->setEditor($editor);
$copy->setOwner($editor);
$copy->setCreator($user->getUsername());
$repo = $em->getRepository(Collection::class);
$copy->setCollections(
$repo->findAllByConservationPlace($conservationPlace->getId())
);
/*
$repo = $em->getRepository(Collector::class);
$copy->setCollectors(
$repo->findAllByBibliography($bibliography->getId())
);
*/
$copy->setPlace("{$conservationPlace->getPlace()} - Copy");
$copy->setModifiedAt(new \DateTimeImmutable());
$copy->setStatus(RecordStatus::Draft->value);
$em->persist($copy);
$em->flush();
$this->addFlash('notice', 'Record copied successfully');
return $this->redirectToRoute('app_conservation_place_view', ['id' => $copy->getId()]);
}
}

View File

@@ -0,0 +1,113 @@
<?php
namespace App\Controller;
use App\Entity\Document;
use App\Entity\Bibliography;
use App\Entity\Collector;
use App\RecordStatus;
use App\Security\Voter\RecordVoter;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
class DocumentController extends AbstractController
{
#[Route('/document', name: 'app_document')]
public function index(EntityManagerInterface $em): Response
{
$repo = $em->getRepository(Document::class);
$records = $repo->findBy([], ['modifiedAt' => 'DESC']);
$count = count($records);
$records = array_slice($records, 0, 15);
return $this->render('document/index.html.twig', [
'controller_name' => 'DocumentController',
'records' => $records,
'count' => $count,
]);
}
#[Route('/document/{id<\d+>}', name: 'app_document_view')]
public function view(document $document, EntityManagerInterface $em): Response
{
$repo = $em->getRepository(Bibliography::class);
$bibliographies = $repo->findAllByDocument($document->getId());
$document->setBibliographies($bibliographies);
$repo = $em->getRepository(document::class);
$isEditable = $repo->hasCreatorEditor($document->getCreator());
$document->setEditableStatus($isEditable);
return $this->render('document/view.html.twig', [
'controller_name' => 'documentController',
'record' => $document,
]);
}
#[Route('/document/delete/{id<\d+>}', name: 'app_document_del')]
public function delete(Document $document, EntityManagerInterface $em): Response
{
try {
$this->denyAccessUnlessGranted(RecordVoter::DELETE, $document);
}
catch (AccessDeniedException) {
$this->addFlash('warning', 'You are not authorized to delete this record');
return $this->redirectToRoute('app_home');
}
if ($document) {
$em->remove($document);
$em->flush();
}
$this->addFlash('notice', 'Record deleted successfully');
return $this->redirectToRoute('app_document');
}
/**
* @todo Move clone logic to __clone() in Entity or Repository
*/
#[Route('/document/copy/{id<\d+>}', name: 'app_document_copy')]
public function copy(Document $document, EntityManagerInterface $em): Response
{
try {
$this->denyAccessUnlessGranted(RecordVoter::EDIT, $document);
}
catch (AccessDeniedException) {
$this->addFlash('warning', 'You are not authorized to copy this record');
return $this->redirectToRoute('app_home');
}
$user = $this->getUser();
$editor = "{$user->getFirstname()} {$user->getLastName()}";
$copy = clone $document;
$copy->setEditor($editor);
$copy->setOwner($editor);
$copy->setCreator($user->getUsername());
$repo = $em->getRepository(Bibliography::class);
$copy->setBibliographies(
$repo->findAllBydocument($document->getId())
);
/*
$repo = $em->getRepository(Collector::class);
$copy->setCollectors(
$repo->findAllByBibliography($bibliography->getId())
);
*/
$copy->setTitle("{$document->getTitle()} - Copy");
$copy->setModifiedAt(new \DateTimeImmutable());
$copy->setStatus(RecordStatus::Draft->value);
$em->persist($copy);
$em->flush();
$this->addFlash('notice', 'Record copied successfully');
return $this->redirectToRoute('app_document_view', ['id' => $copy->getId()]);
}
}

View File

@@ -0,0 +1,63 @@
<?php
namespace App\Controller;
use App\Entity\Site;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class SiteController extends AbstractController
{
#[Route('/site', name: 'app_site')]
public function index(EntityManagerInterface $em): Response
{
$repo = $em->getRepository(Site::class);
$sites = $repo->findBy([], ['id' => 'DESC']);
$count = count($sites);
$sites = array_slice($sites, 0, 15);
return $this->render('site/index.html.twig', [
'controller_name' => 'SiteController',
'records' => $sites,
'count' => $count,
]);
}
#[Route('/site/{id<\d+>}', name: 'app_site_view')]
public function view(Site $site, EntityManagerInterface $em): Response
{
$repo = $em->getRepository(Site::class);
$coords = $repo->coordinates($site->getId());
$site->setLat($coords['lat']);
$site->setLng($coords['lng']);
return $this->render('site/view.html.twig', [
'controller_name' => 'SiteController',
'record' => $site,
]);
}
/**
* @todo Implement...
*/
#[Route('/site/copy/{id<\d+>}', name: 'app_site_copy')]
public function copy(Site $site, EntityManagerInterface $em): Response
{
return $this->render('site/index.html.twig', [
'controller_name' => 'SiteController',
'record' => $site,
]);
}
/**
* @todo Implement...
*/
#[Route('/site/delete/{id<\d+>}', name: 'app_site_del')]
public function delete(Site $site, EntityManagerInterface $em): Response
{
return $this->render('site/index.html.twig', [
'controller_name' => 'SiteController',
'record' => $site,
]);
}
}

View File

@@ -4,14 +4,14 @@ namespace App\Entity;
use App\RecordInterface; use App\RecordInterface;
use App\Repository\BibliographyRepository; use App\Repository\BibliographyRepository;
use App\Repository\CollectionRepository;
use App\Repository\CollectorRepository;
use DateTimeImmutable; use DateTimeImmutable;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Doctrine\DBAL\Types\Types; use Doctrine\DBAL\Types\Types;
use App\RecordStatus; use App\RecordStatus;
use ContainerBNNizmi\getBibliographyRepositoryService;
use Doctrine\Common\Collections\Collection as DoctrineCollection; use Doctrine\Common\Collections\Collection as DoctrineCollection;
use Doctrine\DBAL\Query\QueryBuilder as QueryQueryBuilder;
use Doctrine\ORM\QueryBuilder;
#[ORM\Entity(repositoryClass: BibliographyRepository::class)] #[ORM\Entity(repositoryClass: BibliographyRepository::class)]
#[ORM\Table(name: 'bibliography')] #[ORM\Table(name: 'bibliography')]
@@ -64,6 +64,9 @@ class Bibliography implements RecordInterface
private DoctrineCollection $sites; private DoctrineCollection $sites;
// Checks if the record can be edited by an 'editor' user
private bool $isEditable = false;
public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;
@@ -189,4 +192,16 @@ class Bibliography implements RecordInterface
return $this; return $this;
} }
public function getEditableStatus(): bool
{
return $this->isEditable;
}
public function setEditableStatus(bool $status): static
{
$this->isEditable = $status;
return $this;
}
} }

View File

@@ -83,6 +83,8 @@ class Collection implements RecordInterface
#[ORM\ManyToMany(targetEntity: Bibliography::class, inversedBy: 'collection')] #[ORM\ManyToMany(targetEntity: Bibliography::class, inversedBy: 'collection')]
private DoctrineCollection $bibliographies; private DoctrineCollection $bibliographies;
private bool $isEditable = false;
public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;
@@ -292,4 +294,16 @@ class Collection implements RecordInterface
return $this; return $this;
} }
public function getEditableStatus(): bool
{
return $this->isEditable;
}
public function setEditableStatus(bool $status): static
{
$this->isEditable = $status;
return $this;
}
} }

View File

@@ -83,6 +83,8 @@ class Collector implements RecordInterface
#[ORM\ManyToMany(targetEntity: Bibliography::class, inversedBy: 'collector')] #[ORM\ManyToMany(targetEntity: Bibliography::class, inversedBy: 'collector')]
private DoctrineCollection $bibliographies; private DoctrineCollection $bibliographies;
private bool $isEditable = false;
public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;
@@ -292,4 +294,16 @@ class Collector implements RecordInterface
return $this; return $this;
} }
public function getEditableStatus(): bool
{
return $this->isEditable;
}
public function setEditableStatus(bool $status): static
{
$this->isEditable = $status;
return $this;
}
} }

View File

@@ -0,0 +1,338 @@
<?php
namespace App\Entity;
use App\RecordInterface;
use App\Repository\ConservationPlaceRepository;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\DBAL\Types\Types;
use App\RecordStatus;
use Doctrine\Common\Collections\Collection as DoctrineCollection;
#[ORM\Entity(repositoryClass: ConservationPlaceRepository::class)]
#[ORM\Table(name: 'conservation_place')]
class ConservationPlace implements RecordInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(name: 'id')]
private ?int $id = null;
#[ORM\Column(name: 'stato')]
private ?int $status = null;
#[ORM\Column(name: 'modif')]
private ?DateTimeImmutable $modifiedAt = null;
#[ORM\Column(name: 'luogo_cons', type: Types::TEXT)]
private ?string $place = null;
//#[ORM\Column(name: 'coord_cons', type: Types::TEXT)]
private ?float $lat = null;
private ?float $lng = null;
#[ORM\Column(name: 'reg_cons', type: Types::TEXT)]
private ?string $region = null;
#[ORM\Column(name: 'prov_cons', type: Types::TEXT)]
private ?string $province = null;
#[ORM\Column(name: 'com_cons', type: Types::TEXT)]
private ?string $municipality = null;
#[ORM\Column(name: 'desc_cons', type: Types::TEXT)]
private ?string $description = null;
#[ORM\Column(name: 'desc_br_cons', type: Types::TEXT)]
private ?string $shortDescription = null;
#[ORM\Column(name: 'id_est_cons', type: Types::TEXT)]
private ?string $externalIdentifier = null;
#[ORM\Column(name: 'link_cons', type: Types::TEXT)]
private ?string $link = null;
#[ORM\Column(name: 'sogg_cons', type: Types::TEXT)]
private ?string $subjectHeadings = null;
#[ORM\Column(name: 'uri_cons', type: Types::TEXT)]
private ?string $uri = null;
#[ORM\Column(name: 'resp', length: 100)]
private ?string $owner = null;
#[ORM\Column(name: 'note_cons', type: Types::TEXT)]
private ?string $notes = null;
#[ORM\Column(length: 100, name: 'editor')]
private ?string $editor = null;
#[ORM\Column(length: 100, name: 'creator')]
private ?string $creator = null;
// TODO: These are references to vocabs
#[ORM\Column(name: 'dir_aut_cons')]
private ?int $authorRights = null;
#[ORM\Column(name: 'dir_acc_cons')]
private ?int $accessRights = null;
#[ORM\Column(name: 'lic_cons')]
private ?int $license = null;
#[ORM\JoinTable(name: 'rel_conservazione_collezione')]
#[ORM\JoinColumn(name: 'Conservazione_id_cons', referencedColumnName: 'id')]
#[ORM\InverseJoinColumn(name: 'Collezione_id_coll', referencedColumnName: 'id')]
#[ORM\ManyToMany(targetEntity: Collection::class, inversedBy: 'conservation_place')]
private DoctrineCollection $collections;
private bool $isEditable = false;
public function getId(): ?int
{
return $this->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 getCreator(): ?string
{
return $this->creator;
}
public function setCreator(string $creator): static
{
$this->creator = $creator;
return $this;
}
public function getPlace(): ?string
{
return $this->place;
}
public function setPlace(string $place): static
{
$this->place = $place;
return $this;
}
public function getRegion(): ?string
{
return $this->region;
}
public function setRegion(string $region): static
{
$this->region = $region;
return $this;
}
public function getProvince(): ?string
{
return $this->province;
}
public function setProvince(string $province): static
{
$this->province = $province;
return $this;
}
public function getMunicipality(): ?string
{
return $this->municipality;
}
public function setMunicipality(string $municipality): static
{
$this->municipality = $municipality;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): static
{
$this->description = $description;
return $this;
}
public function getShortDescription(): ?string
{
return $this->shortDescription;
}
public function setShortDescription(string $shortDescription): static
{
$this->shortDescription = $shortDescription;
return $this;
}
public function getExternalIdentifier(): ?string
{
return $this->externalIdentifier;
}
public function setExternalIdentifier(string $externalIdentifier): static
{
$this->externalIdentifier = $externalIdentifier;
return $this;
}
public function getLink(): ?string
{
return $this->link;
}
public function setLink(string $link): static
{
$this->link = $link;
return $this;
}
public function getSubjectHeadings(): ?string
{
return $this->subjectHeadings;
}
public function setSubjectHeadings(string $subjectHeadings): static
{
$this->subjectHeadings = $subjectHeadings;
return $this;
}
public function getUri(): ?string
{
return $this->uri;
}
public function setUri(string $uri): static
{
$this->uri = $uri;
return $this;
}
public function getNotes(): ?string
{
return $this->notes;
}
public function setNotes(string $notes): static
{
$this->notes = $notes;
return $this;
}
public function getCollections(): ?DoctrineCollection
{
return $this->collections;
}
public function setCollections(DoctrineCollection $collections): static
{
$this->collections = $collections;
return $this;
}
public function getEditableStatus(): bool
{
return $this->isEditable;
}
public function setEditableStatus(bool $status): static
{
$this->isEditable = $status;
return $this;
}
public function getLat(): float
{
return $this->lat;
}
public function setLat(float $lat): static
{
$this->lat = $lat;
return $this;
}
public function getLng(): float
{
return $this->lng;
}
public function setLng(float $lng): static
{
$this->lng = $lng;
return $this;
}
}

339
src/Entity/Document.php Normal file
View File

@@ -0,0 +1,339 @@
<?php
namespace App\Entity;
use App\RecordInterface;
use App\Repository\DocumentRepository;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\DBAL\Types\Types;
use App\RecordStatus;
use Doctrine\Common\Collections\Collection as DoctrineCollection;
#[ORM\Entity(repositoryClass: DocumentRepository::class)]
#[ORM\Table(name: 'document')]
class Document implements RecordInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(name: 'id')]
private ?int $id = null;
#[ORM\Column(name: 'stato')]
private ?int $status = null;
#[ORM\Column(name: 'modif')]
private ?DateTimeImmutable $modifiedAt = null;
#[ORM\Column(name: 'tit_doc', type: Types::TEXT)]
private ?string $title = null;
#[ORM\Column(name: 'aut_doc', type: Types::TEXT)]
private ?string $author = null;
#[ORM\Column(name: 'data_doc', type: Types::TEXT)]
private ?string $chronology = null;
#[ORM\Column(name: 'inventario', type: Types::TEXT)]
private ?string $inventory = null;
#[ORM\Column(name: 'inizio_doc', length: 50)]
private ?string $startDate = null;
#[ORM\Column(name: 'fine_doc', length: 50)]
private ?string $endDate = null;
#[ORM\Column(name: 'desc_doc', type: Types::TEXT)]
private ?string $description = null;
#[ORM\Column(name: 'inedito_doc', type: Types::BOOLEAN)]
private ?bool $unpublished = null;
#[ORM\Column(name: 'desc_br_doc', type: Types::TEXT)]
private ?string $shortDescription = null;
#[ORM\Column(name: 'id_est_doc', type: Types::TEXT)]
private ?string $externalIdentifier = null;
#[ORM\Column(name: 'link_doc', type: Types::TEXT)]
private ?string $link = null;
#[ORM\Column(name: 'sogg_doc', type: Types::TEXT)]
private ?string $subjectHeadings = null;
#[ORM\Column(name: 'resp', length: 100)]
private ?string $owner = null;
#[ORM\Column(name: 'note_doc', type: Types::TEXT)]
private ?string $notes = null;
#[ORM\Column(length: 100, name: 'editor')]
private ?string $editor = null;
#[ORM\Column(length: 100, name: 'creator')]
private ?string $creator = null;
// TODO: These are references to vocabs
#[ORM\Column(name: 'dir_aut_doc')]
private ?int $authorRights = null;
#[ORM\Column(name: 'dir_acc_doc')]
private ?int $accessRights = null;
#[ORM\Column(name: 'lic_doc')]
private ?int $license = null;
#[ORM\JoinTable(name: 'rel_riferimento_documento')]
#[ORM\JoinColumn(name: 'Documento_id_doc', referencedColumnName: 'id')]
#[ORM\InverseJoinColumn(name: 'Bibliografia_id_bib', referencedColumnName: 'id')]
#[ORM\ManyToMany(targetEntity: Bibliography::class, inversedBy: 'document')]
private DoctrineCollection $bibliographies;
private bool $isEditable = false;
public function getId(): ?int
{
return $this->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 getCreator(): ?string
{
return $this->creator;
}
public function setCreator(string $creator): static
{
$this->creator = $creator;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): static
{
$this->title = $title;
return $this;
}
public function getAuthor(): ?string
{
return $this->author;
}
public function setAuthor(string $author): static
{
$this->author = $author;
return $this;
}
public function getChronology(): ?string
{
return $this->chronology;
}
public function setChronology(string $chronology): static
{
$this->chronology = $chronology;
return $this;
}
public function getInventory(): ?string
{
return $this->inventory;
}
public function setInventory(string $inventory): static
{
$this->inventory = $inventory;
return $this;
}
public function getStartDate(): ?string
{
return $this->startDate;
}
public function setStartDate(string $startDate): static
{
$this->startDate = $startDate;
return $this;
}
public function getEndDate(): ?string
{
return $this->endDate;
}
public function setEndDate(string $endDate): static
{
$this->endDate = $endDate;
return $this;
}
public function getUnpublished(): ?bool
{
return $this->unpublished;
}
public function setUnpublished(bool $unpublished): static
{
$this->unpublished = $unpublished;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): static
{
$this->description = $description;
return $this;
}
public function getShortDescription(): ?string
{
return $this->shortDescription;
}
public function setShortDescription(string $shortDescription): static
{
$this->shortDescription = $shortDescription;
return $this;
}
public function getExternalIdentifier(): ?string
{
return $this->externalIdentifier;
}
public function setExternalIdentifier(string $externalIdentifier): static
{
$this->externalIdentifier = $externalIdentifier;
return $this;
}
public function getLink(): ?string
{
return $this->link;
}
public function setLink(string $link): static
{
$this->link = $link;
return $this;
}
public function getSubjectHeadings(): ?string
{
return $this->subjectHeadings;
}
public function setSubjectHeadings(string $subjectHeadings): static
{
$this->subjectHeadings = $subjectHeadings;
return $this;
}
public function getNotes(): ?string
{
return $this->notes;
}
public function setNotes(string $notes): static
{
$this->notes = $notes;
return $this;
}
public function getBibliographies(): ?DoctrineCollection
{
return $this->bibliographies;
}
public function setBibliographies(DoctrineCollection $bibliographies): static
{
$this->bibliographies = $bibliographies;
return $this;
}
public function getEditableStatus(): bool
{
return $this->isEditable;
}
public function setEditableStatus(bool $status): static
{
$this->isEditable = $status;
return $this;
}
}

323
src/Entity/Site.php Normal file
View File

@@ -0,0 +1,323 @@
<?php
namespace App\Entity;
use App\RecordInterface;
use App\Repository\SiteRepository;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\DBAL\Types\Types;
use App\RecordStatus;
use Doctrine\Common\Collections\Collection as DoctrineCollection;
#[ORM\Entity(repositoryClass: SiteRepository::class)]
#[ORM\Table(name: 'site')]
class Site implements RecordInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(name: 'id')]
private ?int $id = null;
#[ORM\Column(name: 'stato')]
private ?int $status = null;
#[ORM\Column(name: 'modif')]
private ?DateTimeImmutable $modifiedAt = null;
#[ORM\Column(name: 'nome_sito', type: Types::TEXT)]
private ?string $name = null;
#[ORM\Column(name: 'nome_ant_sito', type: Types::TEXT)]
private ?string $ancientName = null;
//#[ORM\Column(name: 'coord_sito', type: Types::TEXT)]
private ?float $lat = null;
private ?float $lng = null;
#[ORM\Column(name: 'stato_mod_sito', length: 40)]
private ?string $country = null;
#[ORM\Column(name: 'desc_sito', type: Types::TEXT)]
private ?string $description = null;
#[ORM\Column(name: 'desc_br_sito', type: Types::TEXT)]
private ?string $shortDescription = null;
#[ORM\Column(name: 'id_est_sito', type: Types::TEXT)]
private ?string $externalIdentifier = null;
#[ORM\Column(name: 'link_sito', type: Types::TEXT)]
private ?string $link = null;
#[ORM\Column(name: 'sogg_sito', type: Types::TEXT)]
private ?string $subjectHeadings = null;
#[ORM\Column(name: 'uri_sito', type: Types::TEXT)]
private ?string $uri = null;
#[ORM\Column(name: 'resp', length: 100)]
private ?string $owner = null;
#[ORM\Column(name: 'note_sito', type: Types::TEXT)]
private ?string $notes = null;
#[ORM\Column(length: 100, name: 'editor')]
private ?string $editor = null;
#[ORM\Column(length: 100, name: 'creator')]
private ?string $creator = null;
// TODO: These are references to vocabs
#[ORM\Column(name: 'dir_aut_sito')]
private ?int $authorRights = null;
#[ORM\Column(name: 'dir_acc_sito')]
private ?int $accessRights = null;
#[ORM\Column(name: 'lic_sito')]
private ?int $license = null;
#[ORM\JoinTable(name: 'rel_sito_collezione')]
#[ORM\JoinColumn(name: 'Sito_id_sito', referencedColumnName: 'id')]
#[ORM\InverseJoinColumn(name: 'Collezione_id_coll', referencedColumnName: 'id')]
#[ORM\ManyToMany(targetEntity: Collection::class, inversedBy: 'conservation_place')]
private DoctrineCollection $collections;
private bool $isEditable = false;
public function getId(): ?int
{
return $this->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 getCreator(): ?string
{
return $this->creator;
}
public function setCreator(string $creator): static
{
$this->creator = $creator;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getCountry(): ?string
{
return $this->country;
}
public function setCountry(string $country): static
{
$this->country = $country;
return $this;
}
public function getAncientName(): ?string
{
return $this->ancientName;
}
public function setAncientName(string $ancientName): static
{
$this->ancientName = $ancientName;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): static
{
$this->description = $description;
return $this;
}
public function getShortDescription(): ?string
{
return $this->shortDescription;
}
public function setShortDescription(string $shortDescription): static
{
$this->shortDescription = $shortDescription;
return $this;
}
public function getExternalIdentifier(): ?string
{
return $this->externalIdentifier;
}
public function setExternalIdentifier(string $externalIdentifier): static
{
$this->externalIdentifier = $externalIdentifier;
return $this;
}
public function getLink(): ?string
{
return $this->link;
}
public function setLink(string $link): static
{
$this->link = $link;
return $this;
}
public function getSubjectHeadings(): ?string
{
return $this->subjectHeadings;
}
public function setSubjectHeadings(string $subjectHeadings): static
{
$this->subjectHeadings = $subjectHeadings;
return $this;
}
public function getUri(): ?string
{
return $this->uri;
}
public function setUri(string $uri): static
{
$this->uri = $uri;
return $this;
}
public function getNotes(): ?string
{
return $this->notes;
}
public function setNotes(string $notes): static
{
$this->notes = $notes;
return $this;
}
public function getCollections(): ?DoctrineCollection
{
return $this->collections;
}
public function setCollections(DoctrineCollection $collections): static
{
$this->collections = $collections;
return $this;
}
public function getEditableStatus(): bool
{
return $this->isEditable;
}
public function setEditableStatus(bool $status): static
{
$this->isEditable = $status;
return $this;
}
public function getLat(): float
{
return $this->lat;
}
public function setLat(float $lat): static
{
$this->lat = $lat;
return $this;
}
public function getLng(): float
{
return $this->lng;
}
public function setLng(float $lng): static
{
$this->lng = $lng;
return $this;
}
}

View File

@@ -3,6 +3,7 @@
namespace App\Repository; namespace App\Repository;
use App\Entity\Bibliography; use App\Entity\Bibliography;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
@@ -18,6 +19,16 @@ class BibliographyRepository extends ServiceEntityRepository
parent::__construct($registry, Bibliography::class); parent::__construct($registry, Bibliography::class);
} }
public function hasCreatorEditor(string $creator): bool
{
$em = $this->getEntityManager();
$repo = $em->getRepository(User::class);
$creator = $repo->findOneBy(['username' => $creator]);
return in_array('ROLE_EDITOR', $creator->getRoles());
}
public function findAllByCollection(int $collectionId): ?ArrayCollection public function findAllByCollection(int $collectionId): ?ArrayCollection
{ {
$rsm = new ResultSetMappingBuilder($this->getEntityManager()); $rsm = new ResultSetMappingBuilder($this->getEntityManager());
@@ -61,4 +72,29 @@ class BibliographyRepository extends ServiceEntityRepository
return $bibliographies; return $bibliographies;
} }
public function findAllByDocument(int $documentId): ?ArrayCollection
{
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
$rsm->addRootEntityFromClassMetadata('App\Entity\Bibliography', 'b');
$query = $this->getEntityManager()->createNativeQuery(
"SELECT
id,
stato,
editor,
cit_bib,
rif_bib
FROM bibliography b
JOIN rel_riferimento_documento
ON Bibliografia_id_bib = id
WHERE Documento_id_doc = :docId",
$rsm
);
$query->setParameter('docId', $documentId);
$bibliographies = new ArrayCollection($query->getResult());
return $bibliographies;
}
} }

View File

@@ -3,6 +3,7 @@
namespace App\Repository; namespace App\Repository;
use App\Entity\Collection; use App\Entity\Collection;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
@@ -18,6 +19,16 @@ class CollectionRepository extends ServiceEntityRepository
parent::__construct($registry, Collection::class); parent::__construct($registry, Collection::class);
} }
public function hasCreatorEditor(string $creator): bool
{
$em = $this->getEntityManager();
$repo = $em->getRepository(User::class);
$creator = $repo->findOneBy(['username' => $creator]);
return in_array('ROLE_EDITOR', $creator->getRoles());
}
public function findAllByBibliography(int $biblioId): ?ArrayCollection public function findAllByBibliography(int $biblioId): ?ArrayCollection
{ {
$rsm = new ResultSetMappingBuilder($this->getEntityManager()); $rsm = new ResultSetMappingBuilder($this->getEntityManager());
@@ -37,4 +48,29 @@ class CollectionRepository extends ServiceEntityRepository
return $collections; return $collections;
} }
public function findAllByConservationPlace(int $placeId): ?ArrayCollection
{
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
$rsm->addRootEntityFromClassMetadata('App\Entity\Collection', 'c');
$query = $this->getEntityManager()->createNativeQuery(
"SELECT
id,
stato,
editor,
tit_coll,
data_coll
FROM collection c
JOIN rel_conservazione_collezione
ON Collezione_id_coll = id
WHERE Conservazione_id_cons = :placeId",
$rsm
);
$query->setParameter('placeId', $placeId);
$collections = new ArrayCollection($query->getResult());
return $collections;
}
} }

View File

@@ -3,6 +3,7 @@
namespace App\Repository; namespace App\Repository;
use App\Entity\Collector; use App\Entity\Collector;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
@@ -18,6 +19,16 @@ class CollectorRepository extends ServiceEntityRepository
parent::__construct($registry, Collector::class); parent::__construct($registry, Collector::class);
} }
public function hasCreatorEditor(string $creator): bool
{
$em = $this->getEntityManager();
$repo = $em->getRepository(User::class);
$creator = $repo->findOneBy(['username' => $creator]);
return in_array('ROLE_EDITOR', $creator->getRoles());
}
public function findAllByBibliography(int $biblioId): ?ArrayCollection public function findAllByBibliography(int $biblioId): ?ArrayCollection
{ {
$rsm = new ResultSetMappingBuilder($this->getEntityManager()); $rsm = new ResultSetMappingBuilder($this->getEntityManager());

View File

@@ -0,0 +1,96 @@
<?php
namespace App\Repository;
use App\Entity\Bibliography;
use App\Entity\ConservationPlace;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
/**
* @extends ServiceEntityRepository<ConservationPlace>
*/
class ConservationPlaceRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ConservationPlace::class);
}
public function hasCreatorEditor(string $creator): bool
{
$em = $this->getEntityManager();
$repo = $em->getRepository(User::class);
$creator = $repo->findOneBy(['username' => $creator]);
return in_array('ROLE_EDITOR', $creator->getRoles());
}
public function findAllByCollection(int $collectionId): ?ArrayCollection
{
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
$rsm->addRootEntityFromClassMetadata('App\Entity\ConservationPlace', 'c');
$query = $this->getEntityManager()->createNativeQuery(
"SELECT
id,
stato,
editor,
luogo_cons,
com_cons
FROM conservation_place c
JOIN rel_conservazione_collezione
ON Conservazione_id_cons = id
WHERE Collezione_id_coll = :collId",
$rsm
);
$query->setParameter('collId', $collectionId);
return new ArrayCollection($query->getResult());
}
public function findAllByObject(int $objectId): ?ArrayCollection
{
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
$rsm->addRootEntityFromClassMetadata('App\Entity\ConservationPlace', 'c');
$query = $this->getEntityManager()->createNativeQuery(
"SELECT
id,
stato,
editor,
luogo_cons,
com_cons
FROM conservation_place c
JOIN rel_conservazione_reperto
ON Conservazione_id_cons = id
WHERE Reperto_id_rep = :objectId",
$rsm
);
$query->setParameter('objectId', $objectId);
return new ArrayCollection($query->getResult());
}
public function coordinates(int $id): ?array
{
$conn = $this->getEntityManager()->getConnection();
$sql = '
SELECT
ST_X(coord_cons) as lng,
ST_Y(coord_cons) as lat
FROM conservation_place cp
WHERE cp.id = :id
';
$result = $conn->executeQuery($sql, ['id' => $id]);
return $result->fetchAssociative();
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Repository;
use App\Entity\Document;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
/**
* @extends ServiceEntityRepository<Document>
*/
class DocumentRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Document::class);
}
public function hasCreatorEditor(string $creator): bool
{
$em = $this->getEntityManager();
$repo = $em->getRepository(User::class);
$creator = $repo->findOneBy(['username' => $creator]);
return in_array('ROLE_EDITOR', $creator->getRoles());
}
public function findAllByBibliography(int $biblioId): ?ArrayCollection
{
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
$rsm->addRootEntityFromClassMetadata('App\Entity\Document', 'd');
$query = $this->getEntityManager()->createNativeQuery(
"SELECT
id,
stato,
editor,
tit_doc,
aut_doc
FROM document d
JOIN rel_riferimento_documento
ON Documento_id_doc = id
WHERE Bibliografia_id_bib = :biblioId",
$rsm
);
$query->setParameter('biblioId', $biblioId);
return new ArrayCollection($query->getResult());
}
}

View File

@@ -0,0 +1,95 @@
<?php
namespace App\Repository;
use App\Entity\Bibliography;
use App\Entity\Site;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
/**
* @extends ServiceEntityRepository<ConservationPlace>
*/
class SiteRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Site::class);
}
public function hasCreatorEditor(string $creator): bool
{
$em = $this->getEntityManager();
$repo = $em->getRepository(User::class);
$creator = $repo->findOneBy(['username' => $creator]);
return in_array('ROLE_EDITOR', $creator->getRoles());
}
public function findAllByCollection(int $collectionId): ?ArrayCollection
{
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
$rsm->addRootEntityFromClassMetadata('App\Entity\ConservationPlace', 'c');
$query = $this->getEntityManager()->createNativeQuery(
"SELECT
id,
stato,
editor,
luogo_cons,
com_cons
FROM sito s
JOIN rel_sito_collezione
ON Sito_id_sito = id
WHERE Collezione_id_coll = :collId",
$rsm
);
$query->setParameter('collId', $collectionId);
return new ArrayCollection($query->getResult());
}
public function findAllByObject(int $objectId): ?ArrayCollection
{
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
$rsm->addRootEntityFromClassMetadata('App\Entity\ConservationPlace', 'c');
$query = $this->getEntityManager()->createNativeQuery(
"SELECT
id,
stato,
editor,
luogo_cons,
com_cons
FROM conservation_place c
JOIN rel_conservazione_reperto
ON Conservazione_id_cons = id
WHERE Reperto_id_rep = :objectId",
$rsm
);
$query->setParameter('objectId', $objectId);
return new ArrayCollection($query->getResult());
}
public function coordinates(int $id): ?array
{
$conn = $this->getEntityManager()->getConnection();
$sql = '
SELECT
ST_X(coord_sito) as lng,
ST_Y(coord_sito) as lat
FROM site s
WHERE s.id = :id
';
$result = $conn->executeQuery($sql, ['id' => $id]);
return $result->fetchAssociative();
}
}

View File

@@ -5,16 +5,21 @@ namespace App\Security\Voter;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter; use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserInterface;
use App\Entity\User;
use App\RecordStatus;
use App\Repository\UserRepository;
use Doctrine\ORM\EntityManager;
final class RecordVoter extends Voter final class RecordVoter extends Voter
{ {
public const EDIT = 'RECORD_EDIT'; public const EDIT = 'RECORD_EDIT';
public const DELETE = 'RECORD_DELETE'; public const DELETE = 'RECORD_DELETE';
public const COPY = 'RECORD_COPY';
public const VIEW = 'RECORD_VIEW'; public const VIEW = 'RECORD_VIEW';
protected function supports(string $attribute, mixed $subject): bool protected function supports(string $attribute, mixed $subject): bool
{ {
return in_array($attribute, [self::EDIT, self::VIEW, self::DELETE]) return in_array($attribute, [self::EDIT, self::VIEW, self::DELETE, self::COPY])
&& $subject instanceof \App\RecordInterface; && $subject instanceof \App\RecordInterface;
} }
@@ -32,11 +37,37 @@ final class RecordVoter extends Voter
// TODO: Better way to check roles? // TODO: Better way to check roles?
switch ($attribute) { switch ($attribute) {
case self::EDIT: case self::EDIT:
case self::DELETE: $editorAllowed = true;
if (in_array('ROLE_EDITOR', $roles)) {
$creator = $subject->getCreator();
$isCreator = $creator === $user->getUsername();
$creatorIsEditor = $subject->getEditableStatus();
$editorAllowed &= $isCreator || $creatorIsEditor;
}
return in_array('ROLE_ADMIN', $roles) return in_array('ROLE_ADMIN', $roles)
|| in_array('ROLE_REVISOR', $roles); || in_array('ROLE_REVISOR', $roles)
|| $editorAllowed;
case self::DELETE:
$editorAllowed = true;
if (in_array('ROLE_EDITOR', $roles)) {
$isCreator = $subject->getCreator() === $user->getUsername();
$isValidStatus = match($subject->getStatus()) {
RecordStatus::Draft => true,
RecordStatus::Complete => true,
default => false
};
$editorAllowed &= $isCreator && $isValidStatus;
}
return in_array('ROLE_ADMIN', $roles)
|| in_array('ROLE_REVISOR', $roles)
|| $editorAllowed;
break; break;
case self::COPY:
case self::VIEW: case self::VIEW:
return ! in_array('ROLE_READER', $roles); return ! in_array('ROLE_READER', $roles);
break; break;

View File

@@ -1,71 +1,90 @@
{% extends 'data_entry.html.twig' %} {% extends 'data_entry.html.twig' %}
{% block title %}Bibliography - {{ record.citation }} | ArCOA{% endblock %} {% block title %}Bibliography | ArCOA{% endblock %}
{% block rightpanel %} {% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record"> <div class="container" style="max-width: 60vw" data-controller="delete-record">
<h1 class="is-size-1 mt-0 has-text-centered">Bibliography</h1> <h1 class="is-size-1 mt-0 has-text-centered">Bibliography</h1>
<h2 class="is-size-3 mt-3 has-text-centered">{{ record.citation }}</h2> <h2 class="is-size-3 mt-3 has-text-centered">Choose action</h2>
<article class="message is-info mt-3"> {% for message in app.flashes('notice') %}
<div class="message-body"> <div class=" mt-4 notification is-success"
<p> data-controller="notification"
<strong>Last modified:</strong> {{ record.modifiedAt.format('Y-m-d') }} data-notification-target="notif">
at {{ record.modifiedAt.format('H:i:s') }} <button class="delete" data-action="click->notification#close"></button>
</p> {{ message }}
<p><strong>Editor:</strong> {{ record.editor }}</p>
</div> </div>
</article> {% endfor %}
<div class="card p-5"> <div class="card p-5 mt-6 pt-6 pb-6">
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %}
<div class="columns"> <div class="columns">
<div class="column is-half"></div> <div class="column is-half has-text-centered">
<div class="column has-text-right"> <button class="button is-medium">
<button class="button is-link"> Search
Edit
<span class="icon ml-2"> <span class="icon ml-2">
<i class="fa fa-search"></i>
</span>
</button>
</div>
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') or is_granted('ROLE_EDITOR') %}
<div class="column has-text-centered">
<a href="{{ path('app_bibliography_create') }}" class="button is-link is-medium">
Add new
<span class="icon ml-2">
<i class="fa fa-plus"></i>
</span>
</a>
</div>
{% endif %}
</div>
</div>
<h3 class="has-text-centered is-size-4 mt-6">Records</h3>
<p class="pt-4 pb-4"><strong>{{ count }} result(s) found</strong></p>
<table class="table is-hoverable is-fullwidth mt-5 has-text-centered results">
<tr>
<th>ID</th>
<th>Citation</th>
<th>Status</th>
<th>Editor</th>
<th>Reference</th>
<th>Last modified</th>
<th>Actions</th>
</tr>
{% for record in records %}
<tr>
<td><a href="{{ path('app_bibliography_view', {'id' : record.id}) }}">{{ record.id }}</a></td>
<td>
<a data-delete-record-target="name" href="{{ path('app_bibliography_view', {'id' : record.id}) }}">
{{ record.citation }}
</a>
</td>
<td>{{ record.status }}</td>
<td>{{ record.owner }}</td>
<td style="max-width: 350px;">{{ record.reference }}</td>
<td>
{{ record.modifiedAt.format('Y-m-d') }}<br>
{{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }}
</td>
<td style="min-width: 120px;">
<div class="buttons">
<button class="button is-small is-link" title="Edit record">
<span class="icon">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</span> </span>
</button> </button>
<a href="{{ path('app_bibliography_copy', {'id' : record.id}) }}" <button data-url="{{ path('app_bibliography_del', {'id' : record.id}) }}"
class="button is-link"> class="button is-small is-danger" title="Delete record"
Copy data-delete-record-target="path" data-action="click->delete-record#warn">
<span class="icon ml-2"> <span class="icon">
<i class="fa fa-copy"></i>
</span>
</a>
<a href="{{ path('app_bibliography_del', {'id' : record.id}) }}"
class="button is-danger"
data-delete-record-target="path" data-action="click->delete-record#show">
Delete
<span class="icon ml-2">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</span> </span>
</a> </button>
</div> </div>
</div> </td>
{% endif %} </tr>
<div class="tabs is-boxed is-fullwidth"> {% endfor %}
<ul>
<li class="is-active">Record</li>
<li>Relations</li>
</ul>
</div>
<div class="data-tabs" id="record">
<table class="table is-fullwidth pt-4 record">
<tr><th>Record ID</th><td>{{ record.id }}</td></tr>
<tr><th>Status</th><td>{{ record.getStatus() }}</td></tr>
<tr><th>Editor(s)</th><td>{{ record.editor }}</td></tr>
<tr><th>Citation</th><td>{{ record.citation }}</td></tr>
<tr><th>Reference</th><td>{{ record.reference }}</td></tr>
<tr><th>Editorial notes</th><td>{{ record.notes }}</td></tr>
</table> </table>
</div>
<div class="data-tabs is-hidden" id="relations">
Some stuff...
</div>
</div>
<div class="modal" data-delete-record-target="modal"> <div class="modal" data-delete-record-target="modal">
<div class="modal-background"></div> <div class="modal-background"></div>
<div class="modal-card"> <div class="modal-card">
@@ -77,7 +96,7 @@
<button class="delete" aria-label="close"></button> <button class="delete" aria-label="close"></button>
</header> </header>
<section class="modal-card-body"> <section class="modal-card-body">
<p class="is-size-5">This record will be permanently deleted. Proceed?</p> <p class="is-size-5" data-delete-record-target="message"></p>
</section> </section>
<footer class="modal-card-foot"> <footer class="modal-card-foot">
<div class="buttons is-right"> <div class="buttons is-right">

View File

@@ -0,0 +1,126 @@
{% extends 'data_entry.html.twig' %}
{% block title %}Bibliography - {{ record.citation }} | ArCOA{% endblock %}
{% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record">
<p class="pb-3">
<a class="button is-link is-outlined"
href="{{ path('app_bibliography') }}">
Back to index
<span class="icon ml-2">
<i class="fa fa-arrow-left"></i>
</span>
</a>
</p>
<h1 class="is-size-1 mt-0 has-text-centered">Bibliography</h1>
<h2 class="is-size-3 mt-3 has-text-centered">{{ record.citation }}</h2>
{% for message in app.flashes('notice') %}
<div class=" mt-4 notification is-success"
data-controller="notification"
data-notification-target="notif">
<button class="delete" data-action="click->notification#close"></button>
{{ message }}
</div>
{% endfor %}
<article class="message is-info mt-3">
<div class="message-body">
<p>
<strong>Last modified:</strong> {{ record.modifiedAt.format('Y-m-d') }}
at {{ record.modifiedAt.format('H:i:s') }}
</p>
<p><strong>Editor:</strong> {{ record.editor }}</p>
</div>
</article>
<div class="card p-5">
{% if not is_granted('ROLE_READER') %}
<div class="columns">
<div class="column is-half"></div>
<div class="column has-text-right">
{% if is_granted('ROLE_REVISOR') or
is_granted('ROLE_ADMIN') or
record.editableStatus %}
<button class="button is-link">
Edit
<span class="icon ml-2">
<i class="fa fa-edit"></i>
</span>
</button>
{% endif %}
<a href="{{ path('app_bibliography_copy', {'id' : record.id}) }}"
class="button is-link">
Copy
<span class="icon ml-2">
<i class="fa fa-copy"></i>
</span>
</a>
{% if is_granted('ROLE_REVISOR') or is_granted('ROLE_ADMIN') %}
<button data-url="{{ path('app_bibliography_del', {'id' : record.id}) }}"
class="button is-danger"
data-delete-record-target="path" data-action="click->delete-record#warn">
Delete
<span class="icon ml-2">
<i class="fa fa-trash"></i>
</span>
</button>
{% endif %}
</div>
</div>
{% endif %}
<div class="tabs is-boxed is-fullwidth">
<ul>
<li class="is-active">Record</li>
<li>Relations</li>
</ul>
</div>
<div class="data-tabs" id="record">
<table class="table is-fullwidth pt-4 record">
<tr><th>Record ID</th><td>{{ record.id }}</td></tr>
<tr><th>Status</th><td>{{ record.getStatus() }}</td></tr>
<tr><th>Editor(s)</th><td>{{ record.editor }}</td></tr>
<tr><th>Citation</th><td data-delete-record-target="name">{{ record.citation }}</td></tr>
<tr><th>Reference</th><td>{{ record.reference }}</td></tr>
<tr><th>Editorial notes</th><td>{{ record.notes }}</td></tr>
</table>
</div>
<div class="data-tabs is-hidden" id="relations">
Some stuff...
</div>
</div>
<p class="pb-3 pt-3">
<a class="button is-link is-outlined"
href="{{ path('app_bibliography') }}">
Back to index
<span class="icon ml-2">
<i class="fa fa-arrow-left"></i>
</span>
</a>
</p>
<div class="modal" data-delete-record-target="modal">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<span class="icon is-large has-text-warning">
<i class="fa fa-warning fa-2x"></i>
</span>
<p class="modal-card-title has-text-danger pl-2"><strong>Delete record?</strong></p>
<button class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body">
<p class="is-size-5" data-delete-record-target="message"></p>
</section>
<footer class="modal-card-foot">
<div class="buttons is-right">
<button class="button is-link" data-action="click->delete-record#delete">Confirm</button>
<button class="button is-light" id="cancel">Cancel</button>
</div>
</footer>
</div>
</div>
</div>
{% endblock %}

View File

@@ -1,91 +1,89 @@
{% extends 'data_entry.html.twig' %} {% extends 'data_entry.html.twig' %}
{% block title %}Collection - {{ record.title }} | ArCOA{% endblock %} {% block title %}Collection | ArCOA{% endblock %}
{% block rightpanel %} {% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record"> <div class="container" style="max-width: 60vw" data-controller="delete-record">
<h1 class="is-size-1 mt-0 has-text-centered">Collection</h1> <h1 class="is-size-1 mt-0 has-text-centered">Collection</h1>
<h2 class="is-size-3 mt-3 has-text-centered">{{ record.title }}</h2> <h2 class="is-size-3 mt-3 has-text-centered">Choose action</h2>
<article class="message is-info mt-3"> {% for message in app.flashes('notice') %}
<div class="message-body"> <div class=" mt-4 notification is-success"
<p> data-controller="notification"
<strong>Last modified:</strong> {{ record.modifiedAt.format('Y-m-d') }} data-notification-target="notif">
at {{ record.modifiedAt.format('H:i:s') }} <button class="delete" data-action="click->notification#close"></button>
</p> {{ message }}
<p><strong>Editor:</strong> {{ record.editor }}</p>
</div> </div>
</article> {% endfor %}
<div class="card p-5"> <div class="card p-5 mt-6 pt-6 pb-6">
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %}
<div class="columns"> <div class="columns">
<div class="column is-half"></div> <div class="column is-half has-text-centered">
<div class="column has-text-right"> <button class="button is-medium">
<button class="button is-link"> Search
Edit
<span class="icon ml-2"> <span class="icon ml-2">
<i class="fa fa-edit"></i> <i class="fa fa-search"></i>
</span> </span>
</button> </button>
<button class="button is-link"> </div>
Copy {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') or is_granted('ROLE_EDITOR') %}
<div class="column has-text-centered">
<a href="" class="button is-link is-medium">
Add new
<span class="icon ml-2"> <span class="icon ml-2">
<i class="fa fa-copy"></i> <i class="fa fa-plus"></i>
</span>
</button>
<a href="{{ path('app_collection_del', {'id' : record.id}) }}"
class="button is-danger"
data-delete-record-target="path" data-action="click->delete-record#show">
Delete
<span class="icon ml-2">
<i class="fa fa-trash"></i>
</span> </span>
</a> </a>
</div> </div>
</div>
{% endif %} {% endif %}
<div class="tabs is-boxed is-fullwidth">
<ul>
<li class="is-active">Record</li>
<li>Relations</li>
</ul>
</div> </div>
<div class="data-tabs" id="record">
<table class="table is-fullwidth pt-4 record">
<tr><th>Record ID</th><td>{{ record.id }}</td></tr>
<tr><th>Status</th><td>{{ record.getStatus() }}</td></tr>
<tr><th>Editor(s)</th><td>{{ record.editor }}</td></tr>
<tr><th>Collection name</th><td>{{ record.title }}</td></tr>
<tr><th>Chronology</th><td>{{ record.chronology }}</td></tr>
<tr><th>Start date</th><td>{{ record.startDate }}</td></tr>
<tr><th>End date</th><td>{{ record.endDate }}</td></tr>
<tr><th>Description</th><td>{{ record.description }}</td></tr>
<tr><th>Short description</th><td>{{ record.shortDescription }}</td></tr>
<tr><th>External identifier(s)</th><td>{{ record.externalIdentifier }}</td></tr>
<tr><th>External link(s)</th><td>{{ record.link }}</td></tr>
<tr><th>Subject headings</th><td>{{ record.subjectHeadings }}</td></tr>
<tr><th>ArCOA URI</th><td>{{ record.uri }}</td></tr>
<tr><th>Editorial notes</th><td>{{ record.notes }}</td></tr>
</table>
</div> </div>
<div class="data-tabs is-hidden" id="relations">
{% if record.bibliographies %} <h3 class="has-text-centered is-size-4 mt-6">Records</h3>
<p class="p-4 has-text-bold">Bibliographies</p> <p class="pt-4 pb-4"><strong>{{ count }} result(s) found</strong></p>
<table class="table is-fullwidth is-hoverable has-text-centered"> <table class="table is-hoverable is-fullwidth mt-5 has-text-centered results">
<tr><th>ID</th><th>Status</th><th>Citation</th><th>Editor</th><th>Reference</th></tr>
{% for biblio in record.bibliographies %}
<tr> <tr>
<td><a href="{{ path('app_bibliography', {'id' : biblio.id}) }}">{{ biblio.id }}</a></td> <th>ID</th>
<td><a href="{{ path('app_bibliography', {'id' : biblio.id}) }}">{{ biblio.citation }}</a></td> <th>Title</th>
<td>{{ biblio.status }}</td> <th>Status</th>
<td>{{ biblio.editor }}</td> <th>Editor</th>
<td>{{ biblio.reference }}</td> <th>Chronology</th>
<th>Last modified</th>
<th>Actions</th>
</tr>
{% for record in records %}
<tr>
<td><a href="{{ path('app_collection_view', {'id' : record.id}) }}">{{ record.id }}</a></td>
<td>
<a data-delete-record-target="name" href="{{ path('app_collection_view', {'id' : record.id}) }}">
{{ record.title }}
</a>
</td>
<td>{{ record.status }}</td>
<td>{{ record.owner }}</td>
<td style="max-width: 350px;">{{ record.chronology }}</td>
<td>
{{ record.modifiedAt.format('Y-m-d') }}<br>
{{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }}
</td>
<td style="min-width: 120px;">
<div class="buttons">
<button class="button is-small is-link" title="Edit record">
<span class="icon">
<i class="fa fa-edit"></i>
</span>
</button>
<button data-url="{{ path('app_collection_del', {'id' : record.id}) }}"
class="button is-small is-danger" title="Delete record"
data-delete-record-target="path" data-action="click->delete-record#warn">
<span class="icon">
<i class="fa fa-trash"></i>
</span>
</button>
</div>
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% endif %}
</div>
</div>
<div class="modal" data-delete-record-target="modal"> <div class="modal" data-delete-record-target="modal">
<div class="modal-background"></div> <div class="modal-background"></div>
<div class="modal-card"> <div class="modal-card">
@@ -97,7 +95,7 @@
<button class="delete" aria-label="close"></button> <button class="delete" aria-label="close"></button>
</header> </header>
<section class="modal-card-body"> <section class="modal-card-body">
<p class="is-size-5">This record will be permanently deleted. Proceed?</p> <p class="is-size-5" data-delete-record-target="message"></p>
</section> </section>
<footer class="modal-card-foot"> <footer class="modal-card-foot">
<div class="buttons is-right"> <div class="buttons is-right">

View File

@@ -0,0 +1,141 @@
{% extends 'data_entry.html.twig' %}
{% block title %}Collection - {{ record.title }} | ArCOA{% endblock %}
{% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record">
<p class="pb-3">
<a class="button is-link is-outlined"
href="{{ path('app_collection') }}">
Back to index
<span class="icon ml-2">
<i class="fa fa-arrow-left"></i>
</span>
</a>
</p>
<h1 class="is-size-1 mt-0 has-text-centered">Collection</h1>
<h2 class="is-size-3 mt-3 has-text-centered">{{ record.title }}</h2>
{% for message in app.flashes('notice') %}
<div class=" mt-4 notification is-success"
data-controller="notification"
data-notification-target="notif">
<button class="delete" data-action="click->notification#close"></button>
{{ message }}
</div>
{% endfor %}
<article class="message is-info mt-3">
<div class="message-body">
<p>
<strong>Last modified:</strong> {{ record.modifiedAt.format('Y-m-d') }}
at {{ record.modifiedAt.format('H:i:s') }}
</p>
<p><strong>Editor:</strong> {{ record.editor }}</p>
</div>
</article>
<div class="card p-5">
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %}
<div class="columns">
<div class="column is-half"></div>
<div class="column has-text-right">
<button class="button is-link">
Edit
<span class="icon ml-2">
<i class="fa fa-edit"></i>
</span>
</button>
<a href="{{ path('app_collection_copy', {'id' : record.id}) }}"
class="button is-link">
Copy
<span class="icon ml-2">
<i class="fa fa-copy"></i>
</span>
</a>
<button data-url="{{ path('app_collection_del', {'id' : record.id}) }}"
class="button is-danger"
data-delete-record-target="path" data-action="click->delete-record#warn">
Delete
<span class="icon ml-2">
<i class="fa fa-trash"></i>
</span>
</button>
</div>
</div>
{% endif %}
<div class="tabs is-boxed is-fullwidth">
<ul>
<li class="is-active">Record</li>
<li>Relations</li>
</ul>
</div>
<div class="data-tabs" id="record">
<table class="table is-fullwidth pt-4 record">
<tr><th>Record ID</th><td>{{ record.id }}</td></tr>
<tr><th>Status</th><td>{{ record.getStatus() }}</td></tr>
<tr><th>Editor(s)</th><td>{{ record.editor }}</td></tr>
<tr><th>Collection name</th><td data-delete-record-target="name">{{ record.title }}</td></tr>
<tr><th>Chronology</th><td>{{ record.chronology }}</td></tr>
<tr><th>Start date</th><td>{{ record.startDate }}</td></tr>
<tr><th>End date</th><td>{{ record.endDate }}</td></tr>
<tr><th>Description</th><td>{{ record.description }}</td></tr>
<tr><th>Short description</th><td>{{ record.shortDescription }}</td></tr>
<tr><th>External identifier(s)</th><td>{{ record.externalIdentifier }}</td></tr>
<tr><th>External link(s)</th><td>{{ record.link }}</td></tr>
<tr><th>Subject headings</th><td>{{ record.subjectHeadings }}</td></tr>
<tr><th>ArCOA URI</th><td>arcoa.cnr.it/collection/{{ record.id }}</td></tr>
<tr><th>Editorial notes</th><td>{{ record.notes }}</td></tr>
</table>
</div>
<div class="data-tabs is-hidden" id="relations">
{% if record.bibliographies %}
<p class="p-4 has-text-bold">Bibliographies</p>
<table class="table is-fullwidth is-hoverable has-text-centered">
<tr><th>ID</th><th>Status</th><th>Citation</th><th>Editor</th><th>Reference</th></tr>
{% for biblio in record.bibliographies %}
<tr>
<td><a href="{{ path('app_bibliography', {'id' : biblio.id}) }}">{{ biblio.id }}</a></td>
<td><a href="{{ path('app_bibliography', {'id' : biblio.id}) }}">{{ biblio.citation }}</a></td>
<td>{{ biblio.status }}</td>
<td>{{ biblio.editor }}</td>
<td>{{ biblio.reference }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
</div>
</div>
<p class="pb-3 pt-3">
<a class="button is-link is-outlined"
href="{{ path('app_collection') }}">
Back to index
<span class="icon ml-2">
<i class="fa fa-arrow-left"></i>
</span>
</a>
</p>
<div class="modal" data-delete-record-target="modal">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<span class="icon is-large has-text-warning">
<i class="fa fa-warning fa-2x"></i>
</span>
<p class="modal-card-title has-text-danger pl-2"><strong>Delete record?</strong></p>
<button class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body">
<p class="is-size-5" data-delete-record-target="message"></p>
</section>
<footer class="modal-card-foot">
<div class="buttons is-right">
<button class="button is-link" data-action="click->delete-record#delete">Confirm</button>
<button class="button is-light" id="cancel">Cancel</button>
</div>
</footer>
</div>
</div>
</div>
{% endblock %}

View File

@@ -1,91 +1,89 @@
{% extends 'data_entry.html.twig' %} {% extends 'data_entry.html.twig' %}
{% block title %}Collector - {{ record.name }} | ArCOA{% endblock %} {% block title %}Collector | ArCOA{% endblock %}
{% block rightpanel %} {% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record"> <div class="container" style="max-width: 60vw" data-controller="delete-record">
<h1 class="is-size-1 mt-0 has-text-centered">Collector</h1> <h1 class="is-size-1 mt-0 has-text-centered">Collector</h1>
<h2 class="is-size-3 mt-3 has-text-centered">{{ record.name }}</h2> <h2 class="is-size-3 mt-3 has-text-centered">Choose action</h2>
<article class="message is-info mt-3"> {% for message in app.flashes('notice') %}
<div class="message-body"> <div class=" mt-4 notification is-success"
<p> data-controller="notification"
<strong>Last modified:</strong> {{ record.modifiedAt.format('Y-m-d') }} data-notification-target="notif">
at {{ record.modifiedAt.format('H:i:s') }} <button class="delete" data-action="click->notification#close"></button>
</p> {{ message }}
<p><strong>Editor:</strong> {{ record.editor }}</p>
</div> </div>
</article> {% endfor %}
<div class="card p-5"> <div class="card p-5 mt-6 pt-6 pb-6">
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %}
<div class="columns"> <div class="columns">
<div class="column is-half"></div> <div class="column is-half has-text-centered">
<div class="column has-text-right"> <button class="button is-medium">
<button class="button is-link"> Search
Edit
<span class="icon ml-2"> <span class="icon ml-2">
<i class="fa fa-edit"></i> <i class="fa fa-search"></i>
</span> </span>
</button> </button>
<button class="button is-link"> </div>
Copy {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') or is_granted('ROLE_EDITOR') %}
<div class="column has-text-centered">
<a href="" class="button is-link is-medium">
Add new
<span class="icon ml-2"> <span class="icon ml-2">
<i class="fa fa-copy"></i> <i class="fa fa-plus"></i>
</span>
</button>
<a href=""
class="button is-danger"
data-delete-record-target="path" data-action="click->delete-record#show">
Delete
<span class="icon ml-2">
<i class="fa fa-trash"></i>
</span> </span>
</a> </a>
</div> </div>
</div>
{% endif %} {% endif %}
<div class="tabs is-boxed is-fullwidth">
<ul>
<li class="is-active">Record</li>
<li>Relations</li>
</ul>
</div> </div>
<div class="data-tabs" id="record">
<table class="table is-fullwidth pt-4 record">
<tr><th>Record ID</th><td>{{ record.id }}</td></tr>
<tr><th>Status</th><td>{{ record.getStatus() }}</td></tr>
<tr><th>Editor(s)</th><td>{{ record.editor }}</td></tr>
<tr><th>Name</th><td>{{ record.name }}</td></tr>
<tr><th>Date of birth</th><td>{{ record.birthDate }}</td></tr>
<tr><th>Date of death</th><td>{{ record.deathDate }}</td></tr>
<tr><th>Places / areas of activity</th><td>{{ record.places }}</td></tr>
<tr><th>Description</th><td>{{ record.description }}</td></tr>
<tr><th>Short description</th><td>{{ record.shortDescription }}</td></tr>
<tr><th>External identifier(s)</th><td>{{ record.externalIdentifier }}</td></tr>
<tr><th>External link(s)</th><td>{{ record.link }}</td></tr>
<tr><th>Subject headings</th><td>{{ record.subjectHeadings }}</td></tr>
<tr><th>ArCOA URI</th><td>{{ record.uri }}</td></tr>
<tr><th>Editorial notes</th><td>{{ record.notes }}</td></tr>
</table>
</div> </div>
<div class="data-tabs is-hidden" id="relations">
{% if record.bibliographies %} <h3 class="has-text-centered is-size-4 mt-6">Records</h3>
<p class="p-4 has-text-bold">Bibliographies</p> <p class="pt-4 pb-4"><strong>{{ count }} result(s) found</strong></p>
<table class="table is-fullwidth is-hoverable has-text-centered"> <table class="table is-hoverable is-fullwidth mt-5 has-text-centered results">
<tr><th>ID</th><th>Status</th><th>Citation</th><th>Editor</th><th>Reference</th></tr>
{% for biblio in record.bibliographies %}
<tr> <tr>
<td><a href="{{ path('app_bibliography', {'id' : biblio.id}) }}">{{ biblio.id }}</a></td> <th>ID</th>
<td><a href="{{ path('app_bibliography', {'id' : biblio.id}) }}">{{ biblio.citation }}</a></td> <th>Name</th>
<td>{{ biblio.status }}</td> <th>Status</th>
<td>{{ biblio.editor }}</td> <th>Editor</th>
<td>{{ biblio.reference }}</td> <th>Places / areas of activity</th>
<th>Last modified</th>
<th>Actions</th>
</tr>
{% for record in records %}
<tr>
<td><a href="{{ path('app_collector_view', {'id' : record.id}) }}">{{ record.id }}</a></td>
<td>
<a data-delete-record-target="name" href="{{ path('app_collector_view', {'id' : record.id}) }}">
{{ record.name }}
</a>
</td>
<td>{{ record.status }}</td>
<td>{{ record.owner }}</td>
<td style="max-width: 350px;">{{ record.places }}</td>
<td>
{{ record.modifiedAt.format('Y-m-d') }}<br>
{{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }}
</td>
<td style="min-width: 120px;">
<div class="buttons">
<button class="button is-small is-link" title="Edit record">
<span class="icon">
<i class="fa fa-edit"></i>
</span>
</button>
<button data-url="{{ path('app_collector_del', {'id' : record.id}) }}"
class="button is-small is-danger" title="Delete record"
data-delete-record-target="path" data-action="click->delete-record#warn">
<span class="icon">
<i class="fa fa-trash"></i>
</span>
</button>
</div>
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% endif %}
</div>
</div>
<div class="modal" data-delete-record-target="modal"> <div class="modal" data-delete-record-target="modal">
<div class="modal-background"></div> <div class="modal-background"></div>
<div class="modal-card"> <div class="modal-card">
@@ -97,7 +95,7 @@
<button class="delete" aria-label="close"></button> <button class="delete" aria-label="close"></button>
</header> </header>
<section class="modal-card-body"> <section class="modal-card-body">
<p class="is-size-5">This record will be permanently deleted. Proceed?</p> <p class="is-size-5" data-delete-record-target="message"></p>
</section> </section>
<footer class="modal-card-foot"> <footer class="modal-card-foot">
<div class="buttons is-right"> <div class="buttons is-right">
@@ -108,5 +106,4 @@
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript" defer></script>
{% endblock %} {% endblock %}

View File

@@ -0,0 +1,142 @@
{% extends 'data_entry.html.twig' %}
{% block title %}Collector - {{ record.name }} | ArCOA{% endblock %}
{% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record">
<p class="pb-3">
<a class="button is-link is-outlined"
href="{{ path('app_collector') }}">
Back to index
<span class="icon ml-2">
<i class="fa fa-arrow-left"></i>
</span>
</a>
</p>
<h1 class="is-size-1 mt-0 has-text-centered">Collector</h1>
<h2 class="is-size-3 mt-3 has-text-centered">{{ record.name }}</h2>
{% for message in app.flashes('notice') %}
<div class=" mt-4 notification is-success"
data-controller="notification"
data-notification-target="notif">
<button class="delete" data-action="click->notification#close"></button>
{{ message }}
</div>
{% endfor %}
<article class="message is-info mt-3">
<div class="message-body">
<p>
<strong>Last modified:</strong> {{ record.modifiedAt.format('Y-m-d') }}
at {{ record.modifiedAt.format('H:i:s') }}
</p>
<p><strong>Editor:</strong> {{ record.editor }}</p>
</div>
</article>
<div class="card p-5">
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %}
<div class="columns">
<div class="column is-half"></div>
<div class="column has-text-right">
<button class="button is-link">
Edit
<span class="icon ml-2">
<i class="fa fa-edit"></i>
</span>
</button>
<a href="{{ path('app_collector_copy', {'id' : record.id}) }}"
class="button is-link">
Copy
<span class="icon ml-2">
<i class="fa fa-copy"></i>
</span>
</a>
<button data-url="{{ path('app_collector_del', {'id' : record.id}) }}"
class="button is-danger"
data-delete-record-target="path" data-action="click->delete-record#warn">
Delete
<span class="icon ml-2">
<i class="fa fa-trash"></i>
</span>
</button>
</div>
</div>
{% endif %}
<div class="tabs is-boxed is-fullwidth">
<ul>
<li class="is-active">Record</li>
<li>Relations</li>
</ul>
</div>
<div class="data-tabs" id="record">
<table class="table is-fullwidth pt-4 record">
<tr><th>Record ID</th><td>{{ record.id }}</td></tr>
<tr><th>Status</th><td>{{ record.getStatus() }}</td></tr>
<tr><th>Editor(s)</th><td>{{ record.editor }}</td></tr>
<tr><th>Name</th><td data-delete-record-target="name">{{ record.name }}</td></tr>
<tr><th>Date of birth</th><td>{{ record.birthDate }}</td></tr>
<tr><th>Date of death</th><td>{{ record.deathDate }}</td></tr>
<tr><th>Places / areas of activity</th><td>{{ record.places }}</td></tr>
<tr><th>Description</th><td>{{ record.description }}</td></tr>
<tr><th>Short description</th><td>{{ record.shortDescription }}</td></tr>
<tr><th>External identifier(s)</th><td>{{ record.externalIdentifier }}</td></tr>
<tr><th>External link(s)</th><td>{{ record.link }}</td></tr>
<tr><th>Subject headings</th><td>{{ record.subjectHeadings }}</td></tr>
<tr><th>ArCOA URI</th><td>arcoa.cnr.it/collector/{{ record.id }}</td></tr>
<tr><th>Editorial notes</th><td>{{ record.notes }}</td></tr>
</table>
</div>
<div class="data-tabs is-hidden" id="relations">
{% if record.bibliographies %}
<p class="p-4 has-text-bold">Bibliographies</p>
<table class="table is-fullwidth is-hoverable has-text-centered">
<tr><th>ID</th><th>Status</th><th>Citation</th><th>Editor</th><th>Reference</th></tr>
{% for biblio in record.bibliographies %}
<tr>
<td><a href="{{ path('app_bibliography', {'id' : biblio.id}) }}">{{ biblio.id }}</a></td>
<td><a href="{{ path('app_bibliography', {'id' : biblio.id}) }}">{{ biblio.citation }}</a></td>
<td>{{ biblio.status }}</td>
<td>{{ biblio.editor }}</td>
<td>{{ biblio.reference }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
</div>
</div>
<p class="pb-3 pt-3">
<a class="button is-link is-outlined"
href="{{ path('app_collector') }}">
Back to index
<span class="icon ml-2">
<i class="fa fa-arrow-left"></i>
</span>
</a>
</p>
<div class="modal" data-delete-record-target="modal">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<span class="icon is-large has-text-warning">
<i class="fa fa-warning fa-2x"></i>
</span>
<p class="modal-card-title has-text-danger pl-2"><strong>Delete record?</strong></p>
<button class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body">
<p class="is-size-5" data-delete-record-target="message"></p>
</section>
<footer class="modal-card-foot">
<div class="buttons is-right">
<button class="button is-link" data-action="click->delete-record#delete">Confirm</button>
<button class="button is-light" id="cancel">Cancel</button>
</div>
</footer>
</div>
</div>
</div>
<script type="text/javascript" defer></script>
{% endblock %}

View File

@@ -1,15 +1,17 @@
{% extends 'data_entry.html.twig' %} {% extends 'data_entry.html.twig' %}
{% block title %}Bibliography | ArCOA{% endblock %} {% block title %}Conservation place | ArCOA{% endblock %}
{% block rightpanel %} {% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record"> <div class="container" style="max-width: 60vw" data-controller="delete-record">
<h1 class="is-size-1 mt-0 has-text-centered">Bibliography</h1> <h1 class="is-size-1 mt-0 has-text-centered">Conservation place</h1>
<h2 class="is-size-3 mt-3 has-text-centered">Choose action</h2> <h2 class="is-size-3 mt-3 has-text-centered">Choose action</h2>
{% for message in app.flashes('notice') %} {% for message in app.flashes('notice') %}
<div class=" mt-4 notification is-success"> <div class=" mt-4 notification is-success"
<button class="delete"></button> data-controller="notification"
data-notification-target="notif">
<button class="delete" data-action="click->notification#close"></button>
{{ message }} {{ message }}
</div> </div>
{% endfor %} {% endfor %}
@@ -25,7 +27,7 @@
</div> </div>
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') or is_granted('ROLE_EDITOR') %} {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') or is_granted('ROLE_EDITOR') %}
<div class="column has-text-centered"> <div class="column has-text-centered">
<a href="{{ path('app_bibliography_create') }}" class="button is-link is-medium"> <a href="" class="button is-link is-medium">
Add new Add new
<span class="icon ml-2"> <span class="icon ml-2">
<i class="fa fa-plus"></i> <i class="fa fa-plus"></i>
@@ -41,20 +43,24 @@
<table class="table is-hoverable is-fullwidth mt-5 has-text-centered results"> <table class="table is-hoverable is-fullwidth mt-5 has-text-centered results">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Citation</th> <th>Place</th>
<th>Status</th> <th>Status</th>
<th>Editor</th> <th>Editor</th>
<th>Reference</th> <th>Municipality</th>
<th>Last modified</th> <th>Last modified</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
{% for record in records %} {% for record in records %}
<tr> <tr>
<td><a href="{{ path('app_bibliography', {'id' : record.id}) }}">{{ record.id }}</a></td> <td><a href="{{ path('app_conservation_place_view', {'id' : record.id}) }}">{{ record.id }}</a></td>
<td><a href="{{ path('app_bibliography', {'id' : record.id}) }}">{{ record.citation }}</a></td> <td>
<a data-delete-record-target="name" href="{{ path('app_conservation_place_view', {'id' : record.id}) }}">
{{ record.place }}
</a>
</td>
<td>{{ record.status }}</td> <td>{{ record.status }}</td>
<td>{{ record.owner }}</td> <td>{{ record.owner }}</td>
<td style="max-width: 350px;">{{ record.reference }}</td> <td style="max-width: 350px;">{{ record.municipality }}</td>
<td> <td>
{{ record.modifiedAt.format('Y-m-d') }}<br> {{ record.modifiedAt.format('Y-m-d') }}<br>
{{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }} {{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }}
@@ -66,13 +72,13 @@
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</span> </span>
</button> </button>
<a href="{{ path('app_bibliography_del', {'id' : record.id}) }}" <button data-url="{{ path('app_conservation_place_del', {'id' : record.id}) }}"
class="button is-small is-danger" title="Delete record" class="button is-small is-danger" title="Delete record"
data-delete-record-target="path" data-action="click->delete-record#show"> data-delete-record-target="path" data-action="click->delete-record#warn">
<span class="icon"> <span class="icon">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</span> </span>
</a> </button>
</div> </div>
</td> </td>
</tr> </tr>
@@ -89,7 +95,7 @@
<button class="delete" aria-label="close"></button> <button class="delete" aria-label="close"></button>
</header> </header>
<section class="modal-card-body"> <section class="modal-card-body">
<p class="is-size-5">This record will be permanently deleted. Proceed?</p> <p class="is-size-5" data-delete-record-target="message"></p>
</section> </section>
<footer class="modal-card-foot"> <footer class="modal-card-foot">
<div class="buttons is-right"> <div class="buttons is-right">
@@ -100,12 +106,4 @@
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript" defer>
const delBtns = document.querySelectorAll('.delete');
for (let btn of delBtns) {
btn.addEventListener('click', function () {
this.parentElement.classList.add('is-hidden');
})
}
</script>
{% endblock %} {% endblock %}

View File

@@ -0,0 +1,170 @@
{% extends 'data_entry.html.twig' %}
{% block title %}Conservation place - {{ record.place }} | ArCOA{% endblock %}
{% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record map">
<p class="pb-3">
<a class="button is-link is-outlined"
href="{{ path('app_conservation_place') }}">
Back to index
<span class="icon ml-2">
<i class="fa fa-arrow-left"></i>
</span>
</a>
</p>
<h1 class="is-size-1 mt-0 has-text-centered">Conservation place</h1>
<h2 class="is-size-3 mt-3 has-text-centered">{{ record.place }}</h2>
{% for message in app.flashes('notice') %}
<div class=" mt-4 notification is-success"
data-controller="notification"
data-notification-target="notif">
<button class="delete" data-action="click->notification#close"></button>
{{ message }}
</div>
{% endfor %}
<article class="message is-info mt-3">
<div class="message-body">
<p>
<strong>Last modified:</strong> {{ record.modifiedAt.format('Y-m-d') }}
at {{ record.modifiedAt.format('H:i:s') }}
</p>
<p><strong>Editor:</strong> {{ record.editor }}</p>
</div>
</article>
<div class="card p-5">
{% if app.user and not is_granted('ROLE_READER') %}
<div class="columns">
<div class="column is-half"></div>
<div class="column has-text-right">
{% if is_granted('ROLE_REVISOR') or
is_granted('ROLE_ADMIN') or
record.editableStatus %}
<button class="button is-link">
Edit
<span class="icon ml-2">
<i class="fa fa-edit"></i>
</span>
</button>
{% endif %}
<a href="{{ path('app_conservation_place_copy', {'id' : record.id}) }}"
class="button is-link">
Copy
<span class="icon ml-2">
<i class="fa fa-copy"></i>
</span>
</a>
{% if is_granted('ROLE_REVISOR') or is_granted('ROLE_ADMIN') %}
<button data-url="{{ path('app_conservation_place_del', {'id' : record.id}) }}"
class="button is-danger"
data-delete-record-target="path" data-action="click->delete-record#warn">
Delete
<span class="icon ml-2">
<i class="fa fa-trash"></i>
</span>
</button>
{% endif %}
</div>
</div>
{% endif %}
<div class="tabs is-boxed is-fullwidth">
<ul>
<li class="is-active">Record</li>
<li>Relations</li>
</ul>
</div>
<div class="data-tabs" id="record">
<table class="table is-fullwidth pt-4 record">
<tr><th>Record ID</th><td>{{ record.id }}</td></tr>
<tr><th>Status</th><td>{{ record.getStatus() }}</td></tr>
<tr><th>Editor(s)</th><td>{{ record.editor }}</td></tr>
<tr><th>Conservation place</th>
<td data-delete-record-target="name" data-map-target="name">
{{ record.place }}
</td>
</tr>
<tr><th>Region</th><td>{{ record.region }}</td></tr>
<tr><th>Province</th><td>{{ record.province }}</td></tr>
<tr><th>Municipality</th><td>{{ record.municipality }}</td></tr>
<tr><th>Coordinates</th>
<td>
<span data-map-target="coords">{{ record.lat }}, {{ record.lng }}</span>
<button class="button is-link is-small ml-3"
title="Open map" data-action="click->map#open">
<span class="icon is-small p-2">
<i class="fa fa-map"></i>
</span>
</button>
</td>
</tr>
<tr><th>Description</th><td>{{ record.description }}</td></tr>
<tr><th>Short description</th><td>{{ record.shortDescription }}</td></tr>
<tr><th>External identifier(s)</th><td>{{ record.externalIdentifier }}</td></tr>
<tr><th>External link(s)</th><td>{{ record.link }}</td></tr>
<tr><th>Subject headings</th><td>{{ record.subjectHeadings }}</td></tr>
<tr><th>ArCOA URI</th><td>arcoa.cnr.it/conservation_place/{{ record.id }}</td></tr>
<tr><th>Editorial notes</th><td>{{ record.notes }}</td></tr>
</table>
</div>
<div class="data-tabs is-hidden" id="relations">
Some stuff...
</div>
</div>
<p class="pb-3 pt-3">
<a class="button is-link is-outlined"
href="{{ path('app_conservation_place') }}">
Back to index
<span class="icon ml-2">
<i class="fa fa-arrow-left"></i>
</span>
</a>
</p>
<div class="modal" data-delete-record-target="modal">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<span class="icon is-large has-text-warning">
<i class="fa fa-warning fa-2x"></i>
</span>
<p class="modal-card-title has-text-danger pl-2"><strong>Delete record?</strong></p>
<button class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body">
<p class="is-size-5" data-delete-record-target="message"></p>
</section>
<footer class="modal-card-foot">
<div class="buttons is-right">
<button class="button is-link" data-action="click->delete-record#delete">Confirm</button>
<button class="button is-light" id="cancel">Cancel</button>
</div>
</footer>
</div>
</div>
<div class="modal" data-map-target="modal">
<div class="modal-background" data-action="click->map#close"></div>
<div class="modal-card" style="min-width: 900px;">
<header class="modal-card-head">
<span class="icon is-large has-text-link">
<i class="fa fa-map fa-2x"></i>
</span>
<p class="modal-card-title pl-2 pt-1 pb-1"><strong>Interactive map</strong></p>
<button class="delete" aria-label="close" data-action="click->map#close"></button>
</header>
<section class="modal-card-body p-0">
<div data-map-target="map" id="map" style="min-height: 400px; max-width: 900px"></div>
</section>
<footer class="modal-card-foot">
<div class="buttons is-right">
<button class="button is-light" data-action="click->map#close">Close</button>
</div>
</footer>
</div>
</div>
</div>
{% endblock %}

View File

@@ -59,12 +59,13 @@
</nav> </nav>
<div class="columns mb-0"> <div class="columns mb-0">
<div class="column is-one-fifth arcoa-menu mb-0"> <div class="column is-one-fifth arcoa-menu mb-0">
<aside class="menu" data-controller="menu"> <aside class="menu" data-controller="menu"
{% if 'ROLE_READER' not in app.user.roles %} data-menu-state-value="0">
{% if app.user and 'ROLE_READER' not in app.user.roles %}
<p class="menu-label has-text-white mt-3 pt-5 pl-5 is-size-6"> <p class="menu-label has-text-white mt-3 pt-5 pl-5 is-size-6">
Vocabularies Vocabularies
<span class="icon is-clickable pl-4" id="for-vocabs" data-action="click->menu#toggle"> <span class="icon is-clickable pl-4" id="for-vocabs" data-action="click->menu#toggle">
<i class="fa fa-angle-right"></i> <i class="fa fa-angle-right" data-menu-target="vocabIcon"></i>
</span> </span>
</p> </p>
<ul class="pl-6 is-hidden has-text-white" data-menu-target="vocabs" id="vocabs"> <ul class="pl-6 is-hidden has-text-white" data-menu-target="vocabs" id="vocabs">
@@ -209,25 +210,57 @@
<p class="menu-label has-text-white mt-3 pt-5 pl-5 is-size-6"> <p class="menu-label has-text-white mt-3 pt-5 pl-5 is-size-6">
Records Records
<span class="icon is-clickable pl-4" id="for-records" data-action="click->menu#toggle"> <span class="icon is-clickable pl-4" id="for-records" data-action="click->menu#toggle">
<i class="fa fa-angle-right"></i> <i class="fa fa-angle-right" data-menu-target="recordIcon"></i>
</span> </span>
</p> </p>
<ul class="pl-6 is-hidden has-text-white" data-menu-target="records" id="records"> <ul class="pl-6 is-hidden has-text-white"
data-menu-target="records"
id="records">
<li class="pt-1 pb-1"> <li class="pt-1 pb-1">
<a href="{{ path('app_bibliography_landing') }}"> <a href="{{ path('app_bibliography') }}">
Bibliography Bibliography
</a> </a>
</li> </li>
<li class="pt-1 pb-1"> <li class="pt-1 pb-1">
<a href="{{ path('app_collection_landing') }}"> <a href="{{ path('app_collection') }}">
Collection Collection
</a> </a>
</li> </li>
<li class="pt-1 pb-1"> <li class="pt-1 pb-1">
<a href="{{ path('app_collector_landing') }}"> <a href="{{ path('app_collector') }}">
Collector Collector
</a> </a>
</li> </li>
<li class="pt-1 pb-1">
<a href="{{ path('app_conservation_place') }}">
Conservation place
</a>
</li>
<li class="pt-1 pb-1">
<a href="{{ path('app_document') }}">
Document
</a>
</li>
<li class="pt-1 pb-1">
<a href="">
Image
</a>
</li>
<li class="pt-1 pb-1">
<a href="">
Object
</a>
</li>
<li class="pt-1 pb-1">
<a href="{{ path('app_site') }}">
Site
</a>
</li>
<li class="pt-1 pb-1">
<a href="">
3D model
</a>
</li>
</ul> </ul>
</aside> </aside>
</div> </div>

View File

@@ -1,15 +1,17 @@
{% extends 'data_entry.html.twig' %} {% extends 'data_entry.html.twig' %}
{% block title %}Collection | ArCOA{% endblock %} {% block title %}Document | ArCOA{% endblock %}
{% block rightpanel %} {% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record"> <div class="container" style="max-width: 60vw" data-controller="delete-record">
<h1 class="is-size-1 mt-0 has-text-centered">Collection</h1> <h1 class="is-size-1 mt-0 has-text-centered">Document</h1>
<h2 class="is-size-3 mt-3 has-text-centered">Choose action</h2> <h2 class="is-size-3 mt-3 has-text-centered">Choose action</h2>
{% for message in app.flashes('notice') %} {% for message in app.flashes('notice') %}
<div class=" mt-4 notification is-success"> <div class=" mt-4 notification is-success"
<button class="delete"></button> data-controller="notification"
data-notification-target="notif">
<button class="delete" data-action="click->notification#close"></button>
{{ message }} {{ message }}
</div> </div>
{% endfor %} {% endfor %}
@@ -44,17 +46,21 @@
<th>Title</th> <th>Title</th>
<th>Status</th> <th>Status</th>
<th>Editor</th> <th>Editor</th>
<th>Chronology</th> <th>Author(s)</th>
<th>Last modified</th> <th>Last modified</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
{% for record in records %} {% for record in records %}
<tr> <tr>
<td><a href="{{ path('app_collection', {'id' : record.id}) }}">{{ record.id }}</a></td> <td><a href="{{ path('app_document_view', {'id' : record.id}) }}">{{ record.id }}</a></td>
<td><a href="{{ path('app_collection', {'id' : record.id}) }}">{{ record.title }}</a></td> <td>
<a data-delete-record-target="name" href="{{ path('app_document_view', {'id' : record.id}) }}">
{{ record.title }}
</a>
</td>
<td>{{ record.status }}</td> <td>{{ record.status }}</td>
<td>{{ record.owner }}</td> <td>{{ record.owner }}</td>
<td style="max-width: 350px;">{{ record.chronology }}</td> <td style="max-width: 350px;">{{ record.author }}</td>
<td> <td>
{{ record.modifiedAt.format('Y-m-d') }}<br> {{ record.modifiedAt.format('Y-m-d') }}<br>
{{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }} {{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }}
@@ -66,13 +72,13 @@
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</span> </span>
</button> </button>
<a href="{{ path('app_collection_del', {'id' : record.id}) }}" <button data-url="{{ path('app_document_del', {'id' : record.id}) }}"
class="button is-small is-danger" title="Delete record" class="button is-small is-danger" title="Delete record"
data-delete-record-target="path" data-action="click->delete-record#show"> data-delete-record-target="path" data-action="click->delete-record#warn">
<span class="icon"> <span class="icon">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</span> </span>
</a> </button>
</div> </div>
</td> </td>
</tr> </tr>
@@ -89,7 +95,7 @@
<button class="delete" aria-label="close"></button> <button class="delete" aria-label="close"></button>
</header> </header>
<section class="modal-card-body"> <section class="modal-card-body">
<p class="is-size-5">This record will be permanently deleted. Proceed?</p> <p class="is-size-5" data-delete-record-target="message"></p>
</section> </section>
<footer class="modal-card-foot"> <footer class="modal-card-foot">
<div class="buttons is-right"> <div class="buttons is-right">
@@ -100,12 +106,4 @@
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript" defer>
const delBtns = document.querySelectorAll('.delete');
for (let btn of delBtns) {
btn.addEventListener('click', function () {
this.parentElement.classList.add('is-hidden');
})
}
</script>
{% endblock %} {% endblock %}

View File

@@ -0,0 +1,144 @@
{% extends 'data_entry.html.twig' %}
{% block title %}Document - {{ record.title }} | ArCOA{% endblock %}
{% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record">
<p class="pb-3">
<a class="button is-link is-outlined"
href="{{ path('app_document') }}">
Back to index
<span class="icon ml-2">
<i class="fa fa-arrow-left"></i>
</span>
</a>
</p>
<h1 class="is-size-1 mt-0 has-text-centered">Document</h1>
<h2 class="is-size-3 mt-3 has-text-centered">{{ record.title }}</h2>
{% for message in app.flashes('notice') %}
<div class=" mt-4 notification is-success"
data-controller="notification"
data-notification-target="notif">
<button class="delete" data-action="click->notification#close"></button>
{{ message }}
</div>
{% endfor %}
<article class="message is-info mt-3">
<div class="message-body">
<p>
<strong>Last modified:</strong> {{ record.modifiedAt.format('Y-m-d') }}
at {{ record.modifiedAt.format('H:i:s') }}
</p>
<p><strong>Editor:</strong> {{ record.editor }}</p>
</div>
</article>
<div class="card p-5">
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %}
<div class="columns">
<div class="column is-half"></div>
<div class="column has-text-right">
<button class="button is-link">
Edit
<span class="icon ml-2">
<i class="fa fa-edit"></i>
</span>
</button>
<a href="{{ path('app_document_copy', {'id' : record.id}) }}"
class="button is-link">
Copy
<span class="icon ml-2">
<i class="fa fa-copy"></i>
</span>
</a>
<button data-url="{{ path('app_document_del', {'id' : record.id}) }}"
class="button is-danger"
data-delete-record-target="path" data-action="click->delete-record#warn">
Delete
<span class="icon ml-2">
<i class="fa fa-trash"></i>
</span>
</button>
</div>
</div>
{% endif %}
<div class="tabs is-boxed is-fullwidth">
<ul>
<li class="is-active">Record</li>
<li>Relations</li>
</ul>
</div>
<div class="data-tabs" id="record">
<table class="table is-fullwidth pt-4 record">
<tr><th>Record ID</th><td>{{ record.id }}</td></tr>
<tr><th>Status</th><td>{{ record.getStatus() }}</td></tr>
<tr><th>Editor(s)</th><td>{{ record.editor }}</td></tr>
<tr><th>Title</th><td data-delete-record-target="name">{{ record.title }}</td></tr>
<tr><th>Author(s)</th><td>{{ record.author }}</td></tr>
<tr><th>Inventory identifier</th><td>{{ record.inventory }}</td></tr>
<tr><th>Chronology</th><td>{{ record.chronology }}</td></tr>
<tr><th>Start date</th><td>{{ record.startDate }}</td></tr>
<tr><th>End date</th><td>{{ record.endDate }}</td></tr>
<tr><th>Unpublished document</th><td>{{ record.unpublished }}</td></tr>
<tr><th>Description</th><td>{{ record.description }}</td></tr>
<tr><th>Short description</th><td>{{ record.shortDescription }}</td></tr>
<tr><th>External identifier(s)</th><td>{{ record.externalIdentifier }}</td></tr>
<tr><th>External link(s)</th><td>{{ record.link }}</td></tr>
<tr><th>Subject headings</th><td>{{ record.subjectHeadings }}</td></tr>
<tr><th>ArCOA URI</th><td>arcoa.cnr.it/document/{{ record.id }}</td></tr>
<tr><th>Editorial notes</th><td>{{ record.notes }}</td></tr>
</table>
</div>
<div class="data-tabs is-hidden" id="relations">
{% if record.bibliographies %}
<p class="p-4 has-text-bold">Bibliographies</p>
<table class="table is-fullwidth is-hoverable has-text-centered">
<tr><th>ID</th><th>Status</th><th>Citation</th><th>Editor</th><th>Reference</th></tr>
{% for biblio in record.bibliographies %}
<tr>
<td><a href="{{ path('app_bibliography', {'id' : biblio.id}) }}">{{ biblio.id }}</a></td>
<td><a href="{{ path('app_bibliography', {'id' : biblio.id}) }}">{{ biblio.citation }}</a></td>
<td>{{ biblio.status }}</td>
<td>{{ biblio.editor }}</td>
<td>{{ biblio.reference }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
</div>
</div>
<p class="pb-3 pt-3">
<a class="button is-link is-outlined"
href="{{ path('app_document') }}">
Back to index
<span class="icon ml-2">
<i class="fa fa-arrow-left"></i>
</span>
</a>
</p>
<div class="modal" data-delete-record-target="modal">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<span class="icon is-large has-text-warning">
<i class="fa fa-warning fa-2x"></i>
</span>
<p class="modal-card-title has-text-danger pl-2"><strong>Delete record?</strong></p>
<button class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body">
<p class="is-size-5" data-delete-record-target="message"></p>
</section>
<footer class="modal-card-foot">
<div class="buttons is-right">
<button class="button is-link" data-action="click->delete-record#delete">Confirm</button>
<button class="button is-light" id="cancel">Cancel</button>
</div>
</footer>
</div>
</div>
</div>
{% endblock %}

View File

@@ -4,10 +4,13 @@
{% block rightpanel %} {% block rightpanel %}
{% for message in app.flashes('warning') %} {% for message in app.flashes('warning') %}
<article class="message is-warning mb-6 mt-3 ml-auto mr-auto" style="max-width: 35vw"> <article class="message is-warning mb-6 mt-3 ml-auto mr-auto" style="max-width: 35vw"
data-controller="notification"
data-notification-target="notif">
<div class="message-header"> <div class="message-header">
<p>Warning</p> <p>Warning</p>
<button class="delete" aria-label="delete"></button> <button class="delete" aria-label="delete"
data-action="click->notification#close"></button>
</div> </div>
<div class="message-body">{{ message }}</div> <div class="message-body">{{ message }}</div>
</article> </article>
@@ -40,13 +43,4 @@
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript" defer>
const warning = document.querySelector('.is-warning');
if (warning) {
warning.querySelector('.delete').addEventListener('click', () => {
warning.classList.add('is-hidden');
});
}
</script>
{% endblock %} {% endblock %}

View File

@@ -12,7 +12,8 @@
<div class="card" style="max-width: 40vw; margin: 0 auto;"> <div class="card" style="max-width: 40vw; margin: 0 auto;">
{% if error %} {% if error %}
<div class="notification is-danger is-light" data-controller="notification" data-notification-target="notif"> <div class="notification is-danger is-light" data-controller="notification"
data-notification-target="notif">
<button class="delete" data-action="click->notification#close"></button> <button class="delete" data-action="click->notification#close"></button>
Wrong user name and/or password. Please retry Wrong user name and/or password. Please retry
</div> </div>

View File

@@ -1,15 +1,17 @@
{% extends 'data_entry.html.twig' %} {% extends 'data_entry.html.twig' %}
{% block title %}Collector | ArCOA{% endblock %} {% block title %}Site | ArCOA{% endblock %}
{% block rightpanel %} {% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record"> <div class="container" style="max-width: 60vw" data-controller="delete-record">
<h1 class="is-size-1 mt-0 has-text-centered">Collector</h1> <h1 class="is-size-1 mt-0 has-text-centered">Site</h1>
<h2 class="is-size-3 mt-3 has-text-centered">Choose action</h2> <h2 class="is-size-3 mt-3 has-text-centered">Choose action</h2>
{% for message in app.flashes('notice') %} {% for message in app.flashes('notice') %}
<div class=" mt-4 notification is-success"> <div class=" mt-4 notification is-success"
<button class="delete"></button> data-controller="notification"
data-notification-target="notif">
<button class="delete" data-action="click->notification#close"></button>
{{ message }} {{ message }}
</div> </div>
{% endfor %} {% endfor %}
@@ -41,20 +43,24 @@
<table class="table is-hoverable is-fullwidth mt-5 has-text-centered results"> <table class="table is-hoverable is-fullwidth mt-5 has-text-centered results">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Name</th> <th>Modern name</th>
<th>Status</th> <th>Status</th>
<th>Editor</th> <th>Editor</th>
<th>Places / areas of activity</th> <th>Country</th>
<th>Last modified</th> <th>Last modified</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
{% for record in records %} {% for record in records %}
<tr> <tr>
<td><a href="{{ path('app_collector', {'id' : record.id}) }}">{{ record.id }}</a></td> <td><a href="{{ path('app_site_view', {'id' : record.id}) }}">{{ record.id }}</a></td>
<td><a href="{{ path('app_collector', {'id' : record.id}) }}">{{ record.name }}</a></td> <td>
<a data-delete-record-target="name" href="{{ path('app_site_view', {'id' : record.id}) }}">
{{ record.name }}
</a>
</td>
<td>{{ record.status }}</td> <td>{{ record.status }}</td>
<td>{{ record.owner }}</td> <td>{{ record.owner }}</td>
<td style="max-width: 350px;">{{ record.places }}</td> <td style="max-width: 350px;">{{ record.country }}</td>
<td> <td>
{{ record.modifiedAt.format('Y-m-d') }}<br> {{ record.modifiedAt.format('Y-m-d') }}<br>
{{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }} {{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }}
@@ -66,13 +72,13 @@
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</span> </span>
</button> </button>
<a href="{{ path('app_collector_del', {'id' : record.id}) }}" <button data-url="{{ path('app_site_del', {'id' : record.id}) }}"
class="button is-small is-danger" title="Delete record" class="button is-small is-danger" title="Delete record"
data-delete-record-target="path" data-action="click->delete-record#show"> data-delete-record-target="path" data-action="click->delete-record#warn">
<span class="icon"> <span class="icon">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</span> </span>
</a> </button>
</div> </div>
</td> </td>
</tr> </tr>
@@ -89,7 +95,7 @@
<button class="delete" aria-label="close"></button> <button class="delete" aria-label="close"></button>
</header> </header>
<section class="modal-card-body"> <section class="modal-card-body">
<p class="is-size-5">This record will be permanently deleted. Proceed?</p> <p class="is-size-5" data-delete-record-target="message"></p>
</section> </section>
<footer class="modal-card-foot"> <footer class="modal-card-foot">
<div class="buttons is-right"> <div class="buttons is-right">
@@ -100,12 +106,4 @@
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript" defer>
const delBtns = document.querySelectorAll('.delete');
for (let btn of delBtns) {
btn.addEventListener('click', function () {
this.parentElement.classList.add('is-hidden');
})
}
</script>
{% endblock %} {% endblock %}

View File

@@ -0,0 +1,168 @@
{% extends 'data_entry.html.twig' %}
{% block title %}Site - {{ record.name }} | ArCOA{% endblock %}
{% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record map">
<p class="pb-3">
<a class="button is-link is-outlined"
href="{{ path('app_site') }}">
Back to index
<span class="icon ml-2">
<i class="fa fa-arrow-left"></i>
</span>
</a>
</p>
<h1 class="is-size-1 mt-0 has-text-centered">Site</h1>
<h2 class="is-size-3 mt-3 has-text-centered">{{ record.name }}</h2>
{% for message in app.flashes('notice') %}
<div class=" mt-4 notification is-success"
data-controller="notification"
data-notification-target="notif">
<button class="delete" data-action="click->notification#close"></button>
{{ message }}
</div>
{% endfor %}
<article class="message is-info mt-3">
<div class="message-body">
<p>
<strong>Last modified:</strong> {{ record.modifiedAt.format('Y-m-d') }}
at {{ record.modifiedAt.format('H:i:s') }}
</p>
<p><strong>Editor:</strong> {{ record.editor }}</p>
</div>
</article>
<div class="card p-5">
{% if app.user and not is_granted('ROLE_READER') %}
<div class="columns">
<div class="column is-half"></div>
<div class="column has-text-right">
{% if is_granted('ROLE_REVISOR') or
is_granted('ROLE_ADMIN') or
record.editableStatus %}
<button class="button is-link">
Edit
<span class="icon ml-2">
<i class="fa fa-edit"></i>
</span>
</button>
{% endif %}
<a href="{{ path('app_site_copy', {'id' : record.id}) }}"
class="button is-link">
Copy
<span class="icon ml-2">
<i class="fa fa-copy"></i>
</span>
</a>
{% if is_granted('ROLE_REVISOR') or is_granted('ROLE_ADMIN') %}
<button data-url="{{ path('app_site_del', {'id' : record.id}) }}"
class="button is-danger"
data-delete-record-target="path" data-action="click->delete-record#warn">
Delete
<span class="icon ml-2">
<i class="fa fa-trash"></i>
</span>
</button>
{% endif %}
</div>
</div>
{% endif %}
<div class="tabs is-boxed is-fullwidth">
<ul>
<li class="is-active">Record</li>
<li>Relations</li>
</ul>
</div>
<div class="data-tabs" id="record">
<table class="table is-fullwidth pt-4 record">
<tr><th>Record ID</th><td>{{ record.id }}</td></tr>
<tr><th>Status</th><td>{{ record.getStatus() }}</td></tr>
<tr><th>Editor(s)</th><td>{{ record.editor }}</td></tr>
<tr><th>Modern name</th>
<td data-delete-record-target="name" data-map-target="name">
{{ record.name }}
</td>
</tr>
<tr><th>Ancient name</th><td>{{ record.ancientName }}</td></tr>
<tr><th>Coordinates</th>
<td>
<span data-map-target="coords">{{ record.lat }}, {{ record.lng }}</span>
<button class="button is-link is-small ml-3" data-action="click->map#open">
<span class="icon is-small p-2">
<i class="fa fa-map"></i>
</span>
</button>
</td>
</tr>
<tr><th>Country</th><td>{{ record.country }}</td></tr>
<tr><th>Description</th><td>{{ record.description }}</td></tr>
<tr><th>Short description</th><td>{{ record.shortDescription }}</td></tr>
<tr><th>External identifier(s)</th><td>{{ record.externalIdentifier }}</td></tr>
<tr><th>External link(s)</th><td>{{ record.link }}</td></tr>
<tr><th>Subject headings</th><td>{{ record.subjectHeadings }}</td></tr>
<tr><th>ArCOA URI</th><td>arcoa.cnr.it/site/{{ record.id }}</td></tr>
<tr><th>Editorial notes</th><td>{{ record.notes }}</td></tr>
</table>
</div>
<div class="data-tabs is-hidden" id="relations">
Some stuff...
</div>
</div>
<div class="modal" data-delete-record-target="modal">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<span class="icon is-large has-text-warning">
<i class="fa fa-warning fa-2x"></i>
</span>
<p class="modal-card-title has-text-danger pl-2"><strong>Delete record?</strong></p>
<button class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body">
<p class="is-size-5" data-delete-record-target="message"></p>
</section>
<footer class="modal-card-foot">
<div class="buttons is-right">
<button class="button is-link" data-action="click->delete-record#delete">Confirm</button>
<button class="button is-light" id="cancel">Cancel</button>
</div>
</footer>
</div>
</div>
<p class="pb-3 pt-3">
<a class="button is-link is-outlined"
href="{{ path('app_site') }}">
Back to index
<span class="icon ml-2">
<i class="fa fa-arrow-left"></i>
</span>
</a>
</p>
<div class="modal" data-map-target="modal">
<div class="modal-background" data-action="click->map#close"></div>
<div class="modal-card" style="min-width: 900px;">
<header class="modal-card-head">
<span class="icon is-large has-text-link">
<i class="fa fa-map fa-2x"></i>
</span>
<p class="modal-card-title pl-2 pt-1 pb-1"><strong>Interactive map</strong></p>
<button class="delete" aria-label="close" data-action="click->map#close"></button>
</header>
<section class="modal-card-body p-0">
<div data-map-target="map" id="map" style="min-height: 400px; max-width: 900px"></div>
</section>
<footer class="modal-card-foot">
<div class="buttons is-right">
<button class="button is-light" data-action="click->map#close">Close</button>
</div>
</footer>
</div>
</div>
</div>
{% endblock %}

View File

@@ -3,7 +3,7 @@
{% block title %}Vocab - Functional context | ArCOA{% endblock %} {% block title %}Vocab - Functional context | ArCOA{% endblock %}
{% block rightpanel %} {% block rightpanel %}
<div class="container" style="max-width: 50vw"> <div class="container" style="max-width: 50vw" data-controller="vocabs">
<h1 class="is-size-1 mt-0 has-text-centered">Vocabulary</h1> <h1 class="is-size-1 mt-0 has-text-centered">Vocabulary</h1>
<h2 class="is-size-3 mt-4 has-text-centered">Functional context</h2> <h2 class="is-size-3 mt-4 has-text-centered">Functional context</h2>
@@ -28,11 +28,31 @@
</form> </form>
{% endif %} {% endif %}
<div class="notification is-success is-hidden mt-5" id="ajax-success"> <div class="notification is-success is-hidden mt-5"
data-controller="notification"
data-notification-target="notif"
id="ajax-saved">
<button class="delete" data-action="click->notification#close"></button>
Term saved successfully
</div>
<div class="notification is-success is-hidden mt-5"
data-controller="notification"
data-notification-target="notif"
id="ajax-deleted">
<button class="delete" data-action="click->notification#close"></button>
Term deleted successfully
</div>
<div class="notification is-danger is-light is-hidden mt-5"
data-controller="notification"
data-notification-target="notif"
id="ajax-error">
<button class="delete" data-action="click->notification#close"></button>
The term could not be deleted because it's related to existing records
</div> </div>
{% for message in app.flashes('notice') %} {% for message in app.flashes('notice') %}
<div class="notification is-success mt-5" id="server-success"> <div class="notification is-success mt-5" data-controller="notification"
<button class="delete"></button> data-notification-target="notif">
<button class="delete" data-action="click->notification#close"></button>
{{ message }} {{ message }}
</div> </div>
{% endfor %} {% endfor %}
@@ -40,26 +60,47 @@
<table class="table is-fullwidth" id="terms"> <table class="table is-fullwidth" id="terms">
<tr><th>Term</th>{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %}<th>Actions</th>{% endif %}</tr> <tr><th>Term</th>{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %}<th>Actions</th>{% endif %}</tr>
{% for term in terms %} {% for term in terms %}
<tr data-row-id="{{ term.id }}"> <tr data-vocabs-target="row"
data-id="{{ term.id }}">
<td> <td>
<input class="input" type="text" value="{{ term.term }}" disabled data-term-id="{{ term.id }}" /> <input class="input" type="text" value="{{ term.term }}" disabled
data-id="{{ term.id }}" data-vocabs-target="input" />
</td> </td>
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %} {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %}
<td> <td>
<div class="buttons"> <div class="buttons">
<button class="button is-primary is-hidden" data-id-save="{{ term.id }}"> <button class="button is-primary is-hidden"
data-vocabs-target="save"
data-action="click->vocabs#save"
data-url="{{ path('app_vocab_func_context_upd') }}"
data-id="{{ term.id }}">
Save Save
<span class="icon ml-2"> <span class="icon ml-2">
<i class="fa fa-save"></i> <i class="fa fa-save"></i>
</span> </span>
</button> </button>
<button class="button is-link" data-id-edit="{{ term.id }}"> <button class="button is-hidden"
data-id="{{ term.id }}"
data-vocabs-target="cancel"
data-action="click->vocabs#cancel">
Cancel
<span class="icon ml-2">
<i class="fa fa-times"></i>
</span>
</button>
<button class="button is-link"
data-vocabs-target="edit"
data-id="{{ term.id }}"
data-action="click->vocabs#edit">
Edit Edit
<span class="icon ml-2"> <span class="icon ml-2">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</span> </span>
</button> </button>
<button class="button is-danger" data-id-delete="{{ term.id }}"> <button class="button is-danger"
data-id="{{ term.id }}"
data-action="click->vocabs#delete"
data-url="{{ path('app_vocab_func_context_del') }}">
Delete Delete
<span class="icon ml-2"> <span class="icon ml-2">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
@@ -71,97 +112,27 @@
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div>
<div class="modal" data-vocabs-target="modal">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<span class="icon is-large has-text-warning">
<i class="fa fa-warning fa-2x"></i>
</span>
<p class="modal-card-title has-text-danger pl-2"><strong>Delete term?</strong></p>
<button class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body">
<p class="is-size-5">This term will be permanently deleted. Proceed?</p>
</section>
<footer class="modal-card-foot">
<div class="buttons is-right">
<button class="button is-link" data-action="click->vocabs#delete">Confirm</button>
<button class="button is-light" id="cancel">Cancel</button>
</div>
</footer>
</div>
</div> </div>
</div> </div>
<script type="text/javascript" defer>
const terms = document.querySelector('#terms');
const serverNotice = document.querySelector('#server-success');
if (serverNotice) {
serverNotice.querySelector('.delete').addEventListener('click', () => {
serverNotice.remove();
});
}
terms.addEventListener('click', async (event) => {
const clicked = event.target;
if (clicked.getAttribute('data-id-delete')) {
const termId = clicked.getAttribute('data-id-delete');
const data = new FormData;
data.append("_id", termId);
const res = await fetch("{{ path('app_vocab_func_context_del') }}", {
method: "POST",
body: data,
});
const notice = document.querySelector('#ajax-success');
if (res.status === 200) {
notice.innerHTML = `
<button class="delete"></button>
Term deleted successfully
`;
notice.classList.remove('is-hidden');
notice.querySelector('.delete').addEventListener('click', () => {
notice.classList.add('is-hidden');
});
const row = document.querySelector(`tr[data-row-id="${termId}"]`);
row.remove();
}
}
if (clicked.getAttribute('data-id-edit')) {
const termId = clicked.getAttribute('data-id-edit');
const saveBtn = document.querySelector(`button[data-id-save="${termId}"]`);
const input = document.querySelector(`input[data-term-id="${termId}"]`);
input.disabled = input.disabled ? false : true;
saveBtn.classList.toggle('is-hidden');
clicked.classList.toggle('is-link');
if (!clicked.classList.contains('is-link')) {
clicked.innerHTML = `
Cancel
<span class="icon ml-2">
<i class="fa fa-times"></i>
</span>
`;
} else {
clicked.innerHTML = `
Edit
<span class="icon ml-2">
<i class="fa fa-edit"></i>
</span>
`;
}
const data = new FormData;
data.append("_id", termId);
saveBtn.addEventListener('click', async () => {
data.append("_new_term", input.value);
const res = await fetch("{{ path('app_vocab_func_context_upd') }}", {
method: "POST",
body: data,
});
const notice = document.querySelector('#ajax-success');
if (res.status === 200) {
notice.innerHTML = `
<button class="delete"></button>
Term updated successfully
`;
notice.classList.remove('is-hidden');
notice.querySelector('.delete').addEventListener('click', () => {
notice.classList.add('is-hidden');
});
}
});
}
});
</script>
{% endblock %} {% endblock %}