From c197941c0fd7bf3a970032957081a6a4651ae18f Mon Sep 17 00:00:00 2001 From: Eyad Abdullah Date: Fri, 20 Sep 2024 13:46:42 +0200 Subject: [PATCH] chore: correct event templates, and support linking object to 4ALLPORTAL --- Classes/Controller/EventController.php | 5 +- Classes/Mapping/AbstractMapping.php | 4 +- Resources/Private/Partials/Events.html | 81 +++++++++++++------- Resources/Private/Partials/Log.html | 26 ++++++- Resources/Private/Templates/Event/Check.html | 14 ++-- Resources/Private/Templates/Event/Index.html | 3 + 6 files changed, 94 insertions(+), 39 deletions(-) diff --git a/Classes/Controller/EventController.php b/Classes/Controller/EventController.php index 8d650bf..efdbb30 100644 --- a/Classes/Controller/EventController.php +++ b/Classes/Controller/EventController.php @@ -131,10 +131,9 @@ public function checkAction(Event $event): ResponseInterface // create header menu ControllerUtility::addMainMenu($this->request, $this->uriBuilder, $view, 'Event'); $events = $this->eventRepository->findByObjectId($event->getObjectId()); - - $view->assign('event', $event); + $view->assign('event', $events->getFirst()); $view->assign('event_json', 'event json value equals, traa: ' . json_encode($event)); - $view->assign('events', $events); + $view->assign('events', $events->toArray()); $view->assign('eventLog', $this->loggingService->getEventActivity($event, 20)); $view->assign('objectLog', $this->loggingService->getObjectActivity($event->getObjectId(), 100)); foreach ($events as $historicalEvent) { diff --git a/Classes/Mapping/AbstractMapping.php b/Classes/Mapping/AbstractMapping.php index b3ed8d9..f2f556c 100644 --- a/Classes/Mapping/AbstractMapping.php +++ b/Classes/Mapping/AbstractMapping.php @@ -509,10 +509,10 @@ protected function mapPropertyValueToObject(string $propertyName, mixed $propert protected function determineDataTypeForProperty($propertyName, $object): bool|string { if (property_exists(get_class($object), $propertyName)) { - $property = new ReflectionService($object, $propertyName); + $property = GeneralUtility::makeInstance(ReflectionService::class); $classSchema = $property->getClassSchema($object); $varTags = $classSchema->getProperty('var'); - if (!empty($varTags)) { + if ($property->getPrimaryType()->isCollection()) { return strpos($varTags[0], ' ') !== false ? substr($varTags[0], 0, strpos($varTags[0], ' ')) : $varTags[0]; } } diff --git a/Resources/Private/Partials/Events.html b/Resources/Private/Partials/Events.html index 9421ae2..f008086 100644 --- a/Resources/Private/Partials/Events.html +++ b/Resources/Private/Partials/Events.html @@ -1,41 +1,70 @@ {paginate -> f:or(alternative: 1) -> f:variable(name: 'paginate')} - + + .table-4ap>tbody>tr>td, + .table-4ap>tbody>tr>th, + .table-4ap>tfoot>tr>td, + .table-4ap>tfoot>tr>th, + .table-4ap>thead>tr>td, + .table-4ap>thead>tr>th { + padding: 6px; + line-height: 1.5; + border-top: 1px solid #ccc; + } + .table-4ap>thead>tr>th{ + background-color: #EDEDED; + } + .table-4ap { + border-collapse: collapse; + border-spacing: 0px; + background: 0 0; + font-size: inherit; + line-height: inherit; + } + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + ID Created Updated - Module + Connector Status Event Type - Object ID + Object ID (link to 4ALLPORTAL)   - - - - - - - - - - - - - - - - - - - + - {event.eventId} + {event.eventId} {event.crdate} @@ -45,8 +74,8 @@ {event.module.connectorName} {event.status} {event.eventType} - {event.objectId} - + {event.objectId} +
@@ -68,7 +97,7 @@ controller="Event" class="btn btn-danger" title="Execute event"> - diff --git a/Resources/Private/Partials/Log.html b/Resources/Private/Partials/Log.html index 4a7a032..ae3c885 100644 --- a/Resources/Private/Partials/Log.html +++ b/Resources/Private/Partials/Log.html @@ -1,9 +1,33 @@ + + + .table-log-4ap>tbody>tr>td, + .table-log-4ap>tbody>tr>th, + .table-log-4ap>tfoot>tr>td, + .table-log-4ap>tfoot>tr>th, + .table-log-4ap>thead>tr>td, + .table-log-4ap>thead>tr>th { + padding: 6px; + line-height: 1.5; + border-top: 1px solid #ccc; + } + .table-log-4ap>thead>tr>th{ + background-color: #EDEDED; + } + .table-log-4ap { + border-collapse: collapse; + border-spacing: 0px; + background: 0 0; + font-size: inherit; + line-height: inherit; + } + +

No entries logged

- +
diff --git a/Resources/Private/Templates/Event/Check.html b/Resources/Private/Templates/Event/Check.html index 3302299..7aaa1b2 100644 --- a/Resources/Private/Templates/Event/Check.html +++ b/Resources/Private/Templates/Event/Check.html @@ -4,15 +4,15 @@ data-namespace-typo3-fluid="true" lang="en"> + - -

Event history, object - - {event.objectId} - -

-
+ +

Event history, object + + {event.objectId} + +

diff --git a/Resources/Private/Templates/Event/Index.html b/Resources/Private/Templates/Event/Index.html index 49ba0e2..27cdb78 100644 --- a/Resources/Private/Templates/Event/Index.html +++ b/Resources/Private/Templates/Event/Index.html @@ -3,6 +3,9 @@ data-namespace-typo3-fluid="true" lang="en"> + + +
Date