Commit graph

148 commits

Author SHA1 Message Date
Mike Colagrosso
0e7bff5d82 Rewrite MultiTableSelect queries with ON
Instead of `USING(EbookId)`, it would be easier to handle
`MultiTableSelect` queries in `FromMultiTableRow()` if the queries used

`ON Projects.EbookId = Ebooks.Ebooks`

This is because `USING` will return only one `EbookId` column, but `ON`
will return all columns from both tables.
2025-01-02 09:57:45 -06:00
Alex Cabal
9abae874f6 Fix sort order of collection placeholders with no sequence 2024-12-31 14:21:59 -06:00
Alex Cabal
b8c4de4b20 Change order of collection sorting 2024-12-31 10:32:57 -06:00
Alex Cabal
53fe66a364 Initialize empty values for some image URLs 2024-12-29 15:10:41 -06:00
Alex Cabal
c43c4fa2dd Tweak wanted list appearance 2024-12-28 19:14:04 -06:00
Mike Colagrosso
2d5cba0aaa Rename function to Ebook::GetByIsWantedAndDifficulty() 2024-12-28 14:18:08 -06:00
Mike Colagrosso
5b605a00b7 Populate the wanted list from DB placeholders 2024-12-28 14:18:08 -06:00
Mike Colagrosso
d6dd10be9c Clean up unused Tags, LocSubjects, and Collections
On `Ebook::Save()` and `Ebook::Delete()`, remove any unreferenced `Tag`,
`LocSubject`, and `Collection` records. These are analogous to these lines in
`Ebook::Create()`:

```
$this->CreateTags();
$this->CreateLocSubjects();
$this->CreateCollections();
```

`EbookPlaceholder`s can't have `Tags` or `LocSubjects` at the moment, but other
mistakes in production that are later corrected could leave unused `Tags` and
`LocSubjects`.

