feat: manually maintained webcams are shown regardless of availability

The feed's "verfügbar" flag only applies to imported webcams. Editors who
tick "Manuell gepflegt" expect the webcam to appear, so the website, the
API and the content feed now show a webcam if it is available or manual;
manual ones are hidden via "Verbergen" instead. The availability checkbox
is hidden on manual webcams, which reloads the form when toggled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
frommeandClaude Opus 5.5 committed 2026-11-03 15:29:21 +01:00
1 parent 4598fb8aa5
commit a7b7b7a476
6 files changed
+33 -5

No files matched your search

@@ -388,7 +388,10 @@ class RecordSerializer
->select('url') ->select('url')
->from('tx_epproducts_domain_model_webcam')->where( ->from('tx_epproducts_domain_model_webcam')->where(
$queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($webcamUid, Connection::PARAM_INT)), $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($webcamUid, Connection::PARAM_INT)),
$queryBuilder->expr()->or(
$queryBuilder->expr()->eq('available', $queryBuilder->createNamedParameter(1, Connection::PARAM_INT)), $queryBuilder->expr()->eq('available', $queryBuilder->createNamedParameter(1, Connection::PARAM_INT)),
$queryBuilder->expr()->eq('manual', $queryBuilder->createNamedParameter(1, Connection::PARAM_INT)),
),
)->executeQuery() )->executeQuery()
->fetchOne() ->fetchOne()
; ;
@@ -371,7 +371,7 @@ class Region extends AbstractDestination implements TeaserInterface
public function getWebcamAvailable(): bool public function getWebcamAvailable(): bool
{ {
$webcam = $this->getWebcam(); $webcam = $this->getWebcam();
return $webcam !== null && $webcam->getAvailable(); return null !== $webcam && $webcam->isVisible();
} }
/** /**
@@ -34,6 +34,11 @@ class Webcam extends AbstractEntity
*/ */
protected $available = true; protected $available = true;
/**
* @var bool
*/
protected $manual = false;
/** /**
* @return Snowreport * @return Snowreport
*/ */
@@ -113,4 +118,22 @@ class Webcam extends AbstractEntity
{ {
$this->available = $available; $this->available = $available;
} }
public function getManual(): bool
{
return (bool) $this->manual;
}
public function setManual(bool $manual): void
{
$this->manual = $manual;
}
/**
* The feed's availability only applies to imported cams; editors show or hide their own via "hidden"
*/
public function isVisible(): bool
{
return $this->getManual() || (bool) $this->getAvailable();
}
} }
@@ -277,7 +277,7 @@ class ApiMiddleware implements MiddlewareInterface
'webcam.url as webcamUrl', 'webcam.url as webcamUrl',
) )
->from('tx_epproducts_domain_model_region', 'region') ->from('tx_epproducts_domain_model_region', 'region')
->leftJoin('region', 'tx_epproducts_domain_model_webcam', 'webcam', 'region.webcam = webcam.uid AND webcam.available = 1') ->leftJoin('region', 'tx_epproducts_domain_model_webcam', 'webcam', 'region.webcam = webcam.uid AND (webcam.available = 1 OR webcam.manual = 1)')
->where($queryBuilder->expr()->eq('region.uid', $queryBuilder->createNamedParameter($regionUid, Connection::PARAM_INT)))->setMaxResults(1)->executeQuery() ->where($queryBuilder->expr()->eq('region.uid', $queryBuilder->createNamedParameter($regionUid, Connection::PARAM_INT)))->setMaxResults(1)->executeQuery()
->fetchAssociative() ->fetchAssociative()
; ;
@@ -138,15 +138,17 @@ return [
'available' => [ 'available' => [
'exclude' => 0, 'exclude' => 0,
'label' => 'verfügbar', 'label' => 'verfügbar',
'description' => 'Vom Import gesetzt, gilt nur für importierte Webcams',
'displayCond' => 'FIELD:manual:REQ:false',
'config' => [ 'config' => [
'type' => 'check', 'type' => 'check',
'default' => 1,
], ],
], ],
'manual' => [ 'manual' => [
'exclude' => 0, 'exclude' => 0,
'label' => 'Manuell gepflegt', 'label' => 'Manuell gepflegt',
'description' => 'Der Schneehöhen-Import ändert und löscht diese Webcam nicht', 'description' => 'Der Schneehöhen-Import ändert und löscht diese Webcam nicht; sie wird immer angezeigt (ausblenden über "Verbergen")',
'onChange' => 'reload',
'config' => [ 'config' => [
'type' => 'check', 'type' => 'check',
'default' => 1, 'default' => 1,
@@ -2,7 +2,7 @@
xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"> xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<f:if condition="{region.webcam.available}"> <f:if condition="{region.webcam.visible}">
<div class="bg-zinc-50 p-4 mb-8"> <div class="bg-zinc-50 p-4 mb-8">
<p class="font-bold mb-2"> <p class="font-bold mb-2">
Webcam Webcam