From 54a35dda261bb44a93631344a6976e26fb103268 Mon Sep 17 00:00:00 2001 From: pjc09h <48838413+pjc09h@users.noreply.github.com> Date: Fri, 31 May 2024 22:02:51 +0000 Subject: [PATCH] delete old torrent form templates --- app/Models/ObjectCrud.php | 1 + app/Models/TorrentGroups.php | 24 + app/Models/Torrents.php | 2 +- app/Permissions.php | 10 + app/Top10.php | 97 +- app/TorrentForm.php | 1235 ----------------- config/metadata.php | 8 + resources/js/torrent.js | 2 + resources/scss/assets/icons.scss | 7 + resources/scss/global/forms.scss | 1 + resources/scss/global/layout.scss | 1 + resources/scss/global/torrents.scss | 8 +- sections/better/badFolders.php | 9 +- sections/better/badTags.php | 7 +- sections/better/missingCitations.php | 7 +- sections/better/missingPictures.php | 9 +- sections/better/singleSeeder.php | 9 +- sections/literature/details.php | 1 + sections/top10/torrents.php | 30 - sections/torrentGroups/browse.php | 22 +- sections/torrentGroups/details.php | 3 + sections/torrents/details.php | 38 +- sections/torrents/update.php | 1 - sections/upload/upload.php | 24 +- templates/_base/userInfo.twig | 36 +- templates/better/list.twig | 20 +- templates/bonusPoints/store.twig | 5 + templates/collages/browse.twig | 93 +- templates/literature/details.twig | 49 +- templates/literature/sidebar.twig | 53 +- templates/tables/collages.twig | 66 + templates/tables/literature.twig | 56 +- .../tables/torrentGroupsWithTorrents.twig | 99 +- .../tables/torrentGroupsWithoutTorrents.twig | 79 +- templates/tables/torrents.twig | 121 ++ templates/top10/torrents.twig | 96 +- templates/torrentGroups/details.twig | 293 +--- templates/torrentGroups/sidebar.twig | 4 +- templates/torrent_form/announce_source.html | 25 - templates/torrent_form/identifier.html | 23 - templates/torrent_form/location.html | 16 - templates/torrent_form/mirrors.html | 14 - templates/torrent_form/notice.html | 21 - templates/torrent_form/picture.html | 16 - templates/torrent_form/seqhash.html | 54 - templates/torrent_form/titles.html | 50 - templates/torrent_form/version.html | 19 - templates/torrent_form/workgroup.html | 16 - templates/torrent_form/year.html | 17 - templates/torrents/browse.twig | 85 +- templates/torrents/details.twig | 123 +- templates/torrents/sidebar.twig | 36 +- 52 files changed, 683 insertions(+), 2458 deletions(-) delete mode 100644 app/TorrentForm.php create mode 100644 templates/tables/collages.twig create mode 100644 templates/tables/torrents.twig delete mode 100644 templates/torrent_form/announce_source.html delete mode 100644 templates/torrent_form/identifier.html delete mode 100644 templates/torrent_form/location.html delete mode 100644 templates/torrent_form/mirrors.html delete mode 100644 templates/torrent_form/notice.html delete mode 100644 templates/torrent_form/picture.html delete mode 100644 templates/torrent_form/seqhash.html delete mode 100644 templates/torrent_form/titles.html delete mode 100644 templates/torrent_form/version.html delete mode 100644 templates/torrent_form/workgroup.html delete mode 100644 templates/torrent_form/year.html diff --git a/app/Models/ObjectCrud.php b/app/Models/ObjectCrud.php index ecfadb0f1..464a941a6 100644 --- a/app/Models/ObjectCrud.php +++ b/app/Models/ObjectCrud.php @@ -409,6 +409,7 @@ private function loadRelationships($object): void $this->relationships->{$object::$type} ??= null; if (!$this->relationships->{$object::$type}) { + $this->relationships->{$object::$type} = []; return; } diff --git a/app/Models/TorrentGroups.php b/app/Models/TorrentGroups.php index fcfaa6421..9a69ce1f6 100644 --- a/app/Models/TorrentGroups.php +++ b/app/Models/TorrentGroups.php @@ -147,6 +147,7 @@ public function delete(): void public function relationships(): ?array { return [ + Collages::$type => $this->relatedCollages(), Creators::$type => $this->relatedCreators(), Literature::$type => $this->relatedLiterature(), Tags::$type => $this->relatedTags(), @@ -155,6 +156,29 @@ public function relationships(): ?array } + /** + * relatedCollages + */ + private function relatedCollages(): ?array + { + $app = App::go(); + + $query = "select collageId from collages_torrents where groupId = ?"; + $ref = $app->dbNew->column($query, [$this->id]); + + if (!$ref) { + return null; + } + + $data = []; + foreach ($ref as $row) { + $data[] = ["id" => $row, "type" => Collages::$type]; + } + + return $data; + } + + /** * relatedCreators */ diff --git a/app/Models/Torrents.php b/app/Models/Torrents.php index 1431ee499..5cd7daa4f 100644 --- a/app/Models/Torrents.php +++ b/app/Models/Torrents.php @@ -157,7 +157,7 @@ public function read(int|string $id = null): void parent::read($id); # explode the fileList - $fileList = explode("÷", $this->attributes->fileList); + $fileList = explode("÷", $this->attributes->fileList ?? ""); $fileData = []; foreach ($fileList as $file) { diff --git a/app/Permissions.php b/app/Permissions.php index 86c961e38..6830819ea 100644 --- a/app/Permissions.php +++ b/app/Permissions.php @@ -67,6 +67,16 @@ class Permissions "deleteAny" => "Can delete any creators", ], + # literature + "literature" => [ + "create" => "Can create literature", + "read" => "Can read literature", + "updateOwn" => "Can update own literature", + "updateAny" => "Can update any literature", + "deleteOwn" => "Can delete own literature", + "deleteAny" => "Can delete any literature", + ], + # requests "requests" => [ "create" => "Can create requests", diff --git a/app/Top10.php b/app/Top10.php index 172ff7608..d3dcba3da 100644 --- a/app/Top10.php +++ b/app/Top10.php @@ -98,7 +98,7 @@ public static function dailyTorrents(int $limit = null): ?array $cacheHit = $app->cache->get($cacheKey); if ($cacheHit) { - return $cacheHit; + #return $cacheHit; } # set limit and query extras @@ -106,8 +106,14 @@ public static function dailyTorrents(int $limit = null): ?array $query = self::$torrentQuery . "where torrents.created_at > (now() - interval 1 day) order by (torrents.seeders + torrents.leechers) desc limit :limit"; $ref = $app->dbNew->multi($query, ["limit" => $limit]); - $app->cache->set($cacheKey, $ref, self::$cacheDuration); - return $ref; + $data = []; + foreach ($ref as $key => $row) { + $data[] = new TorrentGroups($row["id"]); + $data[$key]->attributes->dataTransfer = $row["dataTransfer"]; + } + + $app->cache->set($cacheKey, $data, self::$cacheDuration); + return $data; } @@ -128,7 +134,7 @@ public static function weeklyTorrents(int $limit = null): ?array $cacheHit = $app->cache->get($cacheKey); if ($cacheHit) { - return $cacheHit; + #return $cacheHit; } # set limit and query extras @@ -136,8 +142,14 @@ public static function weeklyTorrents(int $limit = null): ?array $query = self::$torrentQuery . "where torrents.created_at > (now() - interval 1 week) order by (torrents.seeders + torrents.leechers) desc limit :limit"; $ref = $app->dbNew->multi($query, ["limit" => $limit]); - $app->cache->set($cacheKey, $ref, self::$cacheDuration); - return $ref; + $data = []; + foreach ($ref as $key => $row) { + $data[] = new TorrentGroups($row["id"]); + $data[$key]->attributes->dataTransfer = $row["dataTransfer"]; + } + + $app->cache->set($cacheKey, $data, self::$cacheDuration); + return $data; } @@ -158,7 +170,7 @@ public static function monthlyTorrents(int $limit = null): ?array $cacheHit = $app->cache->get($cacheKey); if ($cacheHit) { - return $cacheHit; + #return $cacheHit; } # set limit and query extras @@ -166,8 +178,14 @@ public static function monthlyTorrents(int $limit = null): ?array $query = self::$torrentQuery . "where torrents.created_at > (now() - interval 1 month) order by (torrents.seeders + torrents.leechers) desc limit :limit"; $ref = $app->dbNew->multi($query, ["limit" => $limit]); - $app->cache->set($cacheKey, $ref, self::$cacheDuration); - return $ref; + $data = []; + foreach ($ref as $key => $row) { + $data[] = new TorrentGroups($row["id"]); + $data[$key]->attributes->dataTransfer = $row["dataTransfer"]; + } + + $app->cache->set($cacheKey, $data, self::$cacheDuration); + return $data; } @@ -188,7 +206,7 @@ public static function yearlyTorrents(int $limit = null): ?array $cacheHit = $app->cache->get($cacheKey); if ($cacheHit) { - return $cacheHit; + #return $cacheHit; } # set limit and query extras @@ -196,10 +214,17 @@ public static function yearlyTorrents(int $limit = null): ?array $query = self::$torrentQuery . "where torrents.created_at > (now() - interval 1 year) order by (torrents.seeders + torrents.leechers) desc limit :limit"; $ref = $app->dbNew->multi($query, ["limit" => $limit]); - $app->cache->set($cacheKey, $ref, self::$cacheDuration); - return $ref; + $data = []; + foreach ($ref as $key => $row) { + $data[] = new TorrentGroups($row["id"]); + $data[$key]->attributes->dataTransfer = $row["dataTransfer"]; + } + + $app->cache->set($cacheKey, $data, self::$cacheDuration); + return $data; } + /** * overallTorrents * @@ -217,7 +242,7 @@ public static function overallTorrents(int $limit = null): ?array $cacheHit = $app->cache->get($cacheKey); if ($cacheHit) { - return $cacheHit; + #return $cacheHit; } # set limit and query extras @@ -225,8 +250,14 @@ public static function overallTorrents(int $limit = null): ?array $query = self::$torrentQuery . "order by (torrents.seeders + torrents.leechers) desc limit :limit"; $ref = $app->dbNew->multi($query, ["limit" => $limit]); - $app->cache->set($cacheKey, $ref, self::$cacheDuration); - return $ref; + $data = []; + foreach ($ref as $key => $row) { + $data[] = new TorrentGroups($row["id"]); + $data[$key]->attributes->dataTransfer = $row["dataTransfer"]; + } + + $app->cache->set($cacheKey, $data, self::$cacheDuration); + return $data; } @@ -247,7 +278,7 @@ public static function torrentSeeders(int $limit = null): ?array $cacheHit = $app->cache->get($cacheKey); if ($cacheHit) { - return $cacheHit; + #return $cacheHit; } # set limit and query extras @@ -255,8 +286,14 @@ public static function torrentSeeders(int $limit = null): ?array $query = self::$torrentQuery . "order by torrents.seeders desc limit :limit"; $ref = $app->dbNew->multi($query, ["limit" => $limit]); - $app->cache->set($cacheKey, $ref, self::$cacheDuration); - return $ref; + $data = []; + foreach ($ref as $key => $row) { + $data[] = new TorrentGroups($row["id"]); + $data[$key]->attributes->dataTransfer = $row["dataTransfer"]; + } + + $app->cache->set($cacheKey, $data, self::$cacheDuration); + return $data; } @@ -277,7 +314,7 @@ public static function torrentSnatches(int $limit = null): ?array $cacheHit = $app->cache->get($cacheKey); if ($cacheHit) { - return $cacheHit; + #return $cacheHit; } # set limit and query extras @@ -285,8 +322,14 @@ public static function torrentSnatches(int $limit = null): ?array $query = self::$torrentQuery . "order by torrents.snatched desc limit :limit"; $ref = $app->dbNew->multi($query, ["limit" => $limit]); - $app->cache->set($cacheKey, $ref, self::$cacheDuration); - return $ref; + $data = []; + foreach ($ref as $key => $row) { + $data[] = new TorrentGroups($row["id"]); + $data[$key]->attributes->dataTransfer = $row["dataTransfer"]; + } + + $app->cache->set($cacheKey, $data, self::$cacheDuration); + return $data; } @@ -307,7 +350,7 @@ public static function torrentData(int $limit = null): ?array $cacheHit = $app->cache->get($cacheKey); if ($cacheHit) { - return $cacheHit; + #return $cacheHit; } # set limit and query extras @@ -315,8 +358,14 @@ public static function torrentData(int $limit = null): ?array $query = self::$torrentQuery . "order by dataTransfer desc limit :limit"; $ref = $app->dbNew->multi($query, ["limit" => $limit]); - $app->cache->set($cacheKey, $ref, self::$cacheDuration); - return $ref; + $data = []; + foreach ($ref as $key => $row) { + $data[] = new TorrentGroups($row["id"]); + $data[$key]->attributes->dataTransfer = $row["dataTransfer"]; + } + + $app->cache->set($cacheKey, $data, self::$cacheDuration); + return $data; } diff --git a/app/TorrentForm.php b/app/TorrentForm.php deleted file mode 100644 index a011010f7..000000000 --- a/app/TorrentForm.php +++ /dev/null @@ -1,1235 +0,0 @@ -NewTorrent = $NewTorrent; - $this->Torrent = $Torrent; - $this->Error = $Error; - - $this->UploadForm = $UploadForm; - $this->Categories = $Categories; - $this->TorrentID = $TorrentID; - - # Formats - # See classes/config.php - $this->SeqFormats = $SeqFormats; - $this->ProtFormats = $ProtFormats; - $this->GraphXmlFormats = $GraphXmlFormats; - $this->GraphTxtFormats = $GraphTxtFormats; - $this->ImgFormats = $ImgFormats; - $this->MapVectorFormats = $MapVectorFormats; - $this->MapRasterFormats = $MapRasterFormats; - $this->BinDocFormats = $BinDocFormats; - $this->CpuGenFormats = $CpuGenFormats; - $this->PlainFormats = $PlainFormats; - $this->Resolutions = $Resolutions; - - # Quick constructor test - if ($this->Torrent && $this->Torrent['GroupID']) { - $this->Disabled = ' readonly="readonly"'; - $this->DisabledFlag = true; - } - } - - - /** - * ==================== - * = Twig-based class = - * ==================== - */ - - - /** - * render - * - * TorrentForm Twig wrapper. - * Hopefully more pleasant. - */ - public function render() - { - $app = \Gazelle\App::go(); - - $ENV = \Gazelle\ENV::go(); - $twig = \Gazelle\Twig::go(); - - /** - * Upload notice - */ - if ($this->NewTorrent) { - echo $twig->render('torrent_form/notice.html'); - } - - /** - * Announce and source - */ - if ($this->NewTorrent) { - $Announces = ANNOUNCE_URLS[0]; - #$Announces = call_user_func_array('array_merge', ANNOUNCE_URLS); - - $TorrentPass = $app->user->extra['torrent_pass']; - $TorrentSource = User::uploadSource(); - - echo $twig->render( - 'torrent_form/announce_source.html', - [ - 'announces' => $Announces, - 'torrent_pass' => $TorrentPass, - 'torrent_source' => $TorrentSource, - ] - ); - } - - /** - * Errors - * (Twig unjustified) - */ - if ($this->Error) { - echo << -
$this->Error
- -HTML; - } - - /** - * head - * IMPORTANT! - */ - echo $this->head(); - - /** - * upload_form - * Where the fields are. - */ - echo $this->upload_form(); - - /** - * foot - */ - echo $this->foot(); - } # End render() - - - /** - * head - * - * Everything up to the main form tag open: - *- - | - -
-
-
-
- Set the private flag, e.g.,
- |
-
-HTML;
-
- $DisabledFlag = ($this->DisabledFlag) ? ' disabled="disabled"' : '';
- $HTML .= <<
- - - | - -- | - -
- - | - -- | - -HTML; - } - } # fi !NewTorrent - - # For new torrents only - if ($this->NewTorrent) { - # Rules notice - echo << -- | '; - } - - - /** - * Submit button - */ - $Value = ($this->NewTorrent) ? 'Upload' : 'Edit'; - - echo << -- - | - -
- - | - -
- - One per field, e.g., Robert K. Mortimer [+] David Schild - -HTML; - - # If there are already creators listed - if (!empty($Torrent['Artists'])) { - foreach ($Torrent['Artists'] as $Num => $Artist) { - $ArtistName = \Gazelle\Text::esc($Artist['name']); - $AddRemoveBrackets = ($Num === 0) ?: null; - - echo << - $AddRemoveBrackets -HTML; - } - } else { - echo << - $AddRemoveBrackets -HTML; - } - - echo ' | ';
- } # fi $NewTorrent
-
-
- /**
- * Workgroup
- */
- if ($this->NewTorrent) {
- $Affiliation = \Gazelle\Text::esc($Torrent['Studio']);
-
- echo $twig->render(
- 'torrent_form/workgroup.html',
- [
- 'db' => $ENV->DB->workgroup,
- 'workgroup' => $Affiliation,
- ]
- );
- }
-
-
- /**
- * Location
- *
- * The location of the studio, lab, etc.
- * Currently not sanitized to a standard format.
- */
- if ($this->NewTorrent) {
- $TorrentLocation = \Gazelle\Text::esc($Torrent['Series']);
- echo $twig->render(
- 'torrent_form/location.html',
- [
- 'db' => $ENV->DB->location,
- 'location' => $TorrentLocation,
- ]
- );
- }
-
-
- /**
- * ============================
- * = End if NewTorrent fields =
- * ============================
- */
-
-
- /**
- * Year
- */
- $TorrentYear = \Gazelle\Text::esc($Torrent['Year']);
-
- echo $twig->render(
- 'torrent_form/year.html',
- [
- 'db' => $ENV->DB->year,
- 'year' => $TorrentYear,
- ]
- );
-
-
- /**
- * Misc meta
- *
- * Used in OT Gazelle as Codec.
- * Used in Bio Gazelle as License.
- *
- * Unsure what to call the final field.
- * Some essential, specific one-off info.
- */
- echo <<
- - - | - -
- - Please see - How to License Research Data - - |
-
-HTML;
-
-
- /**
- * ====================================
- * = Begin if NewTorrent fields again =
- * ====================================
- */
-
-
- /**
- * Media
- *
- * The class of technology associated with the data.
- * Answers the question: "Where does the data come from?"
- *
- * This could be the data genesis platform or program,
- * or a genre of physical media (e.g., vinyl record).
- */
-
-
- /**
- * Make select element
- *
- * Takes an ID, label, torrent, and media list.
- * Returns a media select option as on upload.php.
- */
- function mediaSelect($trID = '', $Label = '', $Torrent = [], $Media = [], $Desc = '')
- {
- echo <<
- - - | - -
- - The class of technology used - - |
-
- HTML;
- } # End mediaSelect()
-
-
- /**
- * Platform: Sequences
- */
- if ($this->NewTorrent) {
- mediaSelect(
- $trID = 'media_tr',
- $Label = 'Platform',
- $Torrent = $Torrent,
- $Media = $ENV->CATS->{1}->Platforms
- );
-
-
- /**
- * Platform: Graphs
- */
- mediaSelect(
- $trID = 'media_graphs_tr',
- $Label = 'Platform',
- $Torrent = $Torrent,
- $Media = $ENV->CATS->{2}->Platforms
- );
-
-
- /**
- * Platform: Scalars/Vectors
- */
- mediaSelect(
- $trID = 'media_scalars_vectors_tr',
- $Label = 'Platform',
- $Torrent = $Torrent,
- $Media = $ENV->CATS->{5}->Platforms
- );
-
-
- /**
- * Platform: Images
- */
- mediaSelect(
- $trID = 'media_images_tr',
- $Label = 'Platform',
- $Torrent = $Torrent,
- $Media = $ENV->CATS->{8}->Platforms
- );
-
-
- /**
- * Platform: Documents
- */
- mediaSelect(
- $trID = 'media_documents_tr',
- $Label = 'Platform',
- $Torrent = $Torrent,
- $Media = $ENV->CATS->{11}->Platforms
- );
-
-
- /**
- * Platform: Machine Data
- */
- mediaSelect(
- $trID = 'media_machine_data_tr',
- $Label = 'Platform',
- $Torrent = $Torrent,
- $Media = $ENV->CATS->{12}->Platforms
- );
- } # fi NewTorrent
- else {
- $TorrentMedia = $Torrent['Media'];
- echo <<
-HTML;
- }
-
-
- /**
- * Format
- *
- * Simple: the data's file format.
- * Called Container in OT Gazelle, same diff.
- * In the future, $ENV will automagically set this.
- */
- function formatSelect($trID = '', $Label = '', $Torrent = [], $FileTypes = [])
- {
- #var_dump($FileTypes);
- echo <<
- - | - -
- - File format, or detect from file list - - - |
-
-HTML;
- } # End formatSelect()
-
-
- /**
- * Format: Sequences
- */
- formatSelect(
- $trID = 'container_tr',
- $Label = 'Format',
- $Torrent = $Torrent,
- $FileTypes = $ENV->CATS->{1}->Formats
- );
-
-
- /**
- * Format: Graphs
- */
- formatSelect(
- $trID = 'container_graphs_tr',
- $Label = 'Format',
- $Torrent = $Torrent,
- #$FileTypes = array_column($ENV->META, $Formats)
- $FileTypes = $ENV->CATS->{2}->Formats
- );
-
-
- /**
- * Format: Scalars/Vectors
- */
- formatSelect(
- $trID = 'container_scalars_vectors_tr',
- $Label = 'Format',
- $Torrent = $Torrent,
- #$FileTypes = $ENV->flatten($ENV->CATS->{5}->Formats)
- $FileTypes = $ENV->CATS->{5}->Formats
- );
-
-
- /**
- * Format: Images
- */
- formatSelect(
- $trID = 'container_images_tr',
- $Label = 'Format',
- $Torrent = $Torrent,
- #$FileTypes = array_merge($this->ImgFormats)
- $FileTypes = $ENV->CATS->{8}->Formats
- );
-
-
- /**
- * Format: Spatial
- */
- formatSelect(
- $trID = 'container_spatial_tr',
- $Label = 'Format',
- $Torrent = $Torrent,
- #$FileTypes = array_merge($this->MapVectorFormats, $this->MapRasterFormats, $this->ImgFormats, $this->PlainFormats)
- $FileTypes = $ENV->CATS->{9}->Formats
- );
-
-
- /**
- * Format: Documents
- */
- formatSelect(
- $trID = 'container_documents_tr',
- $Label = 'Format',
- $Torrent = $Torrent,
- #$FileTypes = array_merge($this->BinDocFormats, $this->CpuGenFormats, $this->PlainFormats)
- $FileTypes = $ENV->CATS->{11}->Formats
- );
-
-
- /**
- * Format: Compression
- */
- formatSelect(
- $trID = 'archive_tr',
- $Label = 'Archive',
- $Torrent = $Torrent,
- # $ENV->Archives nests -1 deep
- $FileTypes = [$ENV->META->Formats->Archives]
- );
-
-
- /**
- * Scope
- *
- * How complete the data are.
- * Relatively, how much information does it contain?
- */
- $TorrentResolution = ($Torrent['Resolution']) ?? '';
- echo <<
-
- |
-
-
- - How complete the data is, specifically or conceptually - - |
-
-HTML;
-
-
- /**
- * ====================================
- * = Begin if NewTorrent fields again =
- * ====================================
- */
-
-
- /**
- * Tags
- *
- * Simple enough.
- * I won't rehash tag management.
- */
- if ($this->NewTorrent) {
- echo <<
-
- |
- -HTML; - - $GenreTags = $app->cache->get('genre_tags'); - if (!$GenreTags) { - $app->dbOld->query(" - SELECT - `Name` - FROM - `tags` - WHERE - `TagType` = 'genre' - ORDER BY - `Name` - "); - - $GenreTags = $app->dbOld->collect('Name'); - $app->cache->set('genre_tags', $GenreTags, 3600 * 6); - } - - # todo: Find a better place for these - $Disabled = ($this->DisabledFlag) ? ' disabled="disabled"' : null; - $TorrentTagList = \Gazelle\Text::esc(implode(', ', explode(',', $Torrent['TagList']))); - - echo << - -HTML; - - foreach (Misc::display_array($GenreTags) as $Genre) { - echo << - $Genre - -HTML; - } - - echo << - - | - -HTML; - } # fi NewTorrent - - - /** - * Picture - * - * Another obvious field. - */ - if ($this->NewTorrent) { - $TorrentImage = \Gazelle\Text::esc($Torrent['Image']); - $Disabled = $this->Disabled; - - echo $twig->render( - 'torrent_form/picture.html', - [ - 'db' => $ENV->DB->picture, - 'picture' => $TorrentImage, - ] - ); - } - - - /** - * Mirrors - * - * This should be in the `torrents` table not `torrents_group.` - * The intended use is for web seeds, Dat mirrors, etc. - */ - if (!$this->DisabledFlag && $this->NewTorrent) { - $TorrentMirrors = \Gazelle\Text::esc($Torrent['Mirrors']); - echo $twig->render( - 'torrent_form/mirrors.html', - [ - 'db' => $ENV->DB->mirrors, - 'mirrors' => $TorrentMirrors, - ] - ); - } - - - /** - * Samples - * - * Called Screenshots in OT Gazelle. - * Called Publication in Bio Gazelle. - * Eventually this will be a proper database in itself, - * pulling info from DOI to populate the schema. - */ - if (!$this->DisabledFlag && $this->NewTorrent) { - $TorrentSamples = \Gazelle\Text::esc($Torrent['Screenshots']); - - echo << -
- |
-
- - - - | - -HTML; - } - - - /** - * Seqhash - */ - - if ($ENV->enableBioPhp && !$this->DisabledFlag && $this->NewTorrent) { - $TorrentSeqhash = \Gazelle\Text::esc($Torrent['Seqhash']); - echo $twig->render( - 'torrent_form/seqhash.html', - [ - 'db' => $ENV->DB->seqhash, - 'seqhash' => $TorrentSeqhash, - ] - ); - } - - - /** - * Torrent group description - * - * The text on the main torrent pages, - * between torrent info and torrent comments, - * visible even if individual torrents are collapsed. - */ - if ($this->NewTorrent) { - echo << -
- |
- -HTML; - - View::textarea( - id: 'album_desc', - placeholder: "General info about the torrent subject's function or significance", - value: \Gazelle\Text::esc($Torrent['GroupDescription']) ?? '' - ); - - echo ' | '; - } # fi NewTorrent - - - /** - * ============================ - * = End if NewTorrent fields = - * ============================ - */ - - - /** - * Torrent description - * - * The test displayed when torrent info is expanded. - * It should describe the specific torrent, not the group. - */ - echo << -
- |
- -HTML; - - View::textarea( - id: 'release_desc', - placeholder: 'Specific info about the protocols and equipment used to produce the data', - value: \Gazelle\Text::esc($Torrent['TorrentDescription'] ?? ''), - ); - - echo ' | '; - - - /** - * Boolean options - * - * Simple checkboxes that do stuff. - * Currently checks for data annotations and anonymous uploads. - * More fields could be created as the need arises. - */ - - - /** - * Aligned/Annontated - * - * Called Censored in OT Gazelle. - */ - $TorrentAnnotated = ($Torrent['Censored'] ?? 0) ? ' checked' : ''; - echo << -
- |
-
- - - - Whether the torrent contains alignments, annotations, or other structural metadata - | - -HTML; - - - /** - * Upload Anonymously - */ - $TorrentAnonymous = ($Torrent['Anonymous'] ?? false) ? ' checked' : ''; - echo << -
- |
-
- - - - Hide your username from other users on the torrent details page - | - -HTML; - - # End the giant dynamic form table - echo '
"; -~d($literature); -exit; -#!d($torrentGroup->relationships->literature);exit; -#} catch (Throwable $e) { -# $app->error(404); -#} # request variables $get = Gazelle\Http::request("get"); @@ -52,12 +43,13 @@ "breadcrumbs" => [ "/torrents" => "torrents", - "/torrents/{$torrent->id}" => $torrent->attributes->infoHash, + "/torrent-groups/{$torrentGroup->id}" => $torrentGroup->attributes->title, ], "torrent" => $torrent, - "torrentGroup" => $torrentGroup, + "torrentGroup" => $torrentGroup, # for the sidebar picture + "torrentGroups" => $torrent->relationships->torrentGroups, "revisionId" => $revisionId ?? null, "isBookmarked" => Bookmarks::isBookmarked("torrent", $torrent->id), diff --git a/sections/torrents/update.php b/sections/torrents/update.php index 116a9e207..016230d95 100644 --- a/sections/torrents/update.php +++ b/sections/torrents/update.php @@ -36,7 +36,6 @@ * which are off limits to most members. */ -require_once serverRoot . '/classes/torrent_form.class.php'; if (!is_numeric($_GET['id']) || !$_GET['id']) { error(400); } diff --git a/sections/upload/upload.php b/sections/upload/upload.php index 2226a92a8..318c3e60f 100644 --- a/sections/upload/upload.php +++ b/sections/upload/upload.php @@ -3,14 +3,7 @@ declare(strict_types=1); /** - * Upload form - * - * This page relies on the TorrentForm class. - * All it does is call the necessary functions. - * - * $Properties, $Err and $UploadForm are set in takeupload.php, - * and are only used when the form doesn't validate - * and this page must be called again. + * upload form */ $app = \Gazelle\App::go(); @@ -26,8 +19,6 @@ $query = "select name from tags where tagType = ? order by name"; $tagList = $app->dbNew->column($query, ["genre"]); - - # twig template $app->twig->display("torrents/upload.twig", [ "title" => "Upload", @@ -73,25 +64,12 @@ "annotated" => null, "anonymous" => null, ], - - - ]); exit; - - - - - - - - - - View::header( 'Upload', 'upload,vendor/easymde.min', diff --git a/templates/_base/userInfo.twig b/templates/_base/userInfo.twig index 350f8096a..09ae7d0af 100644 --- a/templates/_base/userInfo.twig +++ b/templates/_base/userInfo.twig @@ -12,9 +12,7 @@ - - {{ user.extra.Uploaded|get_size }} - + {{ user.extra.Uploaded|get_size }} {# leeching #} @@ -22,9 +20,7 @@ - - {{ user.extra.Downloaded|get_size }} - + {{ user.extra.Downloaded|get_size }} {# ratio #} @@ -32,9 +28,7 @@ - - {{ ratio(user.extra.Uploaded, user.extra.Downloaded) }} - + {{ ratio(user.extra.Uploaded, user.extra.Downloaded) }} {# required ratio #} @@ -43,9 +37,7 @@ Required - - {{ user.extra.RequiredRatio|float }} - + {{ user.extra.RequiredRatio|float }} {% endif %} @@ -55,11 +47,9 @@ - - - {{ user.extra.FLTokens }} - - + + {{ user.extra.FLTokens }} + {% endif %} @@ -68,9 +58,7 @@ - - {{ user.extra.BonusPoints|number_format }} - + {{ user.extra.BonusPoints|number_format }} {# hit and runs #} @@ -79,12 +67,8 @@ - - {{ user.extra.HnR }} - + {{ user.extra.HnR }} {% endif %} - - - \ No newline at end of file + diff --git a/templates/better/list.twig b/templates/better/list.twig index 44c7be811..0c2796389 100644 --- a/templates/better/list.twig +++ b/templates/better/list.twig @@ -4,17 +4,15 @@ {% block content %}- {# lottery badges #} +{{ header }}
- -{# no torrents #} -{% if torrentGroups is empty %} -No torrents found :)
-{% endif %} - -{# torrent list #} -- {% endblock %} diff --git a/templates/bonusPoints/store.twig b/templates/bonusPoints/store.twig index 7e74cc89c..fc904cfd0 100644 --- a/templates/bonusPoints/store.twig +++ b/templates/bonusPoints/store.twig @@ -206,6 +206,7 @@{{ Torrent groups }}
-{% include("tables/torrentGroupsWithoutTorrents.twig") %} +{{ header }}
+ + {# no torrents #} + {% if torrentGroups is empty %} +No torrents found :)
+ {% else %} + {# torrent list #} + {{ include("tables/torrentGroupsWithoutTorrents.twig") }} + {% endif %}{# auction badge #} + Lottery badges
@@ -239,6 +240,7 @@
{# pyramid scheme badge #} + Auction badge
@@ -270,6 +272,7 @@
{# random badge #} + Coin badge
"It's not a pyramid, it's a triangle!" @@ -298,8 +301,10 @@ +
@@ -113,13 +75,22 @@ {# tl;dr #} {% if literature.attributes.tldr is not empty %} - Random badge
Purchase a badge whose icon is chosen at random. diff --git a/templates/collages/browse.twig b/templates/collages/browse.twig index a4f3e92ab..6a52f02f7 100644 --- a/templates/collages/browse.twig +++ b/templates/collages/browse.twig @@ -46,97 +46,8 @@ {% endif %} -{# start the results table #} -
- -{# start results table headings #} -{# todo: this can be reorganized to suck less #} - -
- -{# todo: share search #} -{# link this search #} - -{# todo: download all this page #} -{# download all this page #} - -{# back to top: lazy af #} -{# back to top #} +{# include the search results table #} +{{ include("tables/collages.twig") }} {% endblock %} diff --git a/templates/literature/details.twig b/templates/literature/details.twig index 684c7e0b4..52e352ce4 100644 --- a/templates/literature/details.twig +++ b/templates/literature/details.twig @@ -19,16 +19,6 @@ {% endif %} - {# sci-hub #} - {% if literature.attributes.doi is not empty %} -- - {# category #} - - -{# end results table headings #} - -{# start the results themselves #} - -{% for item in collages %} - -- - {# collage title #} - Collage title - - {# torrent count #} -Torrents - - {# subscriber count #} -Subscribers - - {# last update #} -Updated at - - {# author #} -User - -- - {# category #} - - - -{% endfor %} - - -{# end the results table #} -- {{ categories[item.attributes.categoryId] }} - {# =$app->env->collageCategories[(int)$CategoryID]?> #} - - -- {{ item.attributes.title }} - {# - - - Remove bookmark - - - #} - - {% if item.attributes.tags is not empty %} - - - {# torrent count #} -{{ item.attributes.tags|join(", ") }}- {% endif %} -{{ item.attributes.torrentCount }} - - {# subscriber count #} -{{ item.attributes.subscriberCount }} - - {# last update #} - {% if item.attributes.updatedAt %} -{{ item.attributes.updatedAt|relativeTime }} - {% else %} -{{ item.attributes.createdAt|relativeTime }} - {% endif %} - -{{ item.attributes.userId|formatUsername }} -- - {% endif %} - {# semanticScholarId #} {% if literature.attributes.semanticScholarId is not empty %}Sci-Hub -- {{ sciHubLink(literature.attributes.doi) }} - -@@ -70,34 +60,6 @@ {% endif %} - - - {# influentialCitationCount #} - {% if literature.attributes.influentialCitationCount is not empty %} -{{ literature.attributes.publicationDate }} - - {% endif %} - - - {# citationCount #} - {% if literature.attributes.citationCount is not empty %} -Influential citations -{{ literature.attributes.influentialCitationCount|number_format }} -- - {% endif %} - - - {# referenceCount #} - {% if literature.attributes.referenceCount is not empty %} -Citations -{{ literature.attributes.citationCount|number_format }} -- - {% endif %} -References -{{ literature.attributes.referenceCount|number_format }} -+ + +{# impact stats #} +{% endif %} + {# torrent groups #} + {% if torrentGroups is not empty %} + tl;dr by {{ literature.attributes.tldr.model }}
{{ literature.attributes.tldr.text|raw }}+ + {% endif %} + + {% if enableConversation and conversation %} {% set variables = { "conversation": conversation } %} {% include "_base/conversation.twig" with variables %} diff --git a/templates/literature/sidebar.twig b/templates/literature/sidebar.twig index 7485ddcb1..9b0fd0af6 100644 --- a/templates/literature/sidebar.twig +++ b/templates/literature/sidebar.twig @@ -9,7 +9,7 @@ {% endif %} #} - {% set uri = processImage("#{env.staticServer}/images/noartwork.webp", "thumb") %} + {% set uri = processImage("/images/noartwork.webp", "thumb") %} @@ -22,34 +22,61 @@Torrent groups
+ {{ include("tables/torrentGroupsWithoutTorrents.twig") }} +Actions
++ + {# creators #}Impact stats
+ ++ {# influentialCitationCount #} + {% if literature.attributes.influentialCitationCount is not empty %} +
+ + {% endif %} + + + {# citationCount #} + {% if literature.attributes.citationCount is not empty %} +Influential citations +{{ literature.attributes.influentialCitationCount|number_format }} ++ + {% endif %} + + + {# referenceCount #} + {% if literature.attributes.referenceCount is not empty %} +Citations +{{ literature.attributes.citationCount|number_format }} ++ + {% endif %} +References +{{ literature.attributes.referenceCount|number_format }} +- Creators
-edit -diff --git a/templates/tables/collages.twig b/templates/tables/collages.twig new file mode 100644 index 000000000..39ceed5b0 --- /dev/null +++ b/templates/tables/collages.twig @@ -0,0 +1,66 @@ +{# + # collages table + #} + +
+ +
diff --git a/templates/tables/literature.twig b/templates/tables/literature.twig index 11a23e965..e50c352d7 100644 --- a/templates/tables/literature.twig +++ b/templates/tables/literature.twig @@ -2,39 +2,10 @@ # literature table #} -{#107 'userId' => integer 2 - 'doi' => string (22) "10.1074/JBC.M211914200" - 'semanticScholarId' => string (40) "fd29d55bea8295907d3d62af7725361436bcf58e" - 'title' => string (94) "The Catabolism of Amino Acids to Long Chain and Complex Alcohols in Saccharomyces cerevisiae *" - 'venue' => string (31) "Journal of Biological Chemistry" - 'journal' => stdClass (3) ( - public 'name' -> string (35) "The Journal of Biological Chemistry" - public 'pages' -> string (11) "8028 - 8034" - public 'volume' -> string (3) "278" - ) - 'year' => integer 2003 - 'publicationDate' => string (10) "2003-03-07" - 'abstract' => string (1122) "The catabolism of phenylalanine to 2-phenylethanol and of tryptophan to tryptophol were studied by13C NMR spectroscopy and gas chromatography-mass spectrometry. Phenylalanine and tryptophan are first deaminated (to 3-phenylpyruvate and 3-indolepyruvate, respectively) and then decarboxylated. This decarboxylation can be effected by any of Pdc1p, Pdc5p, Pdc6p, or Ydr380wp; Ydl080cp has no role in the catabolism of either amino acid. We also report that in leucine catabolism Ydr380wp is the minor decarboxylase. Hence, all amino acid catabolic pathways studied to date use a subtly different spectrum of decarboxylases from the five-membered family that comprises Pdc1p, Pdc5p, Pdc6p, Ydl080cp, and Ydr380wp. Using strains containing all possible combinations of mutations affecting the seven AAD genes (putativearyl alcohol dehydrogenases), fiveADH genes, and SFA1, showed that the final step of amino acid catabolism (conversion of an aldehyde to a long chain or complex alcohol) can be accomplished by any one of the ethanol dehydrogenases (Adh1p, Adh2p, Adh3p, Adh4p, Adh5p) or by Sfa1p (formaldehyde dehydrogenase.)" - 'tldr' => stdClass (2) ( - public 'model' -> string (11) "tldr@v2.0.0" - public 'text' -> string (279) "Using strains containing all possible combinations of mutations affecting the seven AAD genes, fiveADH genes, and SFA1, it is shown that the final step of amino acid catabolism can be accomplished by any one of the ethanol dehydrogenases or by Sfa1p (formaldehyde dehydrogenase.)" - ) - 'bibtex' => null - 'influentialCitationCount' => integer 10 - 'citationCount' => integer 323 - 'referenceCount' => integer 28 - 'isOpenAccess' => boolean true - 'openAccessPdf' => null - 'failCount' => null - 'createdAt' => string (19) "2023-05-12 02:30:32" - 'updatedAt' => string (19) "2024-05-29 18:07:53" - 'deletedAt' => null - 'isOwner' => boolean false - #}+ {# category #} + + + + + {% for item in collages %} ++ + {# collage title #} + Title + + {# torrent count #} +Torrents + + {# subscriber count #} +Subscribers + + {# last update #} +Updated at + + {# author #} +User ++ {# category #} + + {% endfor %} + ++ {{ env.collageCategories[item.attributes.categoryId] }} + + ++ {# title #} + + + {# torrent count #} ++ {{ item.attributes.title }} +
+ + {# tags #} + {% if item.attributes.tags is not empty %} +{{ item.attributes.tags|join(", ") }}+ {% endif %} +{{ item.attributes.torrentCount|number_format }} + + {# subscriber count #} +{{ item.attributes.subscriberCount|number_format }} + + {# last update #} + {% if item.attributes.updatedAt is not empty %} +{{ item.attributes.updatedAt|relativeTime }} + {% else %} +{{ item.attributes.createdAt|relativeTime }} + {% endif %} + + {# collage owner #} +{{ item.attributes.userId|formatUsername }} +{# literature info #} -
Literature info +Info @@ -42,15 +13,19 @@ {% for item in literature %}{# title #} - @@ -107,48 +107,53 @@ {% for torrent in torrentGroup.relationships.torrents %}- {# title #} -- +{# title link #} + - diff --git a/templates/tables/torrentGroupsWithTorrents.twig b/templates/tables/torrentGroupsWithTorrents.twig index d028f4708..846854278 100644 --- a/templates/tables/torrentGroupsWithTorrents.twig +++ b/templates/tables/torrentGroupsWithTorrents.twig @@ -10,7 +10,7 @@++ {# creators #} {# @@ -81,7 +61,7 @@ {# tl;dr: no tooltip #} {% if item.attributes.tldr is not empty %} -{# doi #} {% if item.attributes.doi is not empty %} {{ item.attributes.doi }} @@ -58,7 +33,7 @@ {# journal #} {% if item.attributes.journal is not empty %} - {{ item.attributes.journal.name }} + {{ item.attributes.journal.name }} {% endif %} {# publicationDate #} @@ -66,11 +41,16 @@ {{ item.attributes.publicationDate }} {% endif %} + {# influentialCitationCount #} + {% if item.attributes.influentialCitationCount is not empty %} + {{ item.attributes.influentialCitationCount|number_format }} + {% endif %} + {# sci-hub #} {% if item.attributes.doi is not empty %} Sci-Hub {% endif %} -
{{ item.attributes.tldr.text }}
+{{ item.attributes.tldr.text }}
{% endif %}{# torrent info #} - Torrent info +Info {# timeAdded #}Time added @@ -43,8 +43,8 @@- ++ {# title link #} {{ torrentGroup.attributes.title|raw }} +
-++ {# tags #} {% if torrentGroup.attributes.tags is not empty %} -{# subject #} {% if torrentGroup.attributes.subject is not empty %} {{ "#{torrentGroup.attributes.subject}"|raw }} @@ -85,11 +86,11 @@ {% if torrentGroup.attributes.location is not empty %} {{ torrentGroup.attributes.location|raw }} {% endif %} -
{{ torrentGroup.attributes.tags|slice(0, 5)|join(", ") }}+{{ torrentGroup.attributes.tags|slice(0, 5)|join(", ") }}
{% endif %} {# creators #} @@ -98,7 +99,6 @@{{ displayCreators(torrentGroup.attributes.Artists)|raw }}{% endif %} #} -{# category icon #} - @@ -23,9 +23,8 @@ {# title #} -- Go » - +{# title #} - - {# platform #} - {% if torrent.attributes.platform is not empty %} - {{ torrent.attributes.platform }} - {% endif %} - - {# format #} - {% if torrent.attributes.format is not empty %} - {{ torrent.attributes.format }} - {% endif %} - - {# version #} - {% if torrent.attributes.version is not empty %} - {{ torrent.attributes.version }} - {% endif %} - - {# scope #} - {% if torrent.attributes.scope is not empty %} - {{ torrent.attributes.scope }} - {% endif %} - - {# archive #} - {% if torrent.attributes.archive is not empty %} - {{ torrent.attributes.archive }} - {% endif %} - - {# license #} - {% if torrent.attributes.license is not empty %} - {{ torrent.attributes.license }} - {% endif %} - - {# isAnnotated #} - {% if torrent.attributes.isAnnotated is not empty %} - Aligned - {% else %} - Not aligned - {% endif %} + + {# createdAt #} diff --git a/templates/tables/torrentGroupsWithoutTorrents.twig b/templates/tables/torrentGroupsWithoutTorrents.twig index 34de92297..bdb1a12f4 100644 --- a/templates/tables/torrentGroupsWithoutTorrents.twig +++ b/templates/tables/torrentGroupsWithoutTorrents.twig @@ -10,7 +10,7 @@+ {# title link #} + {{ torrent.attributes.infoHash }} +
+ ++ {# platform #} + {% if torrent.attributes.platform is not empty %} + {{ torrent.attributes.platform }} + {% endif %} + + {# format #} + {% if torrent.attributes.format is not empty %} + {{ torrent.attributes.format }} + {% endif %} + + {# version #} + {% if torrent.attributes.version is not empty %} + {{ torrent.attributes.version }} + {% endif %} + + {# scope #} + {% if torrent.attributes.scope is not empty %} + {{ torrent.attributes.scope }} + {% endif %} + + {# archive #} + {% if torrent.attributes.archive is not empty %} + {{ torrent.attributes.archive }} + {% endif %} + + {# license #} + {% if torrent.attributes.license is not empty %} + {{ torrent.attributes.license }} + {% endif %} + + {# isAnnotated #} + {% if torrent.attributes.isAnnotated is not empty %} + Aligned + {% else %} + Not aligned + {% endif %} +
{# torrent info #} - Torrent info +Info - - ++ {% endfor %} diff --git a/templates/tables/torrents.twig b/templates/tables/torrents.twig new file mode 100644 index 000000000..c36f45f56 --- /dev/null +++ b/templates/tables/torrents.twig @@ -0,0 +1,121 @@ +{# + # torrents table + #} + +{# title link #} {{ torrentGroup.attributes.title|raw }} +
-- {# subject #} - {% if torrentGroup.attributes.subject is not empty %} - {{ "#{torrentGroup.attributes.subject}"|raw }} - {# object #} - {{ (torrentGroup.attributes.object is not empty) ? torrentGroup.attributes.object : "" }} - - {% endif %} ++ {# location #} + {% if torrentGroup.attributes.location is not empty %} + {{ torrentGroup.attributes.location|raw }} + {% endif %} + - {# tags #} - {% if torrentGroup.attributes.tags is not empty %} -+ {# subject #} + {% if torrentGroup.attributes.subject is not empty %} + {{ "#{torrentGroup.attributes.subject}"|raw }} + {# object #} + {{ (torrentGroup.attributes.object is not empty) ? torrentGroup.attributes.object : "" }} + + {% endif %} - {# year #} - {% if torrentGroup.attributes.year is not empty %} - {{ torrentGroup.attributes.year }} - {% endif %} + {# year #} + {% if torrentGroup.attributes.year is not empty %} + {{ torrentGroup.attributes.year }} + {% endif %} - {# identifier #} - {% if torrentGroup.attributes.identifier is not empty %} - {{ torrentGroup.attributes.identifier }} - {% endif %} + {# identifier #} + {% if torrentGroup.attributes.identifier is not empty %} + {{ torrentGroup.attributes.identifier }} + {% endif %} - {# workgroup #} - {% if torrentGroup.attributes.workgroup is not empty %} - {{ torrentGroup.attributes.workgroup|raw }} - {% endif %} + {# workgroup #} + {% if torrentGroup.attributes.workgroup is not empty %} + {{ torrentGroup.attributes.workgroup|raw }} + {% endif %} - {# location #} - {% if torrentGroup.attributes.location is not empty %} - {{ torrentGroup.attributes.location|raw }} - {% endif %} -
{{ torrentGroup.attributes.tags|slice(0, 5)|join(", ") }}- {% endif %} + {# tags #} + {% if torrentGroup.attributes.tags is not empty %} +{{ torrentGroup.attributes.tags|slice(0, 5)|join(", ") }}
+ {% endif %} - {# creators #} - {# - {% if torrentGroup.attributes.Artists is not empty %} -{{ displayCreators(torrentGroup.attributes.Artists)|raw }}- {% endif %} - #} - + {# creators #} + {# + {% if torrentGroup.attributes.Artists is not empty %} +{{ displayCreators(torrentGroup.attributes.Artists)|raw }}+ {% endif %} + #}+ +
diff --git a/templates/top10/torrents.twig b/templates/top10/torrents.twig index 4cbf19e3f..76df34b4a 100644 --- a/templates/top10/torrents.twig +++ b/templates/top10/torrents.twig @@ -8,17 +8,7 @@ {% if dailyTorrents is not empty %}+ {# torrent info #} + + + + + {% for torrent in torrents %} +Info + + {# timeAdded #} +Time added + + {# data size #} +Data size + + {# seeders #} +↑ + + {# leechers #} +↓ + + {# snatches #} +↻ ++ {# title #} + + {% endfor %} + ++ + + {# createdAt #} ++ {# title link #} + {{ torrent.attributes.infoHash }} +
+ ++ {# platform #} + {% if torrent.attributes.platform is not empty %} + {{ torrent.attributes.platform }} + {% endif %} + + {# format #} + {% if torrent.attributes.format is not empty %} + {{ torrent.attributes.format }} + {% endif %} + + {# version #} + {% if torrent.attributes.version is not empty %} + {{ torrent.attributes.version }} + {% endif %} + + {# scope #} + {% if torrent.attributes.scope is not empty %} + {{ torrent.attributes.scope }} + {% endif %} + + {# archive #} + {% if torrent.attributes.archive is not empty %} + {{ torrent.attributes.archive }} + {% endif %} + + {# license #} + {% if torrent.attributes.license is not empty %} + {{ torrent.attributes.license }} + {% endif %} + + {# isAnnotated #} + {% if torrent.attributes.isAnnotated is not empty %} + Aligned + {% else %} + Not aligned + {% endif %} +
+ + {# download, freeleech, etc. #} + {% if withActions is defined and withActions == true %} ++ {# download #} + download + + {# freeleech token #} + {% if canUseToken(torrent.id) %} + freeleech + {% endif %} + + {# report #} + report +
+ {% endif %} ++ {{ torrent.attributes.createdAt|relativeTime }} + + + {# dataSize #} ++ {{ torrent.attributes.dataSize|get_size }} + + + {# seederCount #} ++ {{ torrent.attributes.seederCount|number_format }} + + + {# leecherCount #} ++ {{ torrent.attributes.leecherCount|number_format }} + + + {# snatchCount #} ++ {{ torrent.attributes.snatchCount|number_format }} + +{% endif %} @@ -26,17 +16,7 @@ {% if weeklyTorrents is not empty %} {{ limit }} most active daily uploads
- -- - - {% for group in dailyTorrents %} - - {% include "torrents/tableEntryForObjects.twig" with group %} - - {% endfor %} - -
+ {{ include("tables/torrentGroupsWithoutTorrents.twig", {"torrentGroups": dailyTorrents}) }}{% endif %} @@ -44,17 +24,7 @@ {% if monthlyTorrents is not empty %} {{ limit }} most active weekly uploads
- -- - - {% for group in weeklyTorrents %} - - {% include "torrents/tableEntryForObjects.twig" with group %} - - {% endfor %} - -
+ {{ include("tables/torrentGroupsWithoutTorrents.twig", {"torrentGroups": weeklyTorrents}) }}{% endif %} @@ -62,17 +32,7 @@ {% if yearlyTorrents is not empty %} {{ limit }} most active monthly uploads
- -- - - {% for group in monthlyTorrents %} - - {% include "torrents/tableEntryForObjects.twig" with group %} - - {% endfor %} - -
+ {{ include("tables/torrentGroupsWithoutTorrents.twig", {"torrentGroups": monthlyTorrents}) }}{% endif %} @@ -80,17 +40,7 @@ {% if overallTorrents is not empty %} {{ limit }} most active yearly uploads
- -- - - {% for group in yearlyTorrents %} - - {% include "torrents/tableEntryForObjects.twig" with group %} - - {% endfor %} - -
+ {{ include("tables/torrentGroupsWithoutTorrents.twig", {"torrentGroups": yearlyTorrents}) }}{% endif %} @@ -98,17 +48,7 @@ {% if torrentSeeders is not empty %} {{ limit }} most active overall uploads
- -- - - {% for group in overallTorrents %} - - {% include "torrents/tableEntryForObjects.twig" with group %} - - {% endfor %} - -
+ {{ include("tables/torrentGroupsWithoutTorrents.twig", {"torrentGroups": overallTorrents}) }}{% endif %} @@ -116,17 +56,7 @@ {% if torrentSnatches is not empty %} {{ limit }} best seeded torrents
- -- - - {% for group in torrentSeeders %} - - {% include "torrents/tableEntryForObjects.twig" with group %} - - {% endfor %} - -
+ {{ include("tables/torrentGroupsWithoutTorrents.twig", {"torrentGroups": torrentSeeders}) }}{% endif %} @@ -134,17 +64,7 @@ {% if torrentData is not empty %} {{ limit }} most snatched torrents
- -- - - {% for group in torrentSnatches %} - - {% include "torrents/tableEntryForObjects.twig" with group %} - - {% endfor %} - -
+ {{ include("tables/torrentGroupsWithoutTorrents.twig", {"torrentGroups": torrentSnatches}) }}{% endif %} diff --git a/templates/torrentGroups/details.twig b/templates/torrentGroups/details.twig index 50a4fce33..a385ac362 100644 --- a/templates/torrentGroups/details.twig +++ b/templates/torrentGroups/details.twig @@ -9,7 +9,7 @@ {{ limit }} most transferred torrents
- -- - - {% for group in torrentData %} - - {% include "torrents/tableEntryForObjects.twig" with group %} - - {% endfor %} - -
+ {{ include("tables/torrentGroupsWithoutTorrents.twig", {"torrentGroups": torrentData}) }}{# organism #} - {% if torrentGroup.attributes.subject %} + {% if torrentGroup.attributes.subject is not empty %}
{# description #} + {% if torrentGroup.attributes.description is not empty %}+ {% endif %} {# year #} - {% if torrentGroup.attributes.year %} + {% if torrentGroup.attributes.year is not empty %} Organism @@ -19,31 +19,21 @@ {# object #} {{ (torrentGroup.attributes.object) ? torrentGroup.attributes.object : "" }} - -- Search » - -+ {% endif %} {# identifier #} - {% if torrentGroup.attributes.identifier %} + {% if torrentGroup.attributes.identifier is not empty %} Year -{{ torrentGroup.attributes.year }} - -- Search » - -Identifier -{{ torrentGroup.attributes.identifier }} @@ -51,44 +41,36 @@ {% endif %} {# workgroup #} - {% if torrentGroup.attributes.workgroup %} + {% if torrentGroup.attributes.workgroup is not empty %} + {% endif %} {# location #} - {% if torrentGroup.attributes.location %} + {% if torrentGroup.attributes.location is not empty %} Workgroup -{{ torrentGroup.attributes.workgroup|raw }} - -- Search » - -+ {% endif %} Location -{{ torrentGroup.attributes.location|raw }} - -- Search » - -+ {% endif %} {# openai #} {% if torrentGroup.attributes.openai is not empty and user.siteOptions.openaiContent %} - Description
- {{ torrentGroup.attributes.description|raw }} + {{ torrentGroup.attributes.description|parse }}+ @@ -96,256 +78,31 @@ {# torrent list #} - tl;dr by {{ torrentGroup.attributes.openai.model }}
{{ torrentGroup.attributes.openai.text }}+ {% if torrentGroup.relationships.torrents is not empty %} + {# literature #} + {% if torrentGroup.relationships.literature is not empty %} Torrents
- - {# individual torrents #} -{% for item in torrentGroup.relationships.torrents %} - -- -
-{% endfor %} - -- - {# permalink #} - - - -- - {# torrent info #} - Torrent info - - {# timeAdded #} -Time added - - {# data size #} -Data size - - {# seeders #} -↑ - - {# leechers #} -↓ - - {# snatches #} -↻ - -- -{# permalink #} - - -{# second row: buttons #} --🔗 - - - {# title #} -- - {# platform #} - {% if item.attributes.platform %} - 📦 {{ item.attributes.platform }} - {% endif %} - - {# format #} - {% if item.attributes.format %} - 💾 {{ item.attributes.format }} - {% endif %} - - {# version #} - {% if item.attributes.version %} - {{ item.attributes.version }} - {% endif %} - - {# scope #} - {% if item.attributes.scope %} - 🔎 {{ item.attributes.scope }} - {% endif %} - - {# archive #} - {% if item.attributes.archive %} - {{ item.attributes.archive }} + {{ include("tables/torrents.twig", {"withActions": true}) }} + {% endif %} - {# license #} - {% if item.attributes.license %} - 📜 {{ item.attributes.license }} - {% endif %} - {# alignment #} - {% if item.attributes.isAnnotated %} - Aligned - {% else %} - Not aligned + {# collages #} + {% if torrentGroup.relationships.collages is not empty %} + - - {# createdAt #} -+ {% endif %} -Collages
+ {{ include("tables/collages.twig") }} +- {{ item.attributes.createdAt|relativeTime }} - - - - {# dataSize #} -- {{ item.attributes.dataSize|get_size }} - - - {# seederCount #} -- {{ item.attributes.seederCount|number_format }} - - - - {# leecherCount #} -- {{ item.attributes.leecherCount|number_format }} - - - - {# snatchCount #} -- {{ item.attributes.snatchCount|number_format }} - -- -{# controls #} - - -{# third row:description #} -{% if item.attributes.description is not empty %} -- - --{# download #} -download - -{# freeleech token #} -{% if canUseToken(item.id) %} -freeleech -{% endif %} - -{# update #} -{% if can({"torrents": "updateAny"}) or item.attributes.userId == user.core.id %} -update -{% endif %} - -{# report #} -report - -{# delete #} -{% if can({"torrents": "deleteAny"}) or item.UserID == user.core.id %} -delete -{% endif %} --- -{# description #} - - - -{# citation #} -- -{% endif %} -Description
-{{ item.attributes.description }} -- - - -{#} - if (!empty($Description)) { - echo '- - - - -Cite this dataset
-biblatex - - -{## - # https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management#biblatex - # https://ctan.math.washington.edu/tex-archive/macros/latex/contrib/biblatex/doc/biblatex.pdf - # - # @misc{ enwiki:1116502991, - # author = "{Wikipedia contributors}", - # title = "Biber (LaTeX) --- {Wikipedia}{,} The Free Encyclopedia", - # year = "2022", - # howpublished = "\url{https://en.wikipedia.org/w/index.php?title=Biber_(LaTeX)&oldid=1116502991}", - # note = "[Online; accessed 10-January-2023]" - # } - # - # important: the weird indentation below is absolutely necessary due to the textarea - #} - - -'.\Gazelle\Text::parse($Description).''; - } - - echo "\n"; ?> -- + {% endif %} {% if enableConversation and conversation %} diff --git a/templates/torrentGroups/sidebar.twig b/templates/torrentGroups/sidebar.twig index 037fc6b9c..a1aa78837 100644 --- a/templates/torrentGroups/sidebar.twig +++ b/templates/torrentGroups/sidebar.twig @@ -1,10 +1,10 @@ {# cover art #} Literature
{{ include("tables/literature.twig") }}- {% if user.siteOptions.coverArtTorrents %} + {% if torrentGroup.attributes.picture is not empty and user.siteOptions.coverArtTorrents == true %} {% set uri = processImage(torrentGroup.attributes.picture, "thumb") %} {% else %} - {% set uri = processImage("#{env.staticServer}/images/noartwork.webp", "thumb") %} + {% set uri = processImage("/images/noartwork.webp", "thumb") %} {% endif %} diff --git a/templates/torrent_form/announce_source.html b/templates/torrent_form/announce_source.html deleted file mode 100644 index 2c020605d..000000000 --- a/templates/torrent_form/announce_source.html +++ /dev/null @@ -1,25 +0,0 @@ - diff --git a/templates/torrent_form/identifier.html b/templates/torrent_form/identifier.html deleted file mode 100644 index 87a6bdcad..000000000 --- a/templates/torrent_form/identifier.html +++ /dev/null @@ -1,23 +0,0 @@ -- diff --git a/templates/torrent_form/location.html b/templates/torrent_form/location.html deleted file mode 100644 index 62b7f8d19..000000000 --- a/templates/torrent_form/location.html +++ /dev/null @@ -1,16 +0,0 @@ -- - -{{ db.name }} -- - - - -- diff --git a/templates/torrent_form/mirrors.html b/templates/torrent_form/mirrors.html deleted file mode 100644 index 55753394c..000000000 --- a/templates/torrent_form/mirrors.html +++ /dev/null @@ -1,14 +0,0 @@ -- - -{{ db.name }} -- - -- diff --git a/templates/torrent_form/notice.html b/templates/torrent_form/notice.html deleted file mode 100644 index 03d9a2fb5..000000000 --- a/templates/torrent_form/notice.html +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/templates/torrent_form/picture.html b/templates/torrent_form/picture.html deleted file mode 100644 index b00b94113..000000000 --- a/templates/torrent_form/picture.html +++ /dev/null @@ -1,16 +0,0 @@ -- - -{{ db.name }} -- - -- diff --git a/templates/torrent_form/seqhash.html b/templates/torrent_form/seqhash.html deleted file mode 100644 index 8c3cd0af9..000000000 --- a/templates/torrent_form/seqhash.html +++ /dev/null @@ -1,54 +0,0 @@ -- - -{{db.name }} -- - -- diff --git a/templates/torrent_form/titles.html b/templates/torrent_form/titles.html deleted file mode 100644 index 3aef3225d..000000000 --- a/templates/torrent_form/titles.html +++ /dev/null @@ -1,50 +0,0 @@ -- - -{{ db.name }} - {# -
- + - − - #} -- - - DNA - {# -DNA #} - - - - RNA - {#RNA #} - - - - Protein - {#Protein #} - -
- - Linear - {#Linear #} - - - - Circular - {#Circular #} - -
- - Double-Stranded - {#Double-Stranded #} - - - - Single-Stranded - {#Single-Stranded #} - -{{ db.note|raw }}
-- - -- - -{{ db.title.name }} -- - -- - -- - -{{ db.subject.name }} -- - -- diff --git a/templates/torrent_form/version.html b/templates/torrent_form/version.html deleted file mode 100644 index 0fd8f8e5a..000000000 --- a/templates/torrent_form/version.html +++ /dev/null @@ -1,19 +0,0 @@ -- - -{{ db.object.name }} -- - -- diff --git a/templates/torrent_form/workgroup.html b/templates/torrent_form/workgroup.html deleted file mode 100644 index 0bc851ab0..000000000 --- a/templates/torrent_form/workgroup.html +++ /dev/null @@ -1,16 +0,0 @@ -- - -{{ db.name }} -- - - -{{ db.note|raw }}
-- diff --git a/templates/torrent_form/year.html b/templates/torrent_form/year.html deleted file mode 100644 index c943f5dee..000000000 --- a/templates/torrent_form/year.html +++ /dev/null @@ -1,17 +0,0 @@ -- - -{{ db.name }} -- - -- diff --git a/templates/torrents/browse.twig b/templates/torrents/browse.twig index 6ae0cb52c..0b5ff0d84 100644 --- a/templates/torrents/browse.twig +++ b/templates/torrents/browse.twig @@ -3,7 +3,7 @@ {% block content %} {# include the main search form #} -{% include "torrents/search.twig" %} +{{ include("torrents/search.twig") }} {# no results message #} {% if pagination.resultCount == 0 %} @@ -47,92 +47,11 @@ {# start the results table #} -- - -{{ db.name }} -- - -- -{# start results table headings #} -{# todo: this can be reorganized to suck less #} - -
- -{# todo: share search #} -{# link this search #} - -{# todo: download all this page #} -{# download all this page #} - -{# back to top: lazy af #} -{# back to top #} +{{ include("tables/torrentGroupsWithTorrents.twig") }} {% endblock %} - - - - - - - - - - - - {#} foreach ($Results as $Key => $GroupID) { {% set groupInfo = resultGroups.key %} diff --git a/templates/torrents/details.twig b/templates/torrents/details.twig index 554c79560..b24fb5d14 100644 --- a/templates/torrents/details.twig +++ b/templates/torrents/details.twig @@ -2,124 +2,111 @@ {% block content %} -- - {# grouped #} - {# - -{# end results table headings #} - -{# start the results themselves #} - -{% for group in torrentGroups %} - -{% include "torrents/tableEntryForObjects.twig" with group %} - -{% endfor %} - -{# end the results themselves #} - -{# end the results table #} -#} - - {# - {% if searchTerms.groupResults %} - - {% endif %} - #} - - {# category icon #} - - - {# torrent info #} - Torrent info - - {# timeAdded #} -Time added - - {# data size #} -Data size - - {# file count #} - {# -File count - #} - - {# seeders #} -↑ - {#Seeders ↑ #} - - {# leechers #} -↓ - {#Leechers ↓ #} - - {# snatches #} -↻ - {#Snatches ↻ #} - -{{ torrent.attributes.infoHash }}
+{{ torrent.attributes.infoHash }}
{# essential details table #}+ {# description #} + {% if torrent.attributes.description is not empty %} {# platform #} - {% if torrent.attributes.platform %} + {% if torrent.attributes.platform is not empty %}
+ {% endif %} {# format #} - {% if torrent.attributes.format %} + {% if torrent.attributes.format is not empty %} Platform -{{ torrent.attributes.platform }} - -- Search » - -+ {% endif %} {# license #} - {% if torrent.attributes.license %} + {% if torrent.attributes.license is not empty %} Format -{{ torrent.attributes.format }} - -- Search » - -{% endif %} {# scope #} - {% if torrent.attributes.scope %} + {% if torrent.attributes.scope is not empty %} License -{{ torrent.attributes.license }} - -+ {% endif %} {# version #} - {% if torrent.attributes.version %} + {% if torrent.attributes.version is not empty %} Scope -{{ torrent.attributes.scope }} - -- Search » - -- + {% endif %}version - +Version {{ torrent.attributes.version }} - -- Search » - -+ {% endif %} - {# fileList #} - Description
- {{ torrent.attributes.description|raw }}- - - {# torrentGroup #} + {# torrentGroup #}File list
- -- {% for file in torrent.attributes.fileList %} - - {% endfor %} - -{# --
-#} - -- - - {% for file in torrent.attributes.fileList %} -File name -Size -- - {% endfor %} -{{ file.name }} -{{ file.size|get_size }} -+ {# citation #} + Torrent group
- - {{ include("torrents/tableEntryForObjects.twig", {group: torrentGroup}) }} - - - + {{ include("tables/torrentGroupsWithTorrents.twig") }}+ + {% if enableConversation and conversation %} {% set variables = { "conversation": conversation } %} diff --git a/templates/torrents/sidebar.twig b/templates/torrents/sidebar.twig index 0e8edac72..fa3c6be1a 100644 --- a/templates/torrents/sidebar.twig +++ b/templates/torrents/sidebar.twig @@ -46,38 +46,38 @@ {# tracker #}Cite this dataset
+ +{## + # https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management#biblatex + # https://ctan.math.washington.edu/tex-archive/macros/latex/contrib/biblatex/doc/biblatex.pdf + # + # @misc{ enwiki:1116502991, + # author = "{Wikipedia contributors}", + # title = "Biber (LaTeX) --- {Wikipedia}{,} The Free Encyclopedia", + # year = "2022", + # howpublished = "\url{https://en.wikipedia.org/w/index.php?title=Biber_(LaTeX)&oldid=1116502991}", + # note = "[Online; accessed 10-January-2023]" + # } + # + # important: the weird indentation below is absolutely necessary due to the textarea + #} + + +- + {# fileList #} + {% if torrent.attributes.fileList is not empty %} +Tracker
+Tracker data
{# fileCount #}
@@ -85,4 +85,18 @@- {# dataSize #}fileCount -{{ torrent.attributes.fileCount }} +File count +{{ torrent.attributes.fileCount|number_format }} - {# leecherCount #}dataSize -{{ torrent.attributes.dataSize }} +Data size +{{ torrent.attributes.dataSize|get_size }} - {# seederCount #}leecherCount -{{ torrent.attributes.leecherCount }} +Leechers +{{ torrent.attributes.leecherCount|number_format }} - {# lastAction #}seederCount -{{ torrent.attributes.seederCount }} +Seeders +{{ torrent.attributes.seederCount|number_format }} - fileCount -{{ torrent.attributes.lastAction }} +Last action +{{ torrent.attributes.lastAction|relativeTime }} + +File list
+ ++ {% for file in torrent.attributes.fileList %} + + {% endfor %} + + {% endif %} + +