Context: https://github.com/standardebooks/web/pull/447#issuecomment-2555734692
2024-12-26 12:10:13 -06:00
Alex Cabal
8e8cbb0c5e Move delete form and more multi select fixes 2024-12-19 14:40:38 -06:00
Mike Colagrosso
d0d79d637c Add form to delete placeholders 2024-12-19 14:21:25 -06:00
Alex Cabal
378555d131 Show improved project details on placeholder page 2024-12-18 15:54:06 -06:00
Alex Cabal
7a6a743295 Some type check fixes 2024-12-18 15:03:44 -06:00
Alex Cabal
a1da50fc1a Sort projects by ebook title 2024-12-18 14:28:07 -06:00
Alex Cabal
b2191d1219 Allow editing of projects 2024-12-18 14:20:28 -06:00
Mike Colagrosso
f449c024ea Add /edit endpoint to update placeholders 2024-12-18 12:58:18 -06:00
Alex Cabal
c7a4e34e31 Add projects index page, and more detail on placeholder pages 2024-12-14 21:12:00 -06:00
Alex Cabal
adfe07aad9 Add beginning of a project management system to placeholders 2024-12-14 19:13:03 -06:00
Alex Cabal
e56de4b19d Switch from EbookPlaceholder.Status to EbookPlaceholder.IsInProgress, and some type tweaks 2024-12-14 13:39:28 -06:00
Alex Cabal
1a742baa51 Add CanEditEbooks benefit and clean up some PHPStan errors 2024-12-14 11:50:16 -06:00
Alex Cabal
23b5c8ef31 Allow admin to view collection metadata 2024-12-14 11:32:02 -06:00
Alex Cabal
79fdc8c20f Some type check fixes 2024-12-13 23:21:04 -06:00
Alex Cabal
89d0b2ea46 Replace ' with ’ in placeholder titles 2024-12-13 12:24:29 -06:00
Mike Colagrosso
1ab95df084 Add placeholders for ebooks 2024-12-13 11:46:36 -06:00
Alex Cabal
77540dacbb Clarify comments 2024-12-05 11:22:53 -06:00
Alex Cabal
f9b3d09c7d Code formatting 2024-11-28 12:12:00 -06:00
Alex Cabal
347f166e8a Catch rare exception when searching ebooks 2024-11-28 12:10:53 -06:00
Alex Cabal
3f822b85c3 Add PHPDocs and code formatting 2024-11-20 14:23:42 -06:00
Alex Cabal
d4c7703cf0 Restructure how incorrect ebook URLs are redirected 2024-11-11 13:59:45 -06:00
Alex Cabal
d6a2bdcbc8 Make MARC roles an enum and restructure how contributors are fetched from the DB to reduce queries 2024-11-11 12:01:53 -06:00
Alex Cabal
b7b63a4be5 Refactor functions out of Library 2024-11-10 23:05:31 -06:00
Alex Cabal
acb30b897c Add PropertyFromHttp trait and update codebase to use new pattern 2024-11-10 22:23:43 -06:00
Alex Cabal
be5574eaec Move enums into their own namespace 2024-11-08 16:34:21 -06:00
Alex Cabal
d03d9782d1 Fixes for PD Day placeholder ebooks 2024-11-07 20:15:20 -06:00
Alex Cabal
274605a0e8 Fix incorrect filesystem determination and simplify hash calculation 2024-11-05 14:04:56 -06:00
Alex Cabal
163ada3b09 Add placeholders for public domain day ebooks 2024-11-04 21:17:09 -06:00
Mike Colagrosso
7e67e108f3 Update some comments 2024-11-04 13:16:56 -06:00
Mike Colagrosso
65d1dcdd88 Use the NOW constant from eec7971 2024-11-04 13:16:56 -06:00
Mike Colagrosso
df8eac6f82 Rename GitCommit::FromLogLine and have it accept the full line 2024-11-04 13:16:56 -06:00
Mike Colagrosso
e9cf55b53f Remove EbookSource::FromTypeAndUrl() 2024-11-04 13:16:56 -06:00
Mike Colagrosso
6bec232d37 Remove checks against EBOOK_EARLIEST_CREATION_DATE 2024-11-04 13:16:56 -06:00
Mike Colagrosso
d22bdc0099 Remove use of Safe\sprintf 2024-11-04 13:16:56 -06:00
Mike Colagrosso
c8e6524ef2 Remove primary key TocEntryId
Add a SortOrder column to order the TocEntries instead.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
3f3cf702b2 Remove primary key ContributorId
`Ebook` to `Contributor` is one to many, and we don't query by ContributorId.
The table already has a SortOrder column, and we use that to order the queries.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
1076c9a77d Remove primary key EbookSourceId
There is a one to many relationship between `Ebook` and `EbookSource`, and we
don't query by `EbookSourceId`. We add a `SortOrder` column to keep the sources
in the same order as specified in `content.opf`.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
4e8ba5ddaa Remove primary key EbookTagId
Add a SortOrder column so that tags are presented in the same order as listed in content.opf.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
b4b6fde778 Remove primary key EbookLocSubjectId
Add a SortOrder column to keep the LocSubjects in the same order as given in content.opf.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
cada95383f Remove primary key CollectionEbookId
Add a SortOrder to preserve the order of the collections listed in content.opf for ebook.php, e.g., for To the Lighthouse:

№ 15 in the Modern Library’s 100 Best Novels set.
Part of the Encyclopædia Britannica’s Great Books of the Western World set.
№ 2 in the BBC’s 100 Greatest British Novels (2015) set.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
d0926370be Add check for DuplicateDatabaseKeyException
when inserting into join tables EbookTags, EbookLocSubjects, CollectionEbooks
2024-11-04 13:16:56 -06:00
Mike Colagrosso
38860c4729 Rename Insert*Strings() to Create*()
Also rename:

Insert*() to Add*()
Delete*() to Remove*()
2024-11-04 13:16:56 -06:00
Mike Colagrosso
16c7c2ffd8 Anchor on beginning or ending in preg_match() 2024-11-04 13:16:56 -06:00