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 $UrlName
|
||||||
* @property string $Url
|
* @property string $Url
|
||||||
|
* @property string $EditUrl
|
||||||
* @property array<ArtworkTag> $Tags
|
* @property array<ArtworkTag> $Tags
|
||||||
* @property Artist $Artist
|
* @property Artist $Artist
|
||||||
* @property string $ImageUrl
|
* @property string $ImageUrl
|
||||||
|
@ -160,6 +161,10 @@ class Artwork extends PropertiesBase{
|
||||||
return $this->_Url;
|
return $this->_Url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function GetEditUrl(): string{
|
||||||
|
return $this->Url . '/edit';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<ArtworkTag>
|
* @return array<ArtworkTag>
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -9,6 +9,8 @@ $exception = $_SESSION['exception'] ?? null;
|
||||||
try{
|
try{
|
||||||
$artwork = Artwork::GetByUrl(HttpInput::Str(GET, 'artist-url-name') ?? '', HttpInput::Str(GET, 'artwork-url-name') ?? '');
|
$artwork = Artwork::GetByUrl(HttpInput::Str(GET, 'artist-url-name') ?? '', HttpInput::Str(GET, 'artwork-url-name') ?? '');
|
||||||
$isAdminView = $GLOBALS['User']->Benefits->CanReviewArtwork ?? false;
|
$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 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){
|
if($artwork->Status != ArtworkStatus::Approved && $artwork->Status != ArtworkStatus::InUse && !$isAdminView){
|
||||||
|
@ -128,6 +130,11 @@ catch(Exceptions\ArtworkNotFoundException){
|
||||||
<?= Formatter::EscapeMarkdown($artwork->Notes) ?>
|
<?= 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){ ?>
|
<? if($isAdminView){ ?>
|
||||||
<h2>Editor options</h2>
|
<h2>Editor options</h2>
|
||||||
<p>Review the metadata and PD proof for this artwork submission. Approve to make it available for future producers.</p>
|
<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