diff --git a/lib/Ebook.php b/lib/Ebook.php index 092a99b7..fba7a098 100644 --- a/lib/Ebook.php +++ b/lib/Ebook.php @@ -45,7 +45,9 @@ use function Safe\shell_exec; * @property string $IndexableText * @property ?EbookPlaceholder $EbookPlaceholder * @property array $Projects + * @property array $PastProjects * @property ?Project $ProjectInProgress + * @property ?Artwork $Artwork */ final class Ebook{ use Traits\Accessor; @@ -127,12 +129,30 @@ final class Ebook{ protected ?EbookPlaceholder $_EbookPlaceholder = null; /** @var array $_Projects */ protected array $_Projects; + /** @var array $_PastProjects */ + protected array $_PastProjects; protected ?Project $_ProjectInProgress; + protected ?Artwork $_Artwork; // ******* // GETTERS // ******* + protected function GetArtwork(): ?Artwork{ + if(!isset($this->_Artwork)){ + $this->_Artwork = Db::Query(' + SELECT + * + from + Artworks + where + EbookUrl = ? + ', [preg_replace('/^url:/iu', '', $this->Identifier)], Artwork::class)[0] ?? null; + } + + return $this->_Artwork; + } + /** * @return array */ @@ -141,6 +161,8 @@ final class Ebook{ $this->_Projects = Db::Query(' SELECT * from Projects + inner join Ebooks + using(EbookId) where EbookId = ? order by Created desc ', [$this->EbookId], Project::class); @@ -158,6 +180,8 @@ final class Ebook{ $this->_ProjectInProgress = Db::Query(' SELECT * from Projects + inner join Ebooks + using(EbookId) where EbookId = ? and Status in (?, ?) ', [$this->EbookId, Enums\ProjectStatusType::InProgress, Enums\ProjectStatusType::Stalled], Project::class)[0] ?? null; @@ -167,6 +191,29 @@ final class Ebook{ return $this->_ProjectInProgress; } + /** + * @return array + */ + protected function GetPastProjects(): array{ + if(!isset($this->_PastProjects)){ + if(!isset($this->EbookId)){ + $this->_PastProjects = []; + } + else{ + $this->_PastProjects = Db::Query(' + SELECT * + from Projects + inner join Ebooks + using(EbookId) + where EbookId = ? + and Status in (?, ?) + ', [$this->EbookId, Enums\ProjectStatusType::Completed, Enums\ProjectStatusType::Abandoned], Project::class); + } + } + + return $this->_PastProjects; + } + /** * @return array */ diff --git a/templates/EmailHeader.php b/templates/EmailHeader.php index 31c133a3..3f165ae4 100644 --- a/templates/EmailHeader.php +++ b/templates/EmailHeader.php @@ -1,7 +1,7 @@ @@ -190,13 +190,13 @@ $hasDataTable = $hasDataTable ?? false; text-align: center; } - - table.data-table td:first-child{ + + table.admin-table td:first-child{ font-weight: bold; text-align: right; } - table.data-table td{ + table.admin-table td{ padding: .25em; border: none; } diff --git a/templates/EmailManagerNewProject.php b/templates/EmailManagerNewProject.php index a9a5f76c..517c64da 100644 --- a/templates/EmailManagerNewProject.php +++ b/templates/EmailManagerNewProject.php @@ -4,56 +4,9 @@ * @var string $role * @var User $user */ -?> true, 'letterhead' => true]) ?> +?> true, 'letterhead' => true]) ?>

You’ve been assigned a new ebook project to :

- - - - - - - - - - - - - - - - - - - VcsUrl !== null){ ?> - - - - - - DiscussionUrl !== null){ ?> - - - - - - -
Title:Ebook->Title) ?>
Producer: - ProducerEmail !== null){ ?> - ProducerName) ?> - DiscussionUrl !== null){ ?> - ProducerName) ?> - - ProducerName) ?> - -
Manager: - Manager->DisplayName) ?> -
Reviewer: - Reviewer->DisplayName) ?> -
Repository: - VcsUrlDomain) ?> -
Discussion: - DiscussionUrlDomain) ?> -
+ $project, 'useFullyQualifiedUrls' => true, 'showArtworkStatus' => false]) ?>

If you’re unable to this ebook project, email the Editor-in-Chief and we’ll reassign it.

  • diff --git a/templates/ProjectDetailsTable.php b/templates/ProjectDetailsTable.php new file mode 100644 index 00000000..c4194cef --- /dev/null +++ b/templates/ProjectDetailsTable.php @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + VcsUrl !== null){ ?> + + + + + + DiscussionUrl !== null){ ?> + + + + + + + + + + + + +
    Title:Ebook->Title) ?>
    Producer: + ProducerEmail !== null){ ?> + ProducerName) ?> + DiscussionUrl !== null){ ?> + ProducerName) ?> + + ProducerName) ?> + +
    Manager: + Manager->DisplayName) ?> +
    Reviewer: + Reviewer->DisplayName) ?> +
    Repository: + VcsUrlDomain) ?> +
    Discussion: + DiscussionUrlDomain) ?> +
    Cover art: + Ebook->Artwork !== null){ ?> + + Ebook->Artwork->Name) ?> + (Ebook->Artwork->Status->value) ?>.) + + None. + +
    diff --git a/www/css/core.css b/www/css/core.css index 0d999b82..e99bc205 100644 --- a/www/css/core.css +++ b/www/css/core.css @@ -3296,6 +3296,7 @@ ol.ebooks-list > li.ribbon.not-pd a::after{ content: "not p.d. yet"; } +p + table.admin-table, h2 + table.admin-table{ margin-top: .5rem; } diff --git a/www/ebook-placeholders/get.php b/www/ebook-placeholders/get.php index 043d06cb..e26fc4a6 100644 --- a/www/ebook-placeholders/get.php +++ b/www/ebook-placeholders/get.php @@ -125,7 +125,31 @@ catch(Exceptions\EbookNotFoundException){ Benefits->CanEditProjects || Session::$User?->Benefits->CanManageProjects || Session::$User?->Benefits->CanReviewProjects){ ?> - $ebook, 'showAddButton' => Session::$User->Benefits->CanEditProjects && $ebook->ProjectInProgress === null, 'showEditButton' => Session::$User->Benefits->CanEditProjects]) ?> + ProjectInProgress !== null){ ?> +
    +

    Project in progress

    + Benefits->CanEditProjects){ ?> +

    + Edit project +

    + + $ebook->ProjectInProgress, 'showTitle' => false]) ?> +
    + + +
    +

    Past projects

    + Benefits->CanEditProjects && $ebook->ProjectInProgress === null){ ?> +

    + New project +

    + + PastProjects) == 0){ ?> +

    None.

    + + $ebook->PastProjects, 'includeTitle' => false, 'showEditButton' => Session::$User->Benefits->CanEditProjects]) ?> + +
    diff --git a/www/ebook-placeholders/new.php b/www/ebook-placeholders/new.php index 6f01e2c7..e455dcfc 100644 --- a/www/ebook-placeholders/new.php +++ b/www/ebook-placeholders/new.php @@ -74,7 +74,7 @@ catch(Exceptions\InvalidPermissionsException){ -

    An ebook placeholder already exists for this ebook, but a a new project was created!

    +

    An ebook placeholder already exists for this ebook, but a new project was created!

    Ebook placeholder created: Title) ?>!