forked from Cavemanon/cavepaintings
Hacky way of getting uploads working implemented
This works by abusing the fact that ratings are technically tags. Upload a file, add a rating, and then send it off. The tags_for_upload_slot func then takes the data sent over, explodes it out into individual instances. Notably, you can put your own data here (i.e. ratings) to then have them be considered tags. This hack forces ratings to be a dependency as no code was added to assume otherwise. Take this patch at your own risk.
This commit is contained in:
parent
40f4d76b12
commit
f038cd72fb
@ -267,9 +267,7 @@ class Upload extends Extension
|
||||
# merge then explode, not explode then merge - else
|
||||
# one of the merges may create a surplus "tagme"
|
||||
return Tag::explode(
|
||||
($_POST["tags"] ?? "") .
|
||||
" " .
|
||||
($_POST["tags$id"] ?? "")
|
||||
($_POST["tags"] ?? "") . " " . ($_POST["tags$id"] ?? "") . " " . ($_POST["rating"] ?? "") . " " . ($_POST["rating$id"] ?? "")
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,8 @@ use function MicroHTML\BR;
|
||||
use function MicroHTML\A;
|
||||
|
||||
use function MicroHTML\P;
|
||||
use function MicroHTML\OPTION;
|
||||
use function MicroHTML\SELECT;
|
||||
|
||||
class UploadTheme extends Themelet
|
||||
{
|
||||
@ -56,7 +58,7 @@ class UploadTheme extends Themelet
|
||||
),
|
||||
$upload_list,
|
||||
TR(
|
||||
TD(["colspan"=>"6"], INPUT(["id"=>"uploadbutton", "type"=>"submit", "value"=>"Post"]))
|
||||
TD(["colspan"=>"8"], INPUT(["id"=>"uploadbutton", "type"=>"submit", "value"=>"Post"]))
|
||||
),
|
||||
)
|
||||
);
|
||||
@ -86,18 +88,26 @@ class UploadTheme extends Themelet
|
||||
TR(
|
||||
TD(["colspan"=>$tl_enabled ? 2 : 4], "Files"),
|
||||
$tl_enabled ? TD(["colspan"=>"2"], "URLs") : emptyHTML(),
|
||||
TD(["colspan"=>"2"], "Post-Specific Tags"),
|
||||
TD(["colspan"=>"1"], "Rating"),
|
||||
TD(["colspan"=>"3"], "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])),
|
||||
TD(["colspan"=>$tl_enabled ? 2 : 2], 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}", "class"=>"autocomplete_tags", "autocomplete"=>"off"])),
|
||||
DIV(["class"=>'edit'],
|
||||
TD(["colspan"=>"2"], INPUT(["type"=>"text", "name"=>"tags${i}", "id"=>"tag_editor", "class"=>"autocomplete_tags", "autocomplete"=>"off"])),
|
||||
TD(["colspan"=>"4"],
|
||||
SELECT(["name"=>"rating${i}"],
|
||||
OPTION(["value"=>"rating:safe"], "Safe"),
|
||||
OPTION(["value"=>"rating:questionable"], "Questionable"),
|
||||
OPTION(["value"=>"rating:explicit"], "Explicit"),
|
||||
)
|
||||
),
|
||||
|
||||
DIV(["class"=>'edit'],
|
||||
TD(["colspan"=>"2"], INPUT(["type"=>"text", "name"=>"tags${i}", "id"=>"tag_editor", "class"=>"autocomplete_tags", "autocomplete"=>"off"])),
|
||||
)
|
||||
)
|
||||
);
|
||||
@ -120,21 +130,21 @@ class UploadTheme extends Themelet
|
||||
function() {
|
||||
if(typeof window=="undefined" || !window.location || window.location.href=="about:blank") {
|
||||
window.location = "'. $main_page .'";
|
||||
}
|
||||
else if(typeof document=="undefined" || !document.body) {
|
||||
window.location = "'. $main_page .'?url="+encodeURIComponent(window.location.href);
|
||||
}
|
||||
else if(window.location.href.match("\/\/'. $_SERVER["HTTP_HOST"] .'.*")) {
|
||||
alert("You are already at '. $title .'!");
|
||||
}
|
||||
else {
|
||||
var tags = prompt("Please enter tags", "tagme");
|
||||
if(tags != "" && tags != null) {
|
||||
var link = "'. $link . $delimiter .'url="+location.href+"&tags="+tags;
|
||||
var w = window.open(link, "_blank");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(typeof document=="undefined" || !document.body) {
|
||||
window.location = "'. $main_page .'?url="+encodeURIComponent(window.location.href);
|
||||
}
|
||||
else if(window.location.href.match("\/\/'. $_SERVER["HTTP_HOST"] .'.*")) {
|
||||
alert("You are already at '. $title .'!");
|
||||
}
|
||||
else {
|
||||
var tags = prompt("Please enter tags", "tagme");
|
||||
if(tags != "" && tags != null) {
|
||||
var link = "'. $link . $delimiter .'url="+location.href+"&tags="+tags;
|
||||
var w = window.open(link, "_blank");
|
||||
}
|
||||
}
|
||||
}
|
||||
)();';
|
||||
$html1 = P(
|
||||
A(["href"=>$js], "Upload to $title"),
|
||||
@ -199,7 +209,7 @@ class UploadTheme extends Themelet
|
||||
["id"=>"large_upload_form", "class"=>"vert"],
|
||||
$upload_list,
|
||||
TR(TD("Source"), TD(["colspan"=>3], INPUT(["name"=>"source", "type"=>"text"]))),
|
||||
TR(TD(["colspan"=>4], INPUT(["id"=>"uploadbutton", "type"=>"submit", "value"=>"Post"]))),
|
||||
TR(TD(["colspan"=>6], INPUT(["id"=>"uploadbutton", "type"=>"submit", "value"=>"Post"]))),
|
||||
)
|
||||
));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user