theme updates
This commit is contained in:
parent
c1acf5c38c
commit
f6919cf9c9
2 changed files with 89 additions and 0 deletions
|
@ -4,6 +4,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Shimmie2;
|
||||
|
||||
use MicroHTML\HTMLElement;
|
||||
|
||||
use function MicroHTML\{TR, TH, TD, emptyHTML, rawHTML, joinHTML, DIV, INPUT, A};
|
||||
|
||||
class CustomTagEditTheme extends TagEditTheme
|
||||
{
|
||||
public function display_mass_editor()
|
||||
|
@ -54,4 +58,45 @@ class CustomTagEditTheme extends TagEditTheme
|
|||
</tr>
|
||||
");
|
||||
}
|
||||
|
||||
public function get_user_editor_html(Image $image): HTMLElement
|
||||
{
|
||||
global $user;
|
||||
$owner = $image->get_owner()->name;
|
||||
$date = rawHTML(autodate($image->posted));
|
||||
$ip = $user->can(Permissions::VIEW_IP) ? rawHTML(" (" . show_ip($image->owner_ip, "Post posted {$image->posted}") . ")") : "";
|
||||
$info = SHM_POST_INFO(
|
||||
"Uploader",
|
||||
$user->can(Permissions::EDIT_IMAGE_OWNER),
|
||||
emptyHTML(
|
||||
A(["class" => "username", "href" => make_link("user/$owner")], $owner),
|
||||
$ip,
|
||||
", ",
|
||||
$date,
|
||||
INPUT(["type" => "text", "name" => "tag_edit__owner", "value" => $owner])
|
||||
),
|
||||
);
|
||||
// SHM_POST_INFO returns a TR, let's sneakily append
|
||||
// a TD with the avatar in it
|
||||
$info->appendChild(
|
||||
TD(
|
||||
["width" => "80px", "rowspan" => "4"],
|
||||
rawHTML($image->get_owner()->get_avatar_html())
|
||||
)
|
||||
);
|
||||
return $info;
|
||||
}
|
||||
|
||||
public function get_lock_editor_html(Image $image): HTMLElement
|
||||
{
|
||||
global $user;
|
||||
return SHM_POST_INFO(
|
||||
"Locked",
|
||||
$user->can(Permissions::EDIT_IMAGE_LOCK),
|
||||
emptyHTML(
|
||||
INPUT(["type" => "checkbox", "name" => "tag_edit__locked", "checked" => $image->is_locked()]),
|
||||
$image->is_locked() ? "Yes (Only admins may edit these details)" : "No",
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
44
themes/rule34v2/view.theme.php
Normal file
44
themes/rule34v2/view.theme.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shimmie2;
|
||||
|
||||
use MicroHTML\HTMLElement;
|
||||
|
||||
use function MicroHTML\{TR, TH, TD, emptyHTML, rawHTML, joinHTML, DIV, INPUT, A};
|
||||
|
||||
class CustomViewImageTheme extends ViewImageTheme
|
||||
{
|
||||
protected function build_info(Image $image, $editor_parts): string
|
||||
{
|
||||
global $user;
|
||||
|
||||
if (count($editor_parts) == 0) {
|
||||
return ($image->is_locked() ? "<br>[Post Locked]" : "");
|
||||
}
|
||||
|
||||
$html = make_form(make_link("post/set"))."
|
||||
<input type='hidden' name='image_id' value='{$image->id}'>
|
||||
<table style='width: 500px; max-width: 100%;' class='image_info form'>
|
||||
";
|
||||
foreach ($editor_parts as $part) {
|
||||
$html .= $part;
|
||||
}
|
||||
if (
|
||||
(!$image->is_locked() || $user->can(Permissions::EDIT_IMAGE_LOCK)) &&
|
||||
$user->can(Permissions::EDIT_IMAGE_TAG)
|
||||
) {
|
||||
$html .= "
|
||||
<tr><td colspan='4'>
|
||||
<input class='edit' type='submit' value='Set'>
|
||||
</td></tr>
|
||||
";
|
||||
}
|
||||
$html .= "
|
||||
</table>
|
||||
</form>
|
||||
";
|
||||
return $html;
|
||||
}
|
||||
}
|
Reference in a new issue