Skip to content

Commit

Permalink
chore: correct event templates, and support linking object to 4ALLPORTAL
Browse files Browse the repository at this point in the history
  • Loading branch information
4allportaleabdullah committed Sep 20, 2024
1 parent 6fcbce9 commit c197941
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 39 deletions.
5 changes: 2 additions & 3 deletions Classes/Controller/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions Classes/Mapping/AbstractMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
Expand Down
81 changes: 55 additions & 26 deletions Resources/Private/Partials/Events.html
Original file line number Diff line number Diff line change
@@ -1,41 +1,70 @@
{paginate -> f:or(alternative: 1) -> f:variable(name: 'paginate')}

<table class="table table-striped table-hover">
<f:asset.css identifier="table-4ap">
.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;
}
</f:asset.css>

<table class="table table-bordered table-striped table-4ap" style="margin-top: 12px;">
<f:if condition="{pagination} && {paginator} && {events -> f:count()} > 1 }">
<f:then>
<f:render section="TableHeader"/>
<tbody>
<!-- Render your items listing -->
<f:for each="{paginator.paginatedItems}" as="event" iteration="iterator">
<f:render section="EventRow" arguments="{_all}"/>
</f:for>
<!-- Render your paging -->
<f:render partial="Pagination" arguments="{pagination: pagination, paginator: paginator, actionName: 'index'}"/>
</tbody>
</f:then>
<f:else>
<f:render section="TableHeader"/>
<tbody>
<f:for each="{events}" as="event">
<f:render section="EventRow" arguments="{_all}"/>
</f:for>
</tbody>
</f:else>
</f:if>
</table>

<f:section name="TableHeader">
<thead>
<tr>
<th>ID</th>
<th>Created</th>
<th>Updated</th>
<th>Module</th>
<th>Connector</th>
<th>Status</th>
<th>Event Type</th>
<th>Object ID</th>
<th>Object ID (link to 4ALLPORTAL)</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>

<f:if condition="{pagination && paginator}">
<f:then>
<!-- Render your items listing -->
<f:for each="{paginator.paginatedItems}" as="event" iteration="iterator">
<f:render section="EventRow" arguments="{_all}"/>
</f:for>
<!-- Render your paging -->
<f:render partial="Pagination" arguments="{pagination: pagination, paginator: paginator, actionName: 'index'}"/>
</f:then>
<f:else>
<f:for each="{events}" as="event">
<f:render section="EventRow" arguments="{_all}"/>
</f:for>
</f:else>
</f:if>
</tbody>
</table>
</f:section>

<f:section name="EventRow">
<tr class="{f:if(condition: '{highlightEvent.uid} == {event.uid}', then: 'text-primary')}">
<td>{event.eventId}</td>
<td class="col-xs-2">{event.eventId}</td>
<td>
<f:format.date format="H:i:s d.m.Y">{event.crdate}</f:format.date>
</td>
Expand All @@ -45,8 +74,8 @@
<td>{event.module.connectorName}</td>
<td>{event.status}</td>
<td>{event.eventType}</td>
<td>{event.objectId}</td>
<td nowrap="nowrap" class="col-control">
<td><a target="_blank" href="{event.module.server.domain}?module={event.module.moduleName}&view=detail&record={event.objectId}"/>{event.objectId}</a></td>
<td nowrap="nowrap" class="col-control" style="padding: 4px 6px;">

<div class="btn-group" role="group">
<f:if condition="!{deleted}">
Expand All @@ -68,7 +97,7 @@
controller="Event"
class="btn btn-danger" title="Execute event">
<span>
<core:icon identifier="extensions-scheduler-run-task"
<core:icon identifier="actions-play"
alternativeMarkupIdentifier="inline"/>
</span>
</f:link.action>
Expand Down
26 changes: 25 additions & 1 deletion Resources/Private/Partials/Log.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@

<f:asset.css identifier="4aplogstyle">
.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;
}
</f:asset.css>

<f:if condition="{log}">
<f:else>
<p>No entries logged</p>
</f:else>
<f:then>
<table class="table table-bordered table-striped table-vertical-top">
<table class="table table-bordered table-striped table-vertical-top table-log-4ap">
<thead>
<tr>
<td class="col-xs-2"><strong>Date</strong></td>
Expand Down
14 changes: 7 additions & 7 deletions Resources/Private/Templates/Event/Check.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
data-namespace-typo3-fluid="true" lang="en">

<f:layout name="Module"/>

<f:section name="Content">
<f:section name="module-headline">
<h3>Event history, object
<f:link.action action="index" arguments="{search: event.objectId, status: 'all'}">
{event.objectId}
</f:link.action>
</h3>
</f:section>

<f:flashMessages/>
<h3>Event history, object
<f:link.action action="index" arguments="{search: event.objectId, status: 'all'}">
{event.objectId}
</f:link.action>
</h3>

<f:if condition="{deletedScheduled}">
<f:then>
Expand Down
3 changes: 3 additions & 0 deletions Resources/Private/Templates/Event/Index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
data-namespace-typo3-fluid="true" lang="en">

<f:layout name="Module"/>

<f:section name="module-headline"></f:section>

<f:section name="Content">

<f:flashMessages/>
Expand Down

0 comments on commit c197941

Please sign in to comment.