From 1802b9c7f6314b0668ecc9ed69d1aaf5bf9d7f45 Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 23 Jan 2020 00:45:41 +0000 Subject: [PATCH] microhtml for blocks --- ext/blocks/info.php | 2 +- ext/blocks/main.php | 2 +- ext/blocks/test.php | 2 +- ext/blocks/theme.php | 66 +++++++++++++++++++++++--------------------- 4 files changed, 37 insertions(+), 35 deletions(-) diff --git a/ext/blocks/info.php b/ext/blocks/info.php index 2bf68f2b..d5c34b9c 100644 --- a/ext/blocks/info.php +++ b/ext/blocks/info.php @@ -1,4 +1,4 @@ -"; + $html = TABLE(["class"=>"form", "style"=>"width: 100%;"]); foreach ($blocks as $block) { - $html .= make_form(make_link("blocks/update")); - $html .= ""; - $html .= ""; - $html .= "Title"; - $html .= "Area"; - $html .= "Priority"; - $html .= "Pages"; - $html .= "Delete"; - $html .= ""; - $html .= ""; - $html .= ""; - $html .= ""; - $html .= "\n"; - $html .= ""; - $html .= " "; - $html .= "\n"; - $html .= "\n"; + $form = SHM_FORM(make_link("blocks/update")); + $form->appendChild(TR( + INPUT(["type"=>"hidden", "name"=>"id", "value"=>$block['id']]), + TH("Title"), TD(INPUT(["type"=>"text", "name"=>"title", "value"=>$block['title']])), + TH("Area"), TD(INPUT(["type"=>"text", "name"=>"area", "value"=>$block['area']])), + TH("Priority"), TD(INPUT(["type"=>"text", "name"=>"priority", "value"=>$block['priority']])), + TH("Pages"), TD(INPUT(["type"=>"text", "name"=>"pages", "value"=>$block['pages']])), + TH("Delete"), TD(INPUT(["type"=>"checkbox", "name"=>"delete"])), + TD(INPUT(["type"=>"submit", "value"=>"Save"])) + )); + $form->appendChild(TR( + TD(["colspan"=>"11"], TEXTAREA(["rows"=>"5", "name"=>"content"], $block['content'])) + )); + $form->appendChild(TR( + TD(["colspan"=>"11"], rawHTML(" ")) + )); + $html->appendChild($form); } - $html .= make_form(make_link("blocks/add")); - $html .= ""; - $html .= "Title"; - $html .= "Area"; - $html .= "Priority"; - $html .= "Pages"; - $html .= ""; - $html .= ""; - $html .= ""; - $html .= ""; - $html .= "\n"; - $html .= ""; - $html .= ""; + + $form = SHM_FORM(make_link("blocks/add")); + $form->appendChild(TR( + TH("Title"), TD(INPUT(["type"=>"text", "name"=>"title", "value"=>""])), + TH("Area"), TD(SELECT(["name"=>"area"], OPTION("left"), OPTION("main")), + TH("Priority"), TD(INPUT(["type"=>"text", "name"=>"priority", "value"=>'50'])), + TH("Pages"), TD(INPUT(["type"=>"text", "name"=>"pages", "value"=>'post/list*'])), + TD(["colspan"=>'3'], INPUT(["type"=>"submit", "value"=>"Add"])) + ))); + $form->appendChild(TR( + TD(["colspan"=>"11"], TEXTAREA(["rows"=>"5", "name"=>"content"])) + )); + $html->appendChild($form); $page->set_title("Blocks"); $page->set_heading("Blocks");