diff --git a/config/sql/se/EbookPlaceholders.sql b/config/sql/se/EbookPlaceholders.sql index 409591ec..6622d2a9 100644 --- a/config/sql/se/EbookPlaceholders.sql +++ b/config/sql/se/EbookPlaceholders.sql @@ -1,10 +1,10 @@ CREATE TABLE IF NOT EXISTS `EbookPlaceholders` ( `EbookId` int(10) unsigned NOT NULL, `YearPublished` smallint unsigned NULL, - `Status` enum('wanted', 'in_progress') NULL, `Difficulty` enum('beginner', 'intermediate', 'advanced') NULL, `TranscriptionUrl` varchar(511) NULL, `IsWanted` boolean NOT NULL DEFAULT FALSE, + `IsInProgress` boolean NOT NULL DEFAULT FALSE, `IsPatron` boolean NOT NULL DEFAULT FALSE, `Notes` TEXT NULL DEFAULT NULL, PRIMARY KEY (`EbookId`) diff --git a/config/sql/se/Projects.sql b/config/sql/se/Projects.sql new file mode 100644 index 00000000..947b4664 --- /dev/null +++ b/config/sql/se/Projects.sql @@ -0,0 +1,16 @@ +CREATE TABLE IF NOT EXISTS `Projects` ( + `ProjectId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Status` enum('in_progress','stalled','completed','abandoned') NOT NULL DEFAULT 'in_progress', + `EbookId` int(11) NOT NULL, + `ProducerName` varchar(151) DEFAULT NULL, + `ProducerEmail` varchar(80) DEFAULT NULL, + `DiscussionUrl` varchar(255) DEFAULT NULL, + `VcsUrl` varchar(255) NOT NULL, + `Created` timestamp NOT NULL DEFAULT current_timestamp(), + `Updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `Started` datetime NOT NULL, + `Ended` datetime DEFAULT NULL, + `ManagerUserId` int(11) NOT NULL, + `ReviewerUserId` int(11) NOT NULL, + PRIMARY KEY (`ProjectId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; diff --git a/lib/Ebook.php b/lib/Ebook.php index b51a539c..9198a410 100644 --- a/lib/Ebook.php +++ b/lib/Ebook.php @@ -612,11 +612,16 @@ class Ebook{ protected function GetEbookPlaceholder(): ?EbookPlaceholder{ if(!isset($this->_EbookPlaceholder)){ - $this->_EbookPlaceholder = Db::Query(' - SELECT * - from EbookPlaceholders - where EbookId = ? - ', [$this->EbookId], EbookPlaceholder::class)[0] ?? null; + if(!isset($this->EbookId)){ + $this->_EbookPlaceholder = null; + } + else{ + $this->_EbookPlaceholder = Db::Query(' + SELECT * + from EbookPlaceholders + where EbookId = ? + ', [$this->EbookId], EbookPlaceholder::class)[0] ?? null; + } } return $this->_EbookPlaceholder; diff --git a/lib/EbookPlaceholder.php b/lib/EbookPlaceholder.php index 3b88a670..db01350f 100644 --- a/lib/EbookPlaceholder.php +++ b/lib/EbookPlaceholder.php @@ -11,7 +11,7 @@ class EbookPlaceholder{ public int $EbookId; public ?int $YearPublished = null; public bool $IsWanted = false; - public ?Enums\EbookPlaceholderStatus $Status = null; + public bool $IsInProgress = false; public ?Enums\EbookPlaceholderDifficulty $Difficulty = null; public ?string $TranscriptionUrl = null; public bool $IsPatron = false; @@ -61,10 +61,10 @@ class EbookPlaceholder{ public function FillFromHttpPost(): void{ $this->PropertyFromHttp('YearPublished'); $this->PropertyFromHttp('IsWanted'); + $this->PropertyFromHttp('IsInProgress'); // These properties apply only to books on the SE wanted list. if($this->IsWanted){ - $this->PropertyFromHttp('Status'); $this->PropertyFromHttp('Difficulty'); $this->PropertyFromHttp('TranscriptionUrl'); $this->PropertyFromHttp('IsPatron'); @@ -104,8 +104,8 @@ class EbookPlaceholder{ public function Create(): void{ $this->Validate(); Db::Query(' - INSERT into EbookPlaceholders (EbookId, YearPublished, Status, Difficulty, TranscriptionUrl, - IsWanted, IsPatron, Notes) + INSERT into EbookPlaceholders (EbookId, YearPublished, Difficulty, TranscriptionUrl, + IsWanted, IsInProgress, IsPatron, Notes) values (?, ?, ?, @@ -114,7 +114,7 @@ class EbookPlaceholder{ ?, ?, ?) - ', [$this->EbookId, $this->YearPublished, $this->Status, $this->Difficulty, $this->TranscriptionUrl, - $this->IsWanted, $this->IsPatron, $this->Notes]); + ', [$this->EbookId, $this->YearPublished, $this->Difficulty, $this->TranscriptionUrl, + $this->IsWanted, $this->IsInProgress, $this->IsPatron, $this->Notes]); } } diff --git a/lib/Enums/EbookPlaceholderStatus.php b/lib/Enums/EbookPlaceholderStatus.php deleted file mode 100644 index 1be91269..00000000 --- a/lib/Enums/EbookPlaceholderStatus.php +++ /dev/null @@ -1,7 +0,0 @@ -Name) ?>"/> -
  • resource="Url ?>" property="schema:hasPart"GetCollectionPosition($collection) !== null){ ?> value="GetCollectionPosition($collection) ?>" about="Url ?>"EbookPlaceholder?->IsWanted){ ?> class="ribbon EbookPlaceholder->Status == \Enums\EbookPlaceholderStatus::InProgress){ ?>in-progresswanted"EbookPlaceholder !== null && !$ebook->EbookPlaceholder->IsPublicDomain){ ?> class="ribbon not-pd"> +
  • resource="Url ?>" property="schema:hasPart"GetCollectionPosition($collection) !== null){ ?> value="GetCollectionPosition($collection) ?>" about="Url ?>"EbookPlaceholder?->IsInProgress){ ?> class="ribbon in-progress"EbookPlaceholder?->IsWanted){ ?> class="ribbon wanted"EbookPlaceholder !== null && !$ebook->EbookPlaceholder->IsPublicDomain){ ?> class="ribbon not-pd"> GetCollectionPosition($collection) !== null){ ?> diff --git a/templates/EbookPlaceholderForm.php b/templates/EbookPlaceholderForm.php index b4a3e60e..9ae5ab33 100644 --- a/templates/EbookPlaceholderForm.php +++ b/templates/EbookPlaceholderForm.php @@ -74,7 +74,7 @@ $ebook = $ebook ?? new Ebook();
    @@ -165,22 +165,34 @@ $ebook = $ebook ?? new Ebook();
    + + Wanted list
    - @@ -208,13 +211,13 @@ $ebook = $ebook ?? new Ebook();
    diff --git a/www/ebook-placeholders/get.php b/www/ebook-placeholders/get.php index 39e8f1c4..2bbf1cda 100644 --- a/www/ebook-placeholders/get.php +++ b/www/ebook-placeholders/get.php @@ -78,7 +78,7 @@ catch(Exceptions\EbookNotFoundException){
    EbookPlaceholder->IsPublicDomain){ ?> - EbookPlaceholder->Status == \Enums\EbookPlaceholderStatus::InProgress){ ?> + EbookPlaceholder->IsInProgress){ ?>

    We don’t have this ebook in our catalog yet, but someone is working on it now! We hope to have it available for you to read very soon.

    We don’t have this ebook in our catalog yet, but it’s EbookPlaceholder->IsWanted){ ?>on our Wanted Ebooks listin the U.S. public domain!