Add Special Notes field to artwork

This commit is contained in:
Alex Cabal 2024-01-10 13:41:15 -06:00
parent 1237a65bc8
commit 60eb118524
5 changed files with 29 additions and 6 deletions

View file

@ -19,6 +19,7 @@ CREATE TABLE `Artworks` (
`EbookWwwFilesystemPath` varchar(255) NULL,
`MimeType` varchar(64) NOT NULL,
`Exception` TEXT NULL DEFAULT NULL,
`Notes` TEXT NULL DEFAULT NULL
PRIMARY KEY (`ArtworkId`),
KEY `index1` (`Status`),
KEY `index2` (`UrlName`)

View file

@ -46,6 +46,7 @@ class Artwork extends PropertiesBase{
public ?string $ArtworkPageUrl = null;
public ?bool $IsPublishedInUs = null;
public ?string $Exception = null;
public ?string $Notes = null;
protected ?string $_UrlName = null;
protected ?string $_Url = null;
protected $_Tags = null;
@ -268,6 +269,10 @@ class Artwork extends PropertiesBase{
$this->Exception = null;
}
if($this->Notes !== null && trim($this->Notes) == ''){
$this->Notes = null;
}
if($this->Name === null || $this->Name == ''){
$error->Add(new Exceptions\ArtworkNameRequiredException());
}
@ -564,7 +569,7 @@ class Artwork extends PropertiesBase{
INSERT into
Artworks (ArtistId, Name, UrlName, CompletedYear, CompletedYearIsCirca, Created, Status, SubmitterUserId, ReviewerUserId, MuseumUrl,
PublicationYear, PublicationYearPageUrl, CopyrightPageUrl, ArtworkPageUrl, IsPublishedInUs,
EbookWwwFilesystemPath, MimeType, Exception)
EbookWwwFilesystemPath, MimeType, Exception, Notes)
values (?,
?,
?,
@ -582,10 +587,11 @@ class Artwork extends PropertiesBase{
?,
?,
?,
?,
?)
', [$this->Artist->ArtistId, $this->Name, $this->UrlName, $this->CompletedYear, $this->CompletedYearIsCirca,
$this->Created, $this->Status, $this->SubmitterUserId, $this->ReviewerUserId, $this->MuseumUrl, $this->PublicationYear, $this->PublicationYearPageUrl,
$this->CopyrightPageUrl, $this->ArtworkPageUrl, $this->IsPublishedInUs, $this->EbookWwwFilesystemPath, $this->MimeType->value ?? null, $this->Exception]
$this->CopyrightPageUrl, $this->ArtworkPageUrl, $this->IsPublishedInUs, $this->EbookWwwFilesystemPath, $this->MimeType->value ?? null, $this->Exception, $this->Notes]
);
$this->ArtworkId = Db::GetLastInsertedId();
@ -640,12 +646,13 @@ class Artwork extends PropertiesBase{
IsPublishedInUs = ?,
EbookWwwFilesystemPath = ?,
MimeType = ?,
Exception = ?
Exception = ?,
Notes = ?
where
ArtworkId = ?
', [$this->Artist->ArtistId, $this->Name, $this->UrlName, $this->CompletedYear, $this->CompletedYearIsCirca,
$this->Created, $this->Status, $this->SubmitterUserId, $this->ReviewerUserId, $this->MuseumUrl, $this->PublicationYear, $this->PublicationYearPageUrl,
$this->CopyrightPageUrl, $this->ArtworkPageUrl, $this->IsPublishedInUs, $this->EbookWwwFilesystemPath, $this->MimeType->value ?? null, $this->Exception,
$this->CopyrightPageUrl, $this->ArtworkPageUrl, $this->IsPublishedInUs, $this->EbookWwwFilesystemPath, $this->MimeType->value ?? null, $this->Exception, $this->Notes,
$this->ArtworkId]
);
}

View file

@ -119,10 +119,15 @@ catch(Exceptions\ArtworkNotFoundException){
<? } ?>
<? if($artwork->Exception !== null){ ?>
<h3>Special public domain exception</h3>
<h3>Public domain status exception reason</h3>
<?= Formatter::EscapeMarkdown($artwork->Exception) ?>
<? } ?>
<? if($artwork->Notes !== null){ ?>
<h2>Special notes</h2>
<?= Formatter::EscapeMarkdown($artwork->Notes) ?>
<? } ?>
<? if($isAdminView){ ?>
<h2>Reviewer options</h2>
<p>Review the metadata and PD proof for this artwork submission. Approve to make it available for future producers.</p>

View file

@ -217,12 +217,20 @@ catch(Exceptions\InvalidPermissionsException){
<p><strong>or</strong> a reason for a special exception:</p>
<fieldset>
<label>
<span>Exception reason</span>
<span>Public domain status exception reason</span>
<span>Markdown accepted.</span>
<textarea maxlength="1024" name="artwork-exception"><?= Formatter::ToPlainText($artwork->Exception) ?></textarea>
</label>
</fieldset>
</fieldset>
<fieldset>
<legend>Other details</legend>
<label>
<span>Special notes</span>
<span>Any notes to remember about this artwork. Markdown accepted.</span>
<textarea maxlength="1024" name="artwork-notes"><?= Formatter::ToPlainText($artwork->Notes) ?></textarea>
</label>
</fieldset>
<? if($GLOBALS['User']->Benefits->CanReviewArtwork){ ?>
<fieldset>
<legend>Reviewer options</legend>

View file

@ -42,6 +42,7 @@ try{
$artwork->MuseumUrl = HttpInput::Str(POST, 'artwork-museum-url', false);
$artwork->MimeType = ImageMimeType::FromFile($_FILES['artwork-image']['tmp_name'] ?? null);
$artwork->Exception = HttpInput::Str(POST, 'artwork-exception', false);
$artwork->Notes = HttpInput::Str(POST, 'artwork-notes', false);
// Only approved reviewers can set the status to anything but unverified when uploading
if($artwork->Status != COVER_ARTWORK_STATUS_UNVERIFIED && !$GLOBALS['User']->Benefits->CanReviewArtwork){
@ -86,6 +87,7 @@ try{
$artwork->ArtworkPageUrl = HttpInput::Str(POST, 'artwork-artwork-page-url', false) ?? $artwork->ArtworkPageUrl;
$artwork->MuseumUrl = HttpInput::Str(POST, 'artwork-museum-url', false) ?? $artwork->MuseumUrl;
$artwork->Exception = HttpInput::Str(POST, 'artwork-exception', false) ?? $artwork->Exception;
$artwork->Notes = HttpInput::Str(POST, 'artwork-notes', false) ?? $artwork->Notes;
$artwork->ReviewerUserId = $GLOBALS['User']->UserId;