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: - *
- * Kept as an HTML function because it's simpler. - */ - private function head() - { - $app = \Gazelle\App::go(); - - $ENV = \Gazelle\ENV::go(); - $app->dbOld->query( - " - SELECT - COUNT(`ID`) - FROM - `torrents` - WHERE - `UserID` = " . $app->user->core["id"] - ); - list($Uploads) = $app->dbOld->next_record(); - - # Torrent form hidden values - $AuthKey = $app->user->extra['AuthKey']; - $HTML = << - - - -HTML; - - if (!$this->NewTorrent) { - # Edit form hidden fields - $TorrentID = \Gazelle\Text::esc($this->TorrentID); - $CategoryID = \Gazelle\Text::esc($this->Torrent['CategoryID'] - 1); - - $HTML .= << - - -HTML; - } # fi !NewTorrent - else { - # Torrent upload hidden fields - if ($this->Torrent && $this->Torrent['GroupID']) { - $GroupID = \Gazelle\Text::esc($this->Torrent['GroupID']); - $CategoryID = \Gazelle\Text::esc($this->Torrent['CategoryID'] - 1); - - $HTML .= << - -HTML; - } - - # Request hidden fields (new or edit?) - if ($this->Torrent && ($this->Torrent['RequestID'] ?? false)) { - $RequestID = \Gazelle\Text::esc($this->Torrent['RequestID']); - $HTML .= << -HTML; - } - } # else - - /** - * Start printing the torrent form - */ - $HTML .= ''; - - /** - * New torrent options: - * file and category - */ - if ($this->NewTorrent) { - $HTML .= '

Basic Info

'; - $HTML .= << - - - - -HTML; - - $DisabledFlag = ($this->DisabledFlag) ? ' disabled="disabled"' : ''; - $HTML .= << - - - - -
- - - - -

- Set the private flag, e.g., - mktorrent -p -a <announce> <target folder> -

-
- - -
-HTML; - } # fi NewTorrent - - # Start the dynamic form - $HTML .= '
'; - return $HTML; - } # End head() - - - /** - * foot - * - * Make the endmatter. - */ - private function foot() - { - $Torrent = $this->Torrent; - echo ' "freeleechTorrents"])) { - echo << - - - - -HTML; - } - } # fi !NewTorrent - - # For new torrents only - if ($this->NewTorrent) { - # Rules notice - echo << - '; - } - - - /** - * Submit button - */ - $Value = ($this->NewTorrent) ? 'Upload' : 'Edit'; - - echo << - - -
- - - -HTML; - - /** - * Freeleech reasons - */ - $FL = array('N/A', 'Staff Pick', 'Perma-FL', 'Freeleechizer', 'Site-Wide FL'); - foreach ($FL as $Key => $Name) { - $Selected = ($Key === $Torrent['FreeLeechType']) ? ' selected="selected"' : ''; - echo << - $Name - -HTML; - } - - echo << -
-
- -
- -
-HTML; - } # End foot() - - - /** - * upload_form - * - * Finally the "real" upload form. - * Contains all the fields you'd expect. - * - * This is currently one enormous function. - * It has sub-functions, variables, and everything. - * It continues to the end of the class. - */ - public function upload_form() - { - $app = \Gazelle\App::go(); - - $ENV = \Gazelle\ENV::go(); - $twig = \Gazelle\Twig::go(); - - $QueryID = $app->dbOld->get_query_id(); - $Torrent = $this->Torrent; - - # Start printing the form - echo '

Torrent Form

'; - echo ''; - - - /** - * Accession Number - */ - $CatalogueNumber = \Gazelle\Text::esc($Torrent['CatalogueNumber']); - $Disabled = $this->Disabled; - - echo $twig->render( - 'torrent_form/identifier.html', - [ - 'db' => $ENV->DB->identifier, - 'identifier' => $CatalogueNumber, - ] - ); - - - /** - * Version - */ - - $Version = \Gazelle\Text::esc($Torrent['Version']); - - echo $twig->render( - 'torrent_form/version.html', - [ - 'db' => $ENV->DB->version, - 'version' => $Version, - ] - ); - - - /** - * Title Fields - */ - - # New torrent upload - if ($this->NewTorrent) { - $Title1 = \Gazelle\Text::esc($Torrent['Title']); - $Title2 = \Gazelle\Text::esc($Torrent['Title2']); - $Title3 = \Gazelle\Text::esc($Torrent['TitleJP']); - #$Disabled = $this->Disabled; - - echo $twig->render( - 'torrent_form/titles.html', - [ - 'db' => $ENV->DB, - 'title' => $Title1, - 'subject' => $Title2, - 'object' => $Title3, - ] - ); - } # fi NewTorrent - - - /** - * Creator(s) - * CURRENTLY BROKEN - * - * Gazelle supports multiple creators per torrent. - * One day I want to integrate the creator DB to join: - * - DOI publication info in `torrents_screenshots` - * - Attributions listed on the creator pages - * - Stats about creator vs. total DOI citations - */ - if ($this->NewTorrent) { - # Useful variables - $Disabled = $this->Disabled; - - $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 << - - - - -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 << - - - - - 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 << - - - - -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 << - - - - -HTML; - - - /** - * ==================================== - * = Begin if NewTorrent fields again = - * ==================================== - */ - - - /** - * Tags - * - * Simple enough. - * I won't rehash tag management. - */ - if ($this->NewTorrent) { - 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 << - - '; - } # 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 << - - '; - - - /** - * 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 << - - - - -HTML; - - - /** - * Upload Anonymously - */ - $TorrentAnonymous = ($Torrent['Anonymous'] ?? false) ? ' checked' : ''; - echo << - - - - -HTML; - - # End the giant dynamic form table - 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 '
- - -
- - -
- -
- - - - - - - -

- How complete the data is, specifically or conceptually -

-
- - -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; - - View::textarea( - id: 'album_desc', - placeholder: "General info about the torrent subject's function or significance", - value: \Gazelle\Text::esc($Torrent['GroupDescription']) ?? '' - ); - - 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 '
- - - -   - Whether the torrent contains alignments, annotations, or other structural metadata -
- - - -   - Hide your username from other users on the torrent details page -
'; - - # Drink a stiff one - $app->dbOld->set_query_id($QueryID); - } # End upload_form() -} # End TorrentForm() diff --git a/config/metadata.php b/config/metadata.php index 44d7714e8..c5970037d 100644 --- a/config/metadata.php +++ b/config/metadata.php @@ -3,6 +3,14 @@ declare(strict_types=1); +/** + * metadata configuration + */ + +# set the collage categories before things get too intense +$env->collageCategories = \Gazelle\Collages::$categories; + + /** * $env->database * diff --git a/resources/js/torrent.js b/resources/js/torrent.js index 541a3ad3c..d8de6269e 100644 --- a/resources/js/torrent.js +++ b/resources/js/torrent.js @@ -16,12 +16,14 @@ return confirm("Are you sure you want to use a freeleech token here?"); }); + /* // toggle biblatex citation $(".bibtexCitation").hide(); $(".toggleBibtex").on("click", (event) => { let torrentId = $(event.target).data("torrentid"); $("#bibtexCitation-" + torrentId).toggle(toggleDuration); }); + */ /** diff --git a/resources/scss/assets/icons.scss b/resources/scss/assets/icons.scss index c577293ca..44715c64a 100644 --- a/resources/scss/assets/icons.scss +++ b/resources/scss/assets/icons.scss @@ -267,6 +267,13 @@ img.torrent_header { } } +.referenceCount { + &:before { + content: "📜"; + margin-right: 0.5rem; + } +} + .publicationDate { &:before { content: "📅"; diff --git a/resources/scss/global/forms.scss b/resources/scss/global/forms.scss index 5fc3cc2c6..72be23521 100644 --- a/resources/scss/global/forms.scss +++ b/resources/scss/global/forms.scss @@ -73,6 +73,7 @@ display: flex; flex-flow: row nowrap; gap: 2rem; + margin-bottom: 1rem; } #seqhashTable { diff --git a/resources/scss/global/layout.scss b/resources/scss/global/layout.scss index f5df14400..c25d8d97a 100644 --- a/resources/scss/global/layout.scss +++ b/resources/scss/global/layout.scss @@ -131,6 +131,7 @@ section { flex-flow: row wrap; gap: 0 2rem; align-items: baseline; + margin-bottom: 1rem; } /* torrent collage cover display */ diff --git a/resources/scss/global/torrents.scss b/resources/scss/global/torrents.scss index 08db2b85e..0e5870aaa 100644 --- a/resources/scss/global/torrents.scss +++ b/resources/scss/global/torrents.scss @@ -44,11 +44,11 @@ } /* tom select */ - .ts-control > * { + .ts-control>* { width: auto; } - .ts-wrapper.multi .ts-control > div.active { + .ts-wrapper.multi .ts-control>div.active { background: $skeletonDefault; } @@ -94,6 +94,7 @@ display: flex; flex-flow: row wrap; gap: 0 2rem; + margin-bottom: 1rem; } } @@ -137,6 +138,7 @@ display: flex; flex-flow: row wrap; gap: 0 2rem; + margin-bottom: 1rem; } } @@ -169,4 +171,4 @@ table#announceSource { input { width: 100%; } -} +} \ No newline at end of file diff --git a/sections/better/badFolders.php b/sections/better/badFolders.php index b29466155..8ffc30fcb 100644 --- a/sections/better/badFolders.php +++ b/sections/better/badFolders.php @@ -19,10 +19,15 @@ # twig template $app->twig->display("better/list.twig", [ - "title" => "Better", - "header" => "Torrents with bad folder names", + "title" => "Torrent groups with bad folder names", + "header" => "Torrent groups with bad folder names", "sidebar" => true, + "breadcrumbs" => [ + "/torrents" => "torrents", + "/better" => "better", + ], + "torrentGroups" => $torrentGroups, "snatchedOnly" => $snatchedOnly, "currentPage" => "bad-folders", diff --git a/sections/better/badTags.php b/sections/better/badTags.php index 825d593d1..7d68eff91 100644 --- a/sections/better/badTags.php +++ b/sections/better/badTags.php @@ -19,10 +19,15 @@ # twig template $app->twig->display("better/list.twig", [ - "title" => "Better", + "title" => "Torrents with bad tags", "header" => "Torrents with bad tags", "sidebar" => true, + "breadcrumbs" => [ + "/torrents" => "torrents", + "/better" => "better", + ], + "torrentGroups" => $torrentGroups, "snatchedOnly" => $snatchedOnly, "currentPage" => "bad-tags", diff --git a/sections/better/missingCitations.php b/sections/better/missingCitations.php index d779d49a7..5451cccbb 100644 --- a/sections/better/missingCitations.php +++ b/sections/better/missingCitations.php @@ -19,10 +19,15 @@ # twig template $app->twig->display("better/list.twig", [ - "title" => "Better", + "title" => "Torrent groups with no publications", "header" => "Torrent groups with no publications", "sidebar" => true, + "breadcrumbs" => [ + "/torrents" => "torrents", + "/better" => "better", + ], + "torrentGroups" => $torrentGroups, "snatchedOnly" => $snatchedOnly, "currentPage" => "missing-citations", diff --git a/sections/better/missingPictures.php b/sections/better/missingPictures.php index bb9b4b4fc..28a89788a 100644 --- a/sections/better/missingPictures.php +++ b/sections/better/missingPictures.php @@ -19,10 +19,15 @@ # twig template $app->twig->display("better/list.twig", [ - "title" => "Better", - "header" => "Torrent groups with no picture", + "title" => "Torrent groups groups with no picture", + "header" => "Torrent groups groups with no picture", "sidebar" => true, + "breadcrumbs" => [ + "/torrents" => "torrents", + "/better" => "better", + ], + "torrentGroups" => $torrentGroups, "snatchedOnly" => $snatchedOnly, "currentPage" => "missing-pictures", diff --git a/sections/better/singleSeeder.php b/sections/better/singleSeeder.php index e642c9f5a..506dc2bd6 100644 --- a/sections/better/singleSeeder.php +++ b/sections/better/singleSeeder.php @@ -14,10 +14,15 @@ # twig template $app->twig->display("better/list.twig", [ - "title" => "Better", - "header" => "Torrents with only one seeder", + "title" => "Torrent groups with only one seeder", + "header" => "Torrent groups with only one seeder", "sidebar" => true, + "breadcrumbs" => [ + "/torrents" => "torrents", + "/better" => "better", + ], + "torrentGroups" => $torrentGroups, "snatchedOnly" => null, "currentPage" => "single-seeder", diff --git a/sections/literature/details.php b/sections/literature/details.php index da8307e85..973c97788 100644 --- a/sections/literature/details.php +++ b/sections/literature/details.php @@ -46,6 +46,7 @@ ], "literature" => $literature, + "torrentGroups" => $literature->relationships->torrentGroups, "enableConversation" => true, "conversation" => $conversation, diff --git a/sections/top10/torrents.php b/sections/top10/torrents.php index bd6b6f8c3..fd8fea698 100644 --- a/sections/top10/torrents.php +++ b/sections/top10/torrents.php @@ -14,44 +14,14 @@ # data $dailyTorrents = Gazelle\Top10::dailyTorrents($limit); -if (!empty($dailyTorrents)) { - $dailyTorrents = \Gazelle\Torrents::get_groups(array_column($dailyTorrents, "id")); -} - $weeklyTorrents = Gazelle\Top10::weeklyTorrents($limit); -if (!empty($weeklyTorrents)) { - $weeklyTorrents = \Gazelle\Torrents::get_groups(array_column($dailyTorreweeklyTorrentsnts, "id")); -} - $monthlyTorrents = Gazelle\Top10::monthlyTorrents($limit); -if (!empty($monthlyTorrents)) { - $monthlyTorrents = \Gazelle\Torrents::get_groups(array_column($monthlyTorrents, "id")); -} - $yearlyTorrents = Gazelle\Top10::yearlyTorrents($limit); -if (!empty($yearlyTorrents)) { - $yearlyTorrents = \Gazelle\Torrents::get_groups(array_column($yearlyTorrents, "id")); -} - $overallTorrents = Gazelle\Top10::overallTorrents($limit); -if (!empty($overallTorrents)) { - $overallTorrents = \Gazelle\Torrents::get_groups(array_column($overallTorrents, "id")); -} $torrentSeeders = Gazelle\Top10::torrentSeeders($limit); -if (!empty($torrentSeeders)) { - $torrentSeeders = \Gazelle\Torrents::get_groups(array_column($torrentSeeders, "id")); -} - $torrentSnatches = Gazelle\Top10::torrentSnatches($limit); -if (!empty($torrentSnatches)) { - $torrentSnatches = \Gazelle\Torrents::get_groups(array_column($torrentSnatches, "id")); -} - $torrentData = Gazelle\Top10::torrentData($limit); -if (!empty($torrentData)) { - $torrentData = \Gazelle\Torrents::get_groups(array_column($torrentData, "id")); -} # template $app->twig->display("top10/torrents.twig", [ diff --git a/sections/torrentGroups/browse.php b/sections/torrentGroups/browse.php index b46c76c35..9ae195c46 100644 --- a/sections/torrentGroups/browse.php +++ b/sections/torrentGroups/browse.php @@ -18,10 +18,8 @@ $get["simpleSearch"] = $get["search"]; } - /** torrent search handling */ - # collect the query $searchTerms = [ "simpleSearch" => $get["simpleSearch"] ?? null, @@ -79,15 +77,12 @@ $manticore = new Gazelle\Manticore(); $searchResults = $manticore->search("torrents", $get); $resultCount = count($searchResults); -#!d($searchResults); - /** pagination */ - +# resultCount and pageSize $pagination = []; -# resultCount and pageSize $pagination["resultCount"] = count($searchResults); $pagination["pageSize"] = $app->user->extra["siteOptions"]["searchPagination"] ?? 20; @@ -123,32 +118,31 @@ $pagination["limit"] = $pagination["resultCount"]; } - /** torrent group info */ - -# \Gazelle\Torrents::get_groups # this is slow, only do the current page $app->debug["time"]->startMeasure("browse", "get torrent groups"); + $groupIds = array_column($searchResults, "id"); $groupIds = array_slice($groupIds, $pagination["offset"], $pagination["pageSize"]); -$torrentGroups = \Gazelle\Torrents::get_groups($groupIds); +$torrentGroups = []; +foreach ($groupIds as $key => $groupId) { + $torrentGroups[] = new Gazelle\TorrentGroups($groupId); + $torrentGroups[$key]->loadTorrents(); +} + $app->debug["time"]->stopMeasure("browse", "get torrent groups"); #!d($torrentGroups);exit; - /** tags */ - $query = "select name from tags where tagType = 'genre' order by name"; $ref = $app->dbNew->multi($query, []); $officialTags = array_column($ref, "name"); - /** twig template */ - $app->twig->display("torrents/browse.twig", [ "title" => "Browse", "js" => ["vendor/tom-select.base.min", "browse"], diff --git a/sections/torrentGroups/details.php b/sections/torrentGroups/details.php index 1bb42173b..1efacee8f 100644 --- a/sections/torrentGroups/details.php +++ b/sections/torrentGroups/details.php @@ -17,6 +17,7 @@ throw new Exception("not found"); } + $torrentGroup->loadCollages(); $torrentGroup->loadCreators(); $torrentGroup->loadLiterature(); $torrentGroup->loadTags(); @@ -73,6 +74,8 @@ ], "torrentGroup" => $torrentGroup, + "torrents" => $torrentGroup->relationships->torrents, + "collages" => $torrentGroup->relationships->collages, "literature" => $literature, "revisionId" => $revisionId ?? null, "officialTags" => $officialTags, diff --git a/sections/torrents/details.php b/sections/torrents/details.php index 1e96cebe5..20433f12c 100644 --- a/sections/torrents/details.php +++ b/sections/torrents/details.php @@ -9,30 +9,21 @@ $app = Gazelle\App::go(); -#try { -$id ??= null; -$torrent = new Gazelle\Torrents($id); -$torrent->loadTorrentGroups(); +try { + $id ??= null; + $torrent = new Gazelle\Torrents($id); + $torrent->loadTorrentGroups(); -if (!$torrent->id) { - throw new Exception("not found"); -} - -$torrentGroup = $torrent->relationships->torrentGroups->first(); -$torrentGroup->loadLiterature(); -$torrentGroup->loadTorrents(); + if (!$torrent->id) { + throw new Exception("not found"); + } -$literature = $torrentGroup->relationships->literature; -foreach ($literature as $item) { - $item->loadCreators(); + $torrentGroup = $torrent->relationships->torrentGroups->first(); + $torrentGroup->loadCreators(); + $torrentGroup->loadTorrents(); +} catch (Throwable $e) { + $app->error(404); } -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 %}
 
 
-

{{ header }}

- -{# no torrents #} -{% if torrentGroups is empty %} -

No torrents found :)

-{% endif %} - -{# torrent list #} -
-

{{ Torrent groups }}

-{% include("tables/torrentGroupsWithoutTorrents.twig") %} +

{{ header }}

+ + {# no torrents #} + {% if torrentGroups is empty %} +

No torrents found :)

+ {% else %} + {# torrent list #} + {{ include("tables/torrentGroupsWithoutTorrents.twig") }} + {% endif %}
{% 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 @@
{# lottery badges #} +

Lottery badges

@@ -239,6 +240,7 @@

{# auction badge #} +

Auction badge

@@ -270,6 +272,7 @@

{# pyramid scheme badge #} +

Coin badge

"It's not a pyramid, it's a triangle!" @@ -298,8 +301,10 @@ +

{# random badge #} +

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 #} - - - - {# category #} - - - {# torrent count #} - - - {# subscriber count #} - - - {# last update #} - - - {# author #} - - - - -{# end results table headings #} - -{# start the results themselves #} - -{% for item in collages %} - - - - {# category #} - - - - - {# torrent count #} - - - {# subscriber count #} - - - {# last update #} - {% if item.attributes.updatedAt %} - - {% else %} - - {% endif %} - - - - - -{% endfor %} - - -{# end the results table #} -
- - {# collage title #} - Collage titleTorrentsSubscribersUpdated atUser
- {{ categories[item.attributes.categoryId] }} - {# env->collageCategories[(int)$CategoryID]?> #} - - {{ item.attributes.title }} - {# - - - Remove bookmark - - - #} - - {% if item.attributes.tags is not empty %} -
{{ item.attributes.tags|join(", ") }}
- {% endif %} -
{{ item.attributes.torrentCount }}{{ item.attributes.subscriberCount }}{{ item.attributes.updatedAt|relativeTime }}{{ item.attributes.createdAt|relativeTime }}{{ item.attributes.userId|formatUsername }}
- -{# 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 %} - - Sci-Hub - - {{ sciHubLink(literature.attributes.doi) }} - - - {% endif %} - {# semanticScholarId #} {% if literature.attributes.semanticScholarId is not empty %} @@ -70,34 +60,6 @@ {{ literature.attributes.publicationDate }} {% endif %} - - - {# influentialCitationCount #} - {% if literature.attributes.influentialCitationCount is not empty %} - - Influential citations - {{ literature.attributes.influentialCitationCount|number_format }} - - {% endif %} - - - {# citationCount #} - {% if literature.attributes.citationCount is not empty %} - - Citations - {{ literature.attributes.citationCount|number_format }} - - {% endif %} - - - {# referenceCount #} - {% if literature.attributes.referenceCount is not empty %} - - References - {{ literature.attributes.referenceCount|number_format }} - - {% endif %} -

@@ -113,13 +75,22 @@ {# tl;dr #} {% if literature.attributes.tldr is not empty %} -
+

tl;dr by {{ literature.attributes.tldr.model }}

{{ literature.attributes.tldr.text|raw }}
{% endif %} + {# torrent groups #} + {% if torrentGroups is not empty %} +
+

Torrent groups

+ {{ include("tables/torrentGroupsWithoutTorrents.twig") }} +
+ {% 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") %}
{{ literature.attributes.title }}
@@ -22,34 +22,61 @@

Actions

+ {# sci-hub #} + find on sci-hub + {# update #} {% if can({"literature": "updateAny"}) or literature.attributes.userId == user.core.id %} - update + update this item {% endif %} {# delete #} {% if can({"literature": "deleteAny"}) or literature.attributes.userId == user.core.id %} - delete + delete this item {% endif %} - - {# semantic scholar #} - semantic scholar - - {# sci-hub #} - sci-hub -
+
+ +{# impact stats #} +
+

Impact stats

+ + + {# influentialCitationCount #} + {% if literature.attributes.influentialCitationCount is not empty %} + + + + + {% endif %} + + + {# citationCount #} + {% if literature.attributes.citationCount is not empty %} + + + + + {% endif %} + + + {# referenceCount #} + {% if literature.attributes.referenceCount is not empty %} + + + + + {% endif %} +
Influential citations{{ literature.attributes.influentialCitationCount|number_format }}
Citations{{ literature.attributes.citationCount|number_format }}
References{{ literature.attributes.referenceCount|number_format }}
+ {# creators #}
-

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 + #} + +
+ + + {# category #} + + + {# torrent count #} + + + {# subscriber count #} + + + {# last update #} + + + {# author #} + + + + + + {% for item in collages %} + + {# category #} + + + + + {# torrent count #} + + + {# subscriber count #} + + + {# last update #} + {% if item.attributes.updatedAt is not empty %} + + {% else %} + + {% endif %} + + {# collage owner #} + + + {% endfor %} + +
+ + {# collage title #} + TitleTorrentsSubscribersUpdated atUser
+ {{ env.collageCategories[item.attributes.categoryId] }} + + {# title #} +

+ {{ item.attributes.title }} +

+ + {# tags #} + {% if item.attributes.tags is not empty %} +
{{ item.attributes.tags|join(", ") }}
+ {% endif %} +
{{ item.attributes.torrentCount|number_format }}{{ item.attributes.subscriberCount|number_format }}{{ item.attributes.updatedAt|relativeTime }}{{ item.attributes.createdAt|relativeTime }}{{ item.attributes.userId|formatUsername }}
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 - #} {# literature info #} - + @@ -42,15 +13,19 @@ {% for item in literature %} {# title #} - 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 @@ + {# timeAdded #} @@ -43,8 +43,8 @@ {# title #} - @@ -107,48 +107,53 @@ {% for torrent in torrentGroup.relationships.torrents %} {# category icon #} - + {# 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 @@ + @@ -23,9 +23,8 @@ {# title #} - {% 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 + #} + +
Literature infoInfo
-
- +
{# title link #} +

- {{ item.attributes.title }} + {% if item.attributes.title is not empty %} + {{ item.attributes.title }} + {% else %} + {{ item.attributes.doi }} + {% endif %} +

-
+

{# 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 %} -

+

{# creators #} {# @@ -81,7 +61,7 @@ {# tl;dr: no tooltip #} {% if item.attributes.tldr is not empty %} -

{{ item.attributes.tldr.text }}

+

{{ item.attributes.tldr.text }}

{% endif %}
{# torrent info #} - Torrent infoInfoTime added -
+
+

{# title link #} {{ torrentGroup.attributes.title|raw }} +

-
+

{# 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 %} -

+

{# tags #} {% if torrentGroup.attributes.tags is not empty %} -
{{ 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 %} #} -
- 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 %} + +

+ {# 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 infoInfo
-
- +
+

{# 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 %} +

+ {# 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 %} -

+ {# location #} + {% if torrentGroup.attributes.location is not empty %} + {{ torrentGroup.attributes.location|raw }} + {% endif %} +

- {# tags #} - {% if torrentGroup.attributes.tags is not empty %} -
{{ 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 %} + #}
+ + + {# torrent info #} + + + {# timeAdded #} + + + {# data size #} + + + {# seeders #} + + + {# leechers #} + + + {# snatches #} + + + + + + {% for torrent in torrents %} + + {# title #} + + + {# createdAt #} + + + {# dataSize #} + + + {# seederCount #} + + + {# leecherCount #} + + + {# snatchCount #} + + + {% endfor %} + +
InfoTime addedData size
+

+ {# 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 }} + + {{ torrent.attributes.dataSize|get_size }} + + {{ torrent.attributes.seederCount|number_format }} + + {{ torrent.attributes.leecherCount|number_format }} + + {{ torrent.attributes.snatchCount|number_format }} +
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 %}

{{ limit }} most active daily uploads

- - - - - {% for group in dailyTorrents %} - - {% include "torrents/tableEntryForObjects.twig" with group %} - - {% endfor %} - -
+ {{ include("tables/torrentGroupsWithoutTorrents.twig", {"torrentGroups": dailyTorrents}) }}
{% endif %} @@ -26,17 +16,7 @@ {% if weeklyTorrents 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 %} @@ -44,17 +24,7 @@ {% if monthlyTorrents 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 %} @@ -62,17 +32,7 @@ {% if yearlyTorrents 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 %} @@ -80,17 +40,7 @@ {% if overallTorrents 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 %} @@ -98,17 +48,7 @@ {% if torrentSeeders 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 %} @@ -116,17 +56,7 @@ {% if torrentSnatches 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 %} @@ -134,17 +64,7 @@ {% if torrentData is not empty %}

{{ limit }} most transferred torrents

- - - - - {% for group in torrentData %} - - {% include "torrents/tableEntryForObjects.twig" with group %} - - {% endfor %} - -
+ {{ include("tables/torrentGroupsWithoutTorrents.twig", {"torrentGroups": torrentData}) }}
{% 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 @@ {# organism #} - {% if torrentGroup.attributes.subject %} + {% if torrentGroup.attributes.subject is not empty %} @@ -19,31 +19,21 @@ {# object #} {{ (torrentGroup.attributes.object) ? torrentGroup.attributes.object : "" }} - - - + {% endif %} {# year #} - {% if torrentGroup.attributes.year %} + {% if torrentGroup.attributes.year is not empty %} - - - - + {% endif %} {# identifier #} - {% if torrentGroup.attributes.identifier %} + {% if torrentGroup.attributes.identifier is not empty %} - - - - - + {% endif %} {# location #} - {% if torrentGroup.attributes.location %} + {% if torrentGroup.attributes.location is not empty %} - - - - + {% endif %}
Organism - Search » -
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 %}
Workgroup{{ torrentGroup.attributes.workgroup|raw }} - Search » -
Location{{ torrentGroup.attributes.location|raw }} - Search » -
{# description #} + {% if torrentGroup.attributes.description is not empty %}

Description

- {{ torrentGroup.attributes.description|raw }} + {{ torrentGroup.attributes.description|parse }}
+ {% endif %} {# openai #} {% if torrentGroup.attributes.openai is not empty and user.siteOptions.openaiContent %} -
+

tl;dr by {{ torrentGroup.attributes.openai.model }}

{{ torrentGroup.attributes.openai.text }}
@@ -96,256 +78,31 @@ {# torrent list #} -
+ {% if torrentGroup.relationships.torrents is not empty %} +

Torrents

- - {# individual torrents #} -{% for item in torrentGroup.relationships.torrents %} - - - - - - {# permalink #} - - - {# timeAdded #} - - - {# data size #} - - - {# seeders #} - - - {# leechers #} - - - {# snatches #} - - - - - - - -{# permalink #} - - - {# title #} - - - {# createdAt #} - - - - {# dataSize #} - - - {# seederCount #} - - - - {# leecherCount #} - - - - {# snatchCount #} - - - -{# second row: buttons #} - - -{# controls #} - - - -{# third row:description #} -{% if item.attributes.description is not empty %} - - -{# description #} - -{% endif %} - - - -{# citation #} - - - - - - -{#} - if (!empty($Description)) { - echo '
'.\Gazelle\Text::parse($Description).'
'; - } - - echo "\n
"; ?> -
- $Artist) { - array_push($ArtistArray, $Artist['name']); - } - - # Not sure if inline newlines are valid - $ArtistString = (count($ArtistArray) > 3) - ? implode("\n and ", $ArtistArray) - : implode(' and ', $ArtistArray); - - # DOI number - $BibtexDOI = (count($Screenshots) > 0) - ? $Screenshots[0]['Image'] - : null; - - - ?> - - -#} - -
- - {# torrent info #} - Torrent infoTime addedData size
- - - - {# platform #} - {% if item.attributes.platform %} - 📦 {{ item.attributes.platform }} - {% endif %} - - {# format #} - {% if item.attributes.format %} - 💾 {{ item.attributes.format }} - {% endif %} - - {# version #} - {% if item.attributes.version %} - version {{ item.attributes.version }} - {% endif %} - - {# scope #} - {% if item.attributes.scope %} - 🔎 {{ item.attributes.scope }} - {% endif %} - - {# archive #} - {% if item.attributes.archive %} - 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 %} +
+

Collages

+ {{ include("tables/collages.twig") }} +
{% endif %} -
- {{ item.attributes.createdAt|relativeTime }} - - {{ item.attributes.dataSize|get_size }} - - {{ item.attributes.seederCount|number_format }} - - {{ item.attributes.leecherCount|number_format }} - - {{ item.attributes.snatchCount|number_format }} -
- -
-{# 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

-{{ item.attributes.description }} -
- - -

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 - #} - - -
-{% endfor %} - -
{# literature #} + {% if torrentGroup.relationships.literature is not empty %}

Literature

{{ include("tables/literature.twig") }}
- + {% 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 #}
- {% 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 @@ - - - - - - - - - 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 @@ - - - - - - - - - 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 @@ - - - - - - - - - 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 @@ - - - - {# -
- + - - #} - - - - - - DNA - {# #} - -   - - RNA - {# #} - -   - - Protein - {# #} - -
- - Linear - {# #} - -   - - Circular - {# #} - -
- - Double-Stranded - {# #} - -   - - Single-Stranded - {# #} - -

{{ db.note|raw }}

- - 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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.note|raw }}

- - 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 @@ - - - - - - - - - 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 @@ - - - - - - - - - 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 #} - - -{# start results table headings #} -{# todo: this can be reorganized to suck less #} - - - - {# grouped #} - {# - - {# timeAdded #} - - - {# data size #} - - - {# file count #} - {# - - #} - - {# seeders #} - - {# #} - - {# leechers #} - - {# #} - - {# snatches #} - - {# #} - - - -{# 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 infoTime addedData sizeFile countSeeders ↑Leechers ↓Snatches ↻
- -{# 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 %} -

{{ torrent.attributes.infoHash }}

+

{{ torrent.attributes.infoHash }}

{# essential details table #}
{# 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 %} - - - - + {% endif %} {# license #} - {% if torrent.attributes.license %} + {% if torrent.attributes.license is not empty %} - - - {% endif %} {# scope #} - {% if torrent.attributes.scope %} + {% if torrent.attributes.scope is not empty %} - - - - + {% endif %} {# version #} - {% if torrent.attributes.version %} + {% if torrent.attributes.version is not empty %} - - + - - - + {% endif %}
Platform{{ torrent.attributes.platform }} - Search » -
Format{{ torrent.attributes.format }} - Search » -
License{{ torrent.attributes.license }}
Scope{{ torrent.attributes.scope }} - Search » -
versionVersion {{ torrent.attributes.version }} - Search » -
+ {# description #} + {% if torrent.attributes.description is not empty %}

Description

- {{ torrent.attributes.description|raw }}
+ {% endif %} - {# fileList #} -
-

File list

- - -{# - - - - - - - {% for file in torrent.attributes.fileList %} - - - - - {% endfor %} -
File nameSize
{{ file.name }}{{ file.size|get_size }}
-#} - -
- - {# torrentGroup #} + {# torrentGroup #}

Torrent group

- - {{ include("torrents/tableEntryForObjects.twig", {group: torrentGroup}) }} - - - + {{ include("tables/torrentGroupsWithTorrents.twig") }}
+ {# citation #} +
+

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 + #} + + +
+ {% 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 #}
-

Tracker

+

Tracker data

{# fileCount #} - - + + {# dataSize #} - - + + {# leecherCount #} - - + + {# seederCount #} - - + + {# lastAction #} - - + +
fileCount{{ torrent.attributes.fileCount }}File count{{ torrent.attributes.fileCount|number_format }}
dataSize{{ torrent.attributes.dataSize }}Data size{{ torrent.attributes.dataSize|get_size }}
leecherCount{{ torrent.attributes.leecherCount }}Leechers{{ torrent.attributes.leecherCount|number_format }}
seederCount{{ torrent.attributes.seederCount }}Seeders{{ torrent.attributes.seederCount|number_format }}
fileCount{{ torrent.attributes.lastAction }}Last action{{ torrent.attributes.lastAction|relativeTime }}
@@ -85,4 +85,18 @@
+ {# fileList #} + {% if torrent.attributes.fileList is not empty %} +
+

File list

+ + + {% endif %} + +
+