SHM_A
This commit is contained in:
@@ -7,7 +7,7 @@ namespace Shimmie2;
|
|||||||
use MicroHTML\HTMLElement;
|
use MicroHTML\HTMLElement;
|
||||||
|
|
||||||
use function MicroHTML\emptyHTML;
|
use function MicroHTML\emptyHTML;
|
||||||
use function MicroHTML\rawHTML;
|
use function MicroHTML\A;
|
||||||
use function MicroHTML\FORM;
|
use function MicroHTML\FORM;
|
||||||
use function MicroHTML\INPUT;
|
use function MicroHTML\INPUT;
|
||||||
use function MicroHTML\DIV;
|
use function MicroHTML\DIV;
|
||||||
@@ -798,6 +798,20 @@ function SHM_SUBMIT(string $text, array $args=[]): HTMLElement
|
|||||||
return INPUT($args);
|
return INPUT($args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SHM_A(string $href, string|HTMLElement $text, string $id="", string $class="", array $args=[]): HTMLElement
|
||||||
|
{
|
||||||
|
$args["href"] = make_link($href);
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$args["id"] = $id;
|
||||||
|
}
|
||||||
|
if ($class) {
|
||||||
|
$args["class"] = $class;
|
||||||
|
}
|
||||||
|
|
||||||
|
return A($args, $text);
|
||||||
|
}
|
||||||
|
|
||||||
function SHM_COMMAND_EXAMPLE(string $ex, string $desc): HTMLElement
|
function SHM_COMMAND_EXAMPLE(string $ex, string $desc): HTMLElement
|
||||||
{
|
{
|
||||||
return DIV(
|
return DIV(
|
||||||
|
@@ -23,14 +23,14 @@ class PoolsTheme extends Themelet
|
|||||||
//TODO: Use a 3 column table?
|
//TODO: Use a 3 column table?
|
||||||
$linksPools = emptyHTML();
|
$linksPools = emptyHTML();
|
||||||
foreach ($navIDs as $poolID => $poolInfo) {
|
foreach ($navIDs as $poolID => $poolInfo) {
|
||||||
$div = DIV(A(["href"=>make_link("pool/view/" . $poolID)], $poolInfo["info"]->title));
|
$div = DIV(SHM_A("pool/view/" . $poolID, $poolInfo["info"]->title));
|
||||||
|
|
||||||
if (!empty($poolInfo["nav"])) {
|
if (!empty($poolInfo["nav"])) {
|
||||||
if (!empty($poolInfo["nav"]["prev"])) {
|
if (!empty($poolInfo["nav"]["prev"])) {
|
||||||
$div->appendChild(A(["href"=>make_link("post/view/" . $poolInfo["nav"]["prev"]), "class"=>"pools_prev_img"], "Prev"));
|
$div->appendChild(SHM_A("post/view/" . $poolInfo["nav"]["prev"], "Prev", class: "pools_prev_img"));
|
||||||
}
|
}
|
||||||
if (!empty($poolInfo["nav"]["next"])) {
|
if (!empty($poolInfo["nav"]["next"])) {
|
||||||
$div->appendChild(A(["href"=>make_link("post/view/" . $poolInfo["nav"]["next"]), "class"=>"pools_next_img"], "Next"));
|
$div->appendChild(SHM_A("post/view/" . $poolInfo["nav"]["next"], "Next", class: "pools_next_img"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,8 +60,8 @@ class PoolsTheme extends Themelet
|
|||||||
// Build up the list of pools.
|
// Build up the list of pools.
|
||||||
$pool_rows = [];
|
$pool_rows = [];
|
||||||
foreach ($pools as $pool) {
|
foreach ($pools as $pool) {
|
||||||
$pool_link = A(["href"=>make_link("pool/view/" . $pool->id)], $pool->title);
|
$pool_link = SHM_A("pool/view/" . $pool->id, $pool->title);
|
||||||
$user_link = A(["href"=>make_link("user/" . url_escape($pool->user_name))], $pool->user_name);
|
$user_link = SHM_A("user/" . url_escape($pool->user_name), $pool->user_name);
|
||||||
|
|
||||||
$pool_rows[] = TR(
|
$pool_rows[] = TR(
|
||||||
TD(["class"=>"left"], $pool_link),
|
TD(["class"=>"left"], $pool_link),
|
||||||
@@ -113,11 +113,11 @@ class PoolsTheme extends Themelet
|
|||||||
$page->set_heading($heading);
|
$page->set_heading($heading);
|
||||||
|
|
||||||
$poolnav = emptyHTML(
|
$poolnav = emptyHTML(
|
||||||
A(["href"=>make_link("pool/list")], "Pool Index"),
|
SHM_A("pool/list", "Pool Index"),
|
||||||
BR(),
|
BR(),
|
||||||
A(["href"=>make_link("pool/new")], "Create Pool"),
|
SHM_A("pool/new", "Create Pool"),
|
||||||
BR(),
|
BR(),
|
||||||
A(["href"=>make_link("pool/updated")], "Pool Changes")
|
SHM_A("pool/updated", "Pool Changes")
|
||||||
);
|
);
|
||||||
|
|
||||||
$page->add_block(new NavBlock());
|
$page->add_block(new NavBlock());
|
||||||
@@ -349,9 +349,9 @@ class PoolsTheme extends Themelet
|
|||||||
|
|
||||||
$body = [];
|
$body = [];
|
||||||
foreach ($histories as $history) {
|
foreach ($histories as $history) {
|
||||||
$pool_link = A(["href"=>make_link("pool/view/" . $history["pool_id"])], $history["title"]);
|
$pool_link = SHM_A("pool/view/" . $history["pool_id"], $history["title"]);
|
||||||
$user_link = A(["href"=>make_link("user/" . url_escape($history["user_name"]))], $history["user_name"]);
|
$user_link = SHM_A("user/" . url_escape($history["user_name"]), $history["user_name"]);
|
||||||
$revert_link = A(["href"=>make_link("pool/revert/" . $history["id"])], "Revert");
|
$revert_link = SHM_A(("pool/revert/" . $history["id"]), "Revert");
|
||||||
|
|
||||||
if ($history['action'] == 1) {
|
if ($history['action'] == 1) {
|
||||||
$prefix = "+";
|
$prefix = "+";
|
||||||
@@ -366,7 +366,7 @@ class PoolsTheme extends Themelet
|
|||||||
|
|
||||||
$image_links = emptyHTML();
|
$image_links = emptyHTML();
|
||||||
foreach ($images as $image) {
|
foreach ($images as $image) {
|
||||||
$image_links->appendChild(" ", A(["href"=>make_link("post/view/" . $image)], $prefix . $image));
|
$image_links->appendChild(" ", SHM_A("post/view/" . $image, $prefix . $image));
|
||||||
}
|
}
|
||||||
|
|
||||||
$body[] = TR(
|
$body[] = TR(
|
||||||
|
Reference in New Issue
Block a user