no autocomplete for r34

This commit is contained in:
Shish 2023-06-25 10:17:56 +00:00
parent 4117678d72
commit 1d4c43f33b
2 changed files with 80 additions and 4 deletions

View file

@ -359,7 +359,7 @@ class UserPageTheme extends Themelet
$row->appendChild(TH("Permission"));
foreach ($classes as $class) {
$n = $class->name;
if($class->parent) {
if ($class->parent) {
$n .= " ({$class->parent->name})";
}
$row->appendChild(TH($n));
@ -373,7 +373,7 @@ class UserPageTheme extends Themelet
foreach ($classes as $class) {
$opacity = array_key_exists($perm->getValue(), $class->abilities) ? 1 : 0.2;
if($class->can($perm->getValue())) {
if ($class->can($perm->getValue())) {
$cell = TD(["style"=>"color: green; opacity: $opacity;"], "");
} else {
$cell = TD(["style"=>"color: red; opacity: $opacity;"], "");
@ -382,7 +382,7 @@ class UserPageTheme extends Themelet
}
$doc = $perm->getDocComment();
if($doc) {
if ($doc) {
$doc = preg_replace('/\/\*\*|\n\s*\*\s*|\*\//', '', $doc);
$row->appendChild(TD(["style"=>"text-align: left;"], $doc));
} else {

View file

@ -6,7 +6,18 @@ namespace Shimmie2;
use MicroHTML\HTMLElement;
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;
use function MicroHTML\A;
use function MicroHTML\P;
class CustomUploadTheme extends UploadTheme
{
@ -23,7 +34,43 @@ class CustomUploadTheme extends UploadTheme
public function display_page(Page $page): void
{
parent::display_page($page);
global $config, $page;
$tl_enabled = ($config->get_string(UploadConfig::TRANSLOAD_ENGINE, "none") != "none");
$max_size = $config->get_int(UploadConfig::SIZE);
$max_kb = to_shorthand_int($max_size);
$upload_list = $this->h_upload_list_1();
$form = SHM_FORM("upload", "POST", true, "file_upload");
$form->appendChild(
TABLE(
["id"=>"large_upload_form", "class"=>"vert"],
TR(
TD(["width"=>"20"], rawHTML("Common Tags")),
TD(["colspan"=>"5"], INPUT(["name"=>"tags", "type"=>"text", "placeholder"=>"tagme", "autocomplete"=>"off"]))
),
TR(
TD(["width"=>"20"], rawHTML("Common Source")),
TD(["colspan"=>"5"], INPUT(["name"=>"source", "type"=>"text"]))
),
$upload_list,
TR(
TD(["colspan"=>"6"], INPUT(["id"=>"uploadbutton", "type"=>"submit", "value"=>"Post"]))
),
)
);
$html = emptyHTML(
$form,
SMALL("(Max file size is $max_kb)")
);
$page->set_title("Upload");
$page->set_heading("Upload");
$page->add_block(new NavBlock());
$page->add_block(new Block("Upload", (string)$html, "main", 20));
if ($tl_enabled) {
$page->add_block(new Block("Bookmarklets", (string)$this->h_bookmarklets(), "left", 20));
}
$html = "
<a href='//rule34.paheal.net/wiki/tagging'>Tagging Guide</a>
";
@ -34,4 +81,33 @@ class CustomUploadTheme extends UploadTheme
{
return A(["href"=>make_link("upload"), "style"=>'font-size: 2em; display: block;'], "Upload");
}
protected function h_upload_list_1(): HTMLElement
{
global $config;
$upload_list = emptyHTML();
$upload_count = $config->get_int(UploadConfig::COUNT);
$tl_enabled = ($config->get_string(UploadConfig::TRANSLOAD_ENGINE, "none") != "none");
$accept = $this->get_accept();
$upload_list->appendChild(
TR(
TD(["colspan"=>$tl_enabled ? 2 : 4], "Files"),
$tl_enabled ? TD(["colspan"=>"2"], "URLs") : emptyHTML(),
TD(["colspan"=>"2"], "Post-Specific Tags"),
)
);
for ($i=0; $i<$upload_count; $i++) {
$upload_list->appendChild(
TR(
TD(["colspan"=>$tl_enabled ? 2 : 4], INPUT(["type"=>"file", "name"=>"data{$i}[]", "accept"=>$accept, "multiple"=>true])),
$tl_enabled ? TD(["colspan"=>"2"], INPUT(["type"=>"text", "name"=>"url{$i}"])) : emptyHTML(),
TD(["colspan"=>"2"], INPUT(["type"=>"text", "name"=>"tags{$i}", "autocomplete"=>"off"])),
)
);
}
return $upload_list;
}
}