From 987de26b7303f504c65abd071e7863b8f283ec72 Mon Sep 17 00:00:00 2001 From: Mike Colagrosso Date: Tue, 9 Jan 2024 23:11:22 -0700 Subject: [PATCH] Artwork: Add EditUrl property on the artwork page --- lib/Artwork.php | 5 +++++ www/artworks/get.php | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/lib/Artwork.php b/lib/Artwork.php index 738710a4..2c71c439 100644 --- a/lib/Artwork.php +++ b/lib/Artwork.php @@ -14,6 +14,7 @@ use function Safe\preg_replace; /** * @property string $UrlName * @property string $Url + * @property string $EditUrl * @property array $Tags * @property Artist $Artist * @property string $ImageUrl @@ -160,6 +161,10 @@ class Artwork extends PropertiesBase{ return $this->_Url; } + protected function GetEditUrl(): string{ + return $this->Url . '/edit'; + } + /** * @return array */ diff --git a/www/artworks/get.php b/www/artworks/get.php index b91cceb9..bf5395e1 100644 --- a/www/artworks/get.php +++ b/www/artworks/get.php @@ -9,6 +9,8 @@ $exception = $_SESSION['exception'] ?? null; try{ $artwork = Artwork::GetByUrl(HttpInput::Str(GET, 'artist-url-name') ?? '', HttpInput::Str(GET, 'artwork-url-name') ?? ''); $isAdminView = $GLOBALS['User']->Benefits->CanReviewArtwork ?? false; + $userId = $GLOBALS['User']->UserId ?? null; + $isEditingAllowed = ($artwork->Status == ArtworkStatus::Unverified) && ($isAdminView || ($userId !== null && $userId == $artwork->SubmitterUserId)); // If the artwork is not approved, and we're not an admin, don't show it. if($artwork->Status != ArtworkStatus::Approved && $artwork->Status != ArtworkStatus::InUse && !$isAdminView){ @@ -128,6 +130,11 @@ catch(Exceptions\ArtworkNotFoundException){ Notes) ?> + +

Edit artwork

+

Before approval, the editor and submitter may edit Name) ?>.

+ +

Editor options

Review the metadata and PD proof for this artwork submission. Approve to make it available for future producers.