mirror of
https://github.com/standardebooks/web.git
synced 2025-07-15 19:06:49 -04:00
Artwork: Add EditUrl property on the artwork page
This commit is contained in:
parent
2fc92b8768
commit
987de26b73
2 changed files with 12 additions and 0 deletions
|
@ -14,6 +14,7 @@ use function Safe\preg_replace;
|
|||
/**
|
||||
* @property string $UrlName
|
||||
* @property string $Url
|
||||
* @property string $EditUrl
|
||||
* @property array<ArtworkTag> $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<ArtworkTag>
|
||||
*/
|
||||
|
|
|
@ -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){
|
|||
<?= Formatter::EscapeMarkdown($artwork->Notes) ?>
|
||||
<? } ?>
|
||||
|
||||
<? if($isEditingAllowed){ ?>
|
||||
<h2>Edit artwork</h2>
|
||||
<p>Before approval, the editor and submitter may <a href="<?= $artwork->EditUrl ?>">edit <i><?= Formatter::ToPlainText($artwork->Name) ?></i></a>.</p>
|
||||
<? } ?>
|
||||
|
||||
<? if($isAdminView){ ?>
|
||||
<h2>Editor options</h2>
|
||||
<p>Review the metadata and PD proof for this artwork submission. Approve to make it available for future producers.</p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue