make_link($target), "method"=>$method ]; if ($form_id) { $attrs["id"] = $form_id; } if ($multipart) { $attrs["enctype"] = 'multipart/form-data'; } if ($onsubmit) { $attrs["onsubmit"] = $onsubmit; } if ($name) { $attrs["name"] = $name; } return FORM( $attrs, INPUT(["type"=>"hidden", "name"=>"q", "value"=>$target]), $method == "GET" ? "" : $user->get_auth_microhtml() ); } function SHM_SIMPLE_FORM($target, ...$children): HTMLElement { $form = SHM_FORM($target); $form->appendChild(emptyHTML(...$children)); return $form; } function SHM_SUBMIT(string $text, array $args=[]): HTMLElement { $args["type"] = "submit"; $args["value"] = $text; 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 { return DIV( ["class"=>"command_example"], PRE($ex), P($desc) ); } function SHM_USER_FORM(User $duser, string $target, string $title, $body, $foot): HTMLElement { if (is_string($foot)) { $foot = TFOOT(TR(TD(["colspan"=>"2"], INPUT(["type"=>"submit", "value"=>$foot])))); } return SHM_SIMPLE_FORM( $target, P( INPUT(["type"=>'hidden', "name"=>'id', "value"=>$duser->id]), TABLE( ["class"=>"form"], THEAD(TR(TH(["colspan"=>"2"], $title))), $body, $foot ) ) ); } /** * Generates a . * @param array $options An array of pairs of parameters for