This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/themes/rule34v2/upload.theme.php

45 lines
1.3 KiB
PHP
Raw Normal View History

2020-02-01 18:22:08 +00:00
<?php
2023-01-10 21:21:26 +00:00
declare(strict_types=1);
namespace Shimmie2;
2021-12-14 18:10:15 +00:00
use MicroHTML\HTMLElement;
2023-06-25 10:17:56 +00:00
use function MicroHTML\TABLE;
use function MicroHTML\TR;
use function MicroHTML\TD;
use function MicroHTML\SMALL;
use function MicroHTML\rawHTML;
use function MicroHTML\INPUT;
use function MicroHTML\emptyHTML;
use function MicroHTML\NOSCRIPT;
use function MicroHTML\DIV;
use function MicroHTML\BR;
2021-12-14 18:10:15 +00:00
use function MicroHTML\A;
2023-06-25 10:17:56 +00:00
use function MicroHTML\P;
2021-12-14 18:10:15 +00:00
2020-02-01 18:22:08 +00:00
class CustomUploadTheme extends UploadTheme
{
2023-12-26 22:53:09 +00:00
// override to put upload block in head and left
// (with css media queries deciding which one is visible)
2021-12-14 18:10:15 +00:00
public function display_block(Page $page): void
2020-02-01 18:22:08 +00:00
{
$page->add_block(new Block("Upload", $this->build_upload_block(), "head", 20));
$page->add_block(new Block("Upload", $this->build_upload_block(), "left", 20));
}
2023-12-26 22:53:09 +00:00
// override to put the warning in the header
2021-12-14 18:10:15 +00:00
public function display_full(Page $page): void
2020-02-01 18:22:08 +00:00
{
$page->add_block(new Block("Upload", "Disk nearly full, uploads disabled", "head", 20));
}
2023-12-26 22:53:09 +00:00
// override to remove small uploader and just show a link to
// the big page
2021-12-14 18:10:15 +00:00
protected function build_upload_block(): HTMLElement
2020-02-01 18:22:08 +00:00
{
return A(["href" => make_link("upload"), "style" => 'font-size: 2rem; display: block;'], "Upload");
2020-02-01 18:22:08 +00:00
}
}