diff --git a/module/Company/src/Form/Company.php b/module/Company/src/Form/Company.php index 2a44ca4cf6..2cffc85079 100644 --- a/module/Company/src/Form/Company.php +++ b/module/Company/src/Form/Company.php @@ -268,7 +268,7 @@ public function getInputFilterSpecification(): array 'options' => [ 'pattern' => '/^[0-9a-zA-Z_\-\.]+$/', 'messages' => [ - Regex::ERROROUS => $this->getTranslator()->translate( + Regex::NOT_MATCH => $this->getTranslator()->translate( 'This slug contains invalid characters', ), ], diff --git a/module/Company/src/Form/Job.php b/module/Company/src/Form/Job.php index e6720e678c..681c8ce30e 100644 --- a/module/Company/src/Form/Job.php +++ b/module/Company/src/Form/Job.php @@ -289,7 +289,7 @@ public function getInputFilterSpecification(): array 'options' => [ 'pattern' => '/^[0-9a-zA-Z_\-\.]+$/', 'messages' => [ - Regex::ERROROUS => $this->getTranslator()->translate( + Regex::NOT_MATCH => $this->getTranslator()->translate( 'This slug contains invalid characters', ), ], diff --git a/module/Company/src/Form/JobCategory.php b/module/Company/src/Form/JobCategory.php index 072b5218c5..d86e5b84d7 100644 --- a/module/Company/src/Form/JobCategory.php +++ b/module/Company/src/Form/JobCategory.php @@ -200,7 +200,7 @@ public function getInputFilterSpecification(): array 'options' => [ 'pattern' => '/^[0-9a-zA-Z_\-\.]*$/', 'messages' => [ - Regex::ERROROUS => $this->translator->translate( + Regex::NOT_MATCH => $this->translator->translate( 'This slug contains invalid characters', ), ], diff --git a/module/Company/src/Form/Package.php b/module/Company/src/Form/Package.php index 57d8b5f329..9ce9995721 100644 --- a/module/Company/src/Form/Package.php +++ b/module/Company/src/Form/Package.php @@ -175,7 +175,7 @@ public function getInputFilterSpecification(): array 'options' => [ 'pattern' => '/^[0-9a-zA-Z_\-\.\s]+$/', 'messages' => [ - Regex::ERROROUS => $this->getTranslator()->translate( + Regex::NOT_MATCH => $this->getTranslator()->translate( 'Contract numbers can only contain letters, numbers, _, -, ., and spaces', ), ], diff --git a/module/Frontpage/src/Form/Page.php b/module/Frontpage/src/Form/Page.php index cf9f68ff40..2ddd758b10 100644 --- a/module/Frontpage/src/Form/Page.php +++ b/module/Frontpage/src/Form/Page.php @@ -284,7 +284,7 @@ public function getInputFilterSpecification(): array 'options' => [ 'pattern' => '/^[0-9a-zA-Z_\-]+$/', 'messages' => [ - Regex::ERROROUS => $this->translator->translate( + Regex::NOT_MATCH => $this->translator->translate( 'This route part contains invalid characters.', ), ], @@ -312,7 +312,7 @@ public function getInputFilterSpecification(): array 'options' => [ 'pattern' => '/^[0-9a-zA-Z_\-]+$/', 'messages' => [ - Regex::ERROROUS => $this->translator->translate( + Regex::NOT_MATCH => $this->translator->translate( 'This route part contains invalid characters.', ), ], @@ -343,7 +343,7 @@ public function getInputFilterSpecification(): array 'options' => [ 'pattern' => '/^[0-9a-zA-Z_\-]+$/', 'messages' => [ - Regex::ERROROUS => $this->translator->translate( + Regex::NOT_MATCH => $this->translator->translate( 'This route part contains invalid characters.', ), ], diff --git a/module/Photo/src/Controller/AlbumAdminController.php b/module/Photo/src/Controller/AlbumAdminController.php index 899efe297f..c108b05ea2 100644 --- a/module/Photo/src/Controller/AlbumAdminController.php +++ b/module/Photo/src/Controller/AlbumAdminController.php @@ -198,10 +198,13 @@ public function addAction(): ViewModel $albumId = (int) $this->params()->fromRoute('album_id'); $album = $this->albumService->getAlbum($albumId); + $start = $album->getStartDateTime(); + $year = null === $start ? null : AssociationYear::fromDate($start)->getYear(); + return new ViewModel( [ 'album' => $album, - 'year' => AssociationYear::fromDate($album->getStartDateTime())->getYear(), + 'year' => $year, ], ); } diff --git a/module/Photo/src/Form/Album.php b/module/Photo/src/Form/Album.php index 0d86e720e6..9ee93a3758 100644 --- a/module/Photo/src/Form/Album.php +++ b/module/Photo/src/Form/Album.php @@ -9,15 +9,15 @@ use Laminas\Form\Element\Submit; use Laminas\Form\Element\Text; use Laminas\Form\Form; -use Laminas\I18n\Validator\Alnum; use Laminas\InputFilter\InputFilterProviderInterface; use Laminas\Mvc\I18n\Translator; use Laminas\Validator\NotEmpty; +use Laminas\Validator\Regex; use Laminas\Validator\StringLength; class Album extends Form implements InputFilterProviderInterface { - public function __construct(Translator $translate) + public function __construct(private Translator $translator) { parent::__construct(); @@ -26,7 +26,7 @@ public function __construct(Translator $translate) 'name' => 'name', 'type' => Text::class, 'options' => [ - 'label' => $translate->translate('Album title'), + 'label' => $this->translator->translate('Album title'), ], ], ); @@ -36,7 +36,7 @@ public function __construct(Translator $translate) 'name' => 'startDateTime', 'type' => DateTimeLocal::class, 'options' => [ - 'label' => $translate->translate('Start date'), + 'label' => $this->translator->translate('Start date'), 'format' => 'Y-m-d\TH:i', ], ], @@ -47,7 +47,7 @@ public function __construct(Translator $translate) 'name' => 'endDateTime', 'type' => DateTimeLocal::class, 'options' => [ - 'label' => $translate->translate('End date'), + 'label' => $this->translator->translate('End date'), 'format' => 'Y-m-d\TH:i', ], ], @@ -58,7 +58,7 @@ public function __construct(Translator $translate) 'name' => 'published', 'type' => Checkbox::class, 'options' => [ - 'label' => $translate->translate('Published'), + 'label' => $this->translator->translate('Published'), 'checked_value' => '1', 'unchecked_value' => '0', ], @@ -73,7 +73,7 @@ public function __construct(Translator $translate) 'name' => 'submit', 'type' => Submit::class, 'options' => [ - 'label' => $translate->translate('Save'), + 'label' => $this->translator->translate('Save'), ], ], ); @@ -92,9 +92,14 @@ public function getInputFilterSpecification(): array 'name' => NotEmpty::class, ], [ - 'name' => Alnum::class, + 'name' => Regex::class, 'options' => [ - 'allowWhiteSpace' => true, + 'pattern' => '/^[0-9a-zA-Z\-\.\:\'\"\s]+$/', + 'messages' => [ + Regex::NOT_MATCH => $this->translator->translate( + 'Album name can only contain letters, numbers, -, ., :, \', ", and spaces', + ), + ], ], ], [ diff --git a/module/Photo/view/photo/album-admin/add.phtml b/module/Photo/view/photo/album-admin/add.phtml index 03be6d4ecb..00f5d95161 100644 --- a/module/Photo/view/photo/album-admin/add.phtml +++ b/module/Photo/view/photo/album-admin/add.phtml @@ -9,6 +9,7 @@ use Photo\Model\Album as AlbumModel; /** * @var PhpRenderer|HelperTrait $this * @var AlbumModel $album + * @var int|null $year */ $this->inlineScript() @@ -30,8 +31,28 @@ $this->inlineScript() $this->headLink()->appendStylesheet($this->basepath('css/dropzone.css')); $this->breadcrumbs() - ->addBreadcrumb($this->translate('Photos'), true, $this->url('admin_photo')) - ->addBreadcrumb(sprintf('%d/%d', $year, $year + 1), true, $this->url('admin_photo/album_year', ['year' => $year])); + ->addBreadcrumb($this->translate('Photos'), true, $this->url('admin_photo')); + +if (null === $year) { + $this->breadcrumbs() + ->addBreadcrumb( + $this->translate('Undated'), + true, + $this->url('admin_photo/album_undated'), + ); +} else { + $this->breadcrumbs() + ->addBreadcrumb( + sprintf( + '%d/%d', + $year, + $year + 1, + ), + true, + $this->url('admin_photo/album_year', ['year' => $year]), + ); +} + if (null !== $album->getParent()) { $parents = [];