Compare commits

..

13 Commits

39 changed files with 3149 additions and 356 deletions

View File

@@ -5,17 +5,28 @@ import { Controller } from '@hotwired/stimulus';
* [template: {entity}/index.html.twig]
*/
export default class extends Controller {
static targets = ['modal', 'path'];
static targets = ['modal', 'path', 'name', 'message'];
/**
* @todo Refactor with actions for modal
* @param {object} event
*/
show(event) {
warn(event) {
event.preventDefault();
const id = event.currentTarget.getAttribute('data-url').match(/\d+$/)[0];
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');
this.messageTarget.innerHTML = message;
modal.querySelector('.delete').addEventListener('click', () => {
modal.classList.remove('is-active');
});
@@ -28,8 +39,8 @@ export default class extends Controller {
}
// Proceed with deletion...
delete(event) {
const delPath = this.pathTarget.href;
delete() {
const delPath = this.pathTarget.getAttribute('data-url');
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
* [template: data_entry.html.twig]
* @todo Handle open / closed state
*/
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) {
if (event.currentTarget.id === 'for-vocabs') {
this.vocabsTarget.classList.toggle('is-hidden');
localStorage.setItem('vocabsClass', this.vocabsTarget.className);
}
if (event.currentTarget.id === 'for-records') {
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 iconAction = {
@@ -29,6 +60,15 @@ export default class extends Controller {
};
iconAction[iconState]();
}
this.iconClass = icon.className;
}
openIcon(icon) {
return icon.className.replace('right', 'down');
}
closeIcon(icon) {
return icon.className.replace('down', 'right');
}
}

View File

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

View File

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

View File

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

View File

@@ -7,6 +7,7 @@ use App\Entity\Collection;
use App\Entity\Collector;
use App\Form\BibliographyType;
use App\Security\Voter\RecordVoter;
use App\RecordStatus;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
@@ -16,8 +17,24 @@ use DateTimeImmutable;
class BibliographyController extends AbstractController
{
#[Route('/bibliography/{id<\d+>}', name: 'app_bibliography')]
public function index(Bibliography $bibliography, EntityManagerInterface $em): Response
#[Route('/bibliography', name: 'app_bibliography')]
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);
$collections = $repo->findAllByBibliography($bibliography->getId());
@@ -27,28 +44,17 @@ class BibliographyController extends AbstractController
$bibliography->setCollections($collections);
$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',
'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')]
public function search(): Response
{
@@ -84,12 +90,13 @@ class BibliographyController extends AbstractController
return $this->redirectToRoute('app_home');
}
if ($bibliography) {
$em->remove($bibliography);
$em->flush();
$this->addFlash('notice', 'Record deleted successfully');
}
return $this->redirectToRoute('app_bibliography_landing');
return $this->redirectToRoute('app_bibliography');
}
/**
@@ -99,7 +106,7 @@ class BibliographyController extends AbstractController
public function copy(Bibliography $bibliography, EntityManagerInterface $em): Response
{
try {
$this->denyAccessUnlessGranted(RecordVoter::EDIT, $bibliography);
$this->denyAccessUnlessGranted(RecordVoter::COPY, $bibliography);
}
catch (AccessDeniedException) {
$this->addFlash('warning', 'You are not authorized to copy this record');
@@ -123,12 +130,13 @@ class BibliographyController extends AbstractController
);
$copy->setCitation("{$bibliography->getCitation()} - 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_bibliography', ['id' => $copy->getId()]);
return $this->redirectToRoute('app_bibliography_view', ['id' => $copy->getId()]);
}
}

View File

@@ -5,6 +5,7 @@ namespace App\Controller;
use App\Entity\Collection;
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;
@@ -14,22 +15,8 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException;
class CollectionController extends AbstractController
{
#[Route('/collection/{id<\d+>}', name: 'app_collection')]
public function index(Collection $collection, 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
#[Route('/collection', name: 'app_collection')]
public function index(EntityManagerInterface $em): Response
{
$repo = $em->getRepository(Collection::class);
$records = $repo->findBy([], ['modifiedAt' => 'DESC']);
@@ -37,13 +24,30 @@ class CollectionController extends AbstractController
$records = array_slice($records, 0, 15);
return $this->render('collection/landing.html.twig', [
return $this->render('collection/index.html.twig', [
'controller_name' => 'CollectionController',
'records' => $records,
'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')]
public function delete(Collection $collection, EntityManagerInterface $em): Response
{
@@ -55,12 +59,14 @@ class CollectionController extends AbstractController
return $this->redirectToRoute('app_home');
}
if ($collection) {
$em->remove($collection);
$em->flush();
}
$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
@@ -95,12 +101,13 @@ class CollectionController extends AbstractController
*/
$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', ['id' => $copy->getId()]);
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\Collection;
use App\Entity\Bibliography;
use App\RecordStatus;
use App\Security\Voter\RecordVoter;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -14,21 +15,25 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException;
class CollectorController extends AbstractController
{
#[Route('/collector/{id<\d+>}', name: 'app_collector')]
public function index(Collector $collector, EntityManagerInterface $em): Response
#[Route('/collector/{id<\d+>}', name: 'app_collector_view')]
public function view(Collector $collector, EntityManagerInterface $em): Response
{
$repo = $em->getRepository(Bibliography::class);
$bibliographies = $repo->findAllByCollector($collector->getId());
$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',
'record' => $collector,
]);
}
#[Route('/collector', name: 'app_collector_landing')]
public function landing(EntityManagerInterface $em): Response
#[Route('/collector', name: 'app_collector')]
public function index(EntityManagerInterface $em): Response
{
$repo = $em->getRepository(Collector::class);
$records = $repo->findBy([], ['modifiedAt' => 'DESC']);
@@ -36,7 +41,7 @@ class CollectorController extends AbstractController
$records = array_slice($records, 0, 15);
return $this->render('collector/landing.html.twig', [
return $this->render('collector/index.html.twig', [
'controller_name' => 'CollectorController',
'records' => $records,
'count' => $count,
@@ -59,6 +64,42 @@ class CollectorController extends AbstractController
$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\Repository\BibliographyRepository;
use App\Repository\CollectionRepository;
use App\Repository\CollectorRepository;
use DateTimeImmutable;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\DBAL\Types\Types;
use App\RecordStatus;
use ContainerBNNizmi\getBibliographyRepositoryService;
use Doctrine\Common\Collections\Collection as DoctrineCollection;
use Doctrine\DBAL\Query\QueryBuilder as QueryQueryBuilder;
use Doctrine\ORM\QueryBuilder;
#[ORM\Entity(repositoryClass: BibliographyRepository::class)]
#[ORM\Table(name: 'bibliography')]
@@ -64,6 +64,9 @@ class Bibliography implements RecordInterface
private DoctrineCollection $sites;
// Checks if the record can be edited by an 'editor' user
private bool $isEditable = false;
public function getId(): ?int
{
return $this->id;
@@ -189,4 +192,16 @@ class Bibliography implements RecordInterface
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')]
private DoctrineCollection $bibliographies;
private bool $isEditable = false;
public function getId(): ?int
{
return $this->id;
@@ -292,4 +294,16 @@ class Collection implements RecordInterface
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')]
private DoctrineCollection $bibliographies;
private bool $isEditable = false;
public function getId(): ?int
{
return $this->id;
@@ -292,4 +294,16 @@ class Collector implements RecordInterface
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;
use App\Entity\Bibliography;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Common\Collections\ArrayCollection;
@@ -18,6 +19,16 @@ class BibliographyRepository extends ServiceEntityRepository
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
{
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
@@ -61,4 +72,29 @@ class BibliographyRepository extends ServiceEntityRepository
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;
use App\Entity\Collection;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Common\Collections\ArrayCollection;
@@ -18,6 +19,16 @@ class CollectionRepository extends ServiceEntityRepository
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
{
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
@@ -37,4 +48,29 @@ class CollectionRepository extends ServiceEntityRepository
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;
use App\Entity\Collector;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Common\Collections\ArrayCollection;
@@ -18,6 +19,16 @@ class CollectorRepository extends ServiceEntityRepository
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
{
$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\Authorization\Voter\Voter;
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
{
public const EDIT = 'RECORD_EDIT';
public const DELETE = 'RECORD_DELETE';
public const COPY = 'RECORD_COPY';
public const VIEW = 'RECORD_VIEW';
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;
}
@@ -32,11 +37,37 @@ final class RecordVoter extends Voter
// TODO: Better way to check roles?
switch ($attribute) {
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)
|| 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;
case self::COPY:
case self::VIEW:
return ! in_array('ROLE_READER', $roles);
break;

View File

@@ -1,11 +1,11 @@
{% extends 'data_entry.html.twig' %}
{% block title %}Bibliography - {{ record.citation }} | ArCOA{% endblock %}
{% block title %}Bibliography | ArCOA{% endblock %}
{% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record">
<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>
{% for message in app.flashes('notice') %}
<div class=" mt-4 notification is-success"
@@ -16,65 +16,75 @@
</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="card p-5 mt-6 pt-6 pb-6">
<div class="columns">
<div class="column is-half"></div>
<div class="column has-text-right">
<button class="button is-link">
Edit
<div class="column is-half has-text-centered">
<button class="button is-medium">
Search
<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>
</span>
</button>
<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>
<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">
<button data-url="{{ path('app_bibliography_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>
</a>
</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>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>
</td>
</tr>
{% endfor %}
</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">
@@ -86,7 +96,7 @@
<button class="delete" aria-label="close"></button>
</header>
<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>
<footer class="modal-card-foot">
<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,11 +1,11 @@
{% extends 'data_entry.html.twig' %}
{% block title %}Collection - {{ record.title }} | ArCOA{% endblock %}
{% block title %}Collection | ArCOA{% endblock %}
{% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record">
<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>
{% for message in app.flashes('notice') %}
<div class=" mt-4 notification is-success"
@@ -15,87 +15,75 @@
{{ 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="card p-5 mt-6 pt-6 pb-6">
<div class="columns">
<div class="column is-half"></div>
<div class="column has-text-right">
<button class="button is-link">
Edit
<div class="column is-half has-text-centered">
<button class="button is-medium">
Search
<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="" 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>Title</th>
<th>Status</th>
<th>Editor</th>
<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>
<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>
<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">
<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>
</a>
</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>{{ 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 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>
</td>
</tr>
{% endfor %}
</table>
{% endif %}
</div>
</div>
<div class="modal" data-delete-record-target="modal">
<div class="modal-background"></div>
<div class="modal-card">
@@ -107,7 +95,7 @@
<button class="delete" aria-label="close"></button>
</header>
<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>
<footer class="modal-card-foot">
<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' %}
{% block title %}Collector - {{ record.name }} | ArCOA{% endblock %}
{% block title %}Collector | ArCOA{% endblock %}
{% block rightpanel %}
<div class="container" style="max-width: 60vw" data-controller="delete-record">
<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">
<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>
{% 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>
</article>
<div class="card p-5">
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %}
{% endfor %}
<div class="card p-5 mt-6 pt-6 pb-6">
<div class="columns">
<div class="column is-half"></div>
<div class="column has-text-right">
<button class="button is-link">
Edit
<div class="column is-half has-text-centered">
<button class="button is-medium">
Search
<span class="icon ml-2">
<i class="fa fa-edit"></i>
<i class="fa fa-search"></i>
</span>
</button>
<button class="button is-link">
Copy
</div>
{% 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">
<i class="fa fa-copy"></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>
<i class="fa fa-plus"></i>
</span>
</a>
</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>{{ 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 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 %}
<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>
<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>
<th>ID</th>
<th>Name</th>
<th>Status</th>
<th>Editor</th>
<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>
{% endfor %}
</table>
{% endif %}
</div>
</div>
<div class="modal" data-delete-record-target="modal">
<div class="modal-background"></div>
<div class="modal-card">
@@ -97,7 +95,7 @@
<button class="delete" aria-label="close"></button>
</header>
<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>
<footer class="modal-card-foot">
<div class="buttons is-right">
@@ -108,5 +106,4 @@
</div>
</div>
</div>
<script type="text/javascript" defer></script>
{% 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,10 +1,10 @@
{% extends 'data_entry.html.twig' %}
{% block title %}Bibliography | ArCOA{% endblock %}
{% block title %}Conservation place | ArCOA{% endblock %}
{% block rightpanel %}
<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>
{% for message in app.flashes('notice') %}
@@ -15,7 +15,6 @@
{{ message }}
</div>
{% endfor %}
<div class="card p-5 mt-6 pt-6 pb-6">
<div class="columns">
<div class="column is-half has-text-centered">
@@ -28,7 +27,7 @@
</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">
<a href="" class="button is-link is-medium">
Add new
<span class="icon ml-2">
<i class="fa fa-plus"></i>
@@ -44,20 +43,24 @@
<table class="table is-hoverable is-fullwidth mt-5 has-text-centered results">
<tr>
<th>ID</th>
<th>Citation</th>
<th>Place</th>
<th>Status</th>
<th>Editor</th>
<th>Reference</th>
<th>Municipality</th>
<th>Last modified</th>
<th>Actions</th>
</tr>
{% for record in records %}
<tr>
<td><a href="{{ path('app_bibliography', {'id' : record.id}) }}">{{ record.id }}</a></td>
<td><a href="{{ path('app_bibliography', {'id' : record.id}) }}">{{ record.citation }}</a></td>
<td><a href="{{ path('app_conservation_place_view', {'id' : record.id}) }}">{{ record.id }}</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.owner }}</td>
<td style="max-width: 350px;">{{ record.reference }}</td>
<td style="max-width: 350px;">{{ record.municipality }}</td>
<td>
{{ record.modifiedAt.format('Y-m-d') }}<br>
{{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }}
@@ -69,13 +72,13 @@
<i class="fa fa-edit"></i>
</span>
</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"
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">
<i class="fa fa-trash"></i>
</span>
</a>
</button>
</div>
</td>
</tr>
@@ -92,7 +95,7 @@
<button class="delete" aria-label="close"></button>
</header>
<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>
<footer class="modal-card-foot">
<div class="buttons is-right">

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>
<div class="columns mb-0">
<div class="column is-one-fifth arcoa-menu mb-0">
<aside class="menu" data-controller="menu">
{% if 'ROLE_READER' not in app.user.roles %}
<aside class="menu" data-controller="menu"
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">
Vocabularies
<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>
</p>
<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">
Records
<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>
</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">
<a href="{{ path('app_bibliography_landing') }}">
<a href="{{ path('app_bibliography') }}">
Bibliography
</a>
</li>
<li class="pt-1 pb-1">
<a href="{{ path('app_collection_landing') }}">
<a href="{{ path('app_collection') }}">
Collection
</a>
</li>
<li class="pt-1 pb-1">
<a href="{{ path('app_collector_landing') }}">
<a href="{{ path('app_collector') }}">
Collector
</a>
</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>
</aside>
</div>

View File

@@ -1,10 +1,10 @@
{% extends 'data_entry.html.twig' %}
{% block title %}Collection | ArCOA{% endblock %}
{% block title %}Document | ArCOA{% endblock %}
{% block rightpanel %}
<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>
{% for message in app.flashes('notice') %}
@@ -46,17 +46,21 @@
<th>Title</th>
<th>Status</th>
<th>Editor</th>
<th>Chronology</th>
<th>Author(s)</th>
<th>Last modified</th>
<th>Actions</th>
</tr>
{% for record in records %}
<tr>
<td><a href="{{ path('app_collection', {'id' : record.id}) }}">{{ record.id }}</a></td>
<td><a href="{{ path('app_collection', {'id' : record.id}) }}">{{ record.title }}</a></td>
<td><a href="{{ path('app_document_view', {'id' : record.id}) }}">{{ record.id }}</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.owner }}</td>
<td style="max-width: 350px;">{{ record.chronology }}</td>
<td style="max-width: 350px;">{{ record.author }}</td>
<td>
{{ record.modifiedAt.format('Y-m-d') }}<br>
{{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }}
@@ -68,13 +72,13 @@
<i class="fa fa-edit"></i>
</span>
</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"
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">
<i class="fa fa-trash"></i>
</span>
</a>
</button>
</div>
</td>
</tr>
@@ -91,7 +95,7 @@
<button class="delete" aria-label="close"></button>
</header>
<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>
<footer class="modal-card-foot">
<div class="buttons is-right">

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 %}
{% 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">
<p>Warning</p>
<button class="delete" aria-label="delete"></button>
<button class="delete" aria-label="delete"
data-action="click->notification#close"></button>
</div>
<div class="message-body">{{ message }}</div>
</article>
@@ -40,13 +43,4 @@
</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 %}

View File

@@ -1,10 +1,10 @@
{% extends 'data_entry.html.twig' %}
{% block title %}Collector | ArCOA{% endblock %}
{% block title %}Site | ArCOA{% endblock %}
{% block rightpanel %}
<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>
{% for message in app.flashes('notice') %}
@@ -43,20 +43,24 @@
<table class="table is-hoverable is-fullwidth mt-5 has-text-centered results">
<tr>
<th>ID</th>
<th>Name</th>
<th>Modern name</th>
<th>Status</th>
<th>Editor</th>
<th>Places / areas of activity</th>
<th>Country</th>
<th>Last modified</th>
<th>Actions</th>
</tr>
{% for record in records %}
<tr>
<td><a href="{{ path('app_collector', {'id' : record.id}) }}">{{ record.id }}</a></td>
<td><a href="{{ path('app_collector', {'id' : record.id}) }}">{{ record.name }}</a></td>
<td><a href="{{ path('app_site_view', {'id' : record.id}) }}">{{ record.id }}</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.owner }}</td>
<td style="max-width: 350px;">{{ record.places }}</td>
<td style="max-width: 350px;">{{ record.country }}</td>
<td>
{{ record.modifiedAt.format('Y-m-d') }}<br>
{{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }}
@@ -68,13 +72,13 @@
<i class="fa fa-edit"></i>
</span>
</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"
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">
<i class="fa fa-trash"></i>
</span>
</a>
</button>
</div>
</td>
</tr>
@@ -91,7 +95,7 @@
<button class="delete" aria-label="close"></button>
</header>
<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>
<footer class="modal-card-foot">
<div class="buttons is-right">

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 %}