From f7bfdf58def6aadc922e1632f407d1418269a0d7 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sat, 9 Jul 2022 19:40:17 +0300 Subject: initial --- skin/admin.skin.php | 344 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 344 insertions(+) create mode 100644 skin/admin.skin.php (limited to 'skin/admin.skin.php') diff --git a/skin/admin.skin.php b/skin/admin.skin.php new file mode 100644 index 0000000..f03d7ce --- /dev/null +++ b/skin/admin.skin.php @@ -0,0 +1,344 @@ + + +
+
{$ctx->lang('as_form_password')}:
+
+ +
+
+
+
+
+ +
+
+ +HTML; + +$js = << + + Sign out + +HTML; +} + + +// uploads page +// ------------ + +function uploads($ctx, $uploads, $error) { +return <<if_true($error, $ctx->formError, $error)} + +
+
+ + +
+
{$ctx->lang('blog_upload_form_file')}:
+
+ +
+
+ +
+
{$ctx->lang('blog_upload_form_custom_name')}:
+
+ +
+
+ +
+
{$ctx->lang('blog_upload_form_note')}:
+
+ +
+
+ +
+
+
+ +
+
+
+
+ +
+ {$ctx->for_each($uploads, fn($u) => $ctx->uploadsItem( + id: $u->id, + name: $u->name, + direct_url: $u->getDirectUrl(), + note: $u->note, + addslashes_note: $u->note, + markdown: $u->getMarkdown(), + size: $u->getSize(), + ))} +
+HTML; +} + +function uploadsItem($ctx, $id, $direct_url, $note, $addslashes_note, $markdown, $name, $size) { +return << + + + {$ctx->if_true($note, '
'.$note.'
')} +
{$size}
+ + +HTML; +} + +function postForm($ctx, + string|Stringable $title, + string|Stringable $text, + string|Stringable $short_name, + string|Stringable $tags = '', + bool $is_edit = false, + $error_code = null, + ?bool $saved = null, + ?bool $visible = null, + string|Stringable|null $post_url = null, + ?int $post_id = null): array { +$form_url = !$is_edit ? '/write/' : $post_url.'edit/'; + +$html = <<if_true($error_code, '
'.$ctx->lang('err_blog_'.$error_code).'
')} +{$ctx->if_true($saved, '
'.$ctx->lang('info_saved').'
')} + + + + + +
+
+ + +
+
{$ctx->lang('blog_write_form_title')}
+
+ +
+
+ +
+
{$ctx->lang('blog_write_form_text')}
+ +
+ +
+ + + + + + + + + +
+
+
{$ctx->lang('blog_write_form_tags')}
+
+ +
+
+
+
+
{$ctx->lang('blog_write_form_options')}
+
+ +
+
+
+
+
{$ctx->lang('blog_write_form_short_name')}
+
+ +
+
+
+
+
 
+
+ +
+
+
+
+
+
+
+
+
+HTML; + +$js_params = json_encode($is_edit + ? ['edit' => true, 'id' => $post_id] + : (object)[]); +$js = "AdminWriteForm.init({$js_params});"; + +return [$html, $js]; +} + + +function pageForm($ctx, + string|Stringable $title, + string|Stringable $text, + string|Stringable $short_name, + bool $is_edit = false, + $error_code = null, + ?bool $saved = null, + bool $visible = false): array { +$form_url = '/'.$short_name.'/'.($is_edit ? 'edit' : 'create').'/'; +$html = <<if_true($error_code, '
'.$ctx->lang('err_pages_'.$error_code).'
')} +{$ctx->if_true($saved, '
'.$ctx->lang('info_saved').'
')} + + + + + +
+
+ + +
+
{$ctx->lang('pages_write_form_title')}
+
+ +
+
+ +
+
{$ctx->lang('pages_write_form_text')}
+ +
+ + {$ctx->if_then_else($is_edit, + fn() => $ctx->pageFormEditOptions($short_name, $visible), + fn() => $ctx->pageFormAddOptions($short_name))} + +
+
+
+
+
+HTML; + +$js_params = json_encode(['pages' => true, 'edit' => $is_edit]); +$js = << + + + + + + + + +
+
+
{$ctx->lang('pages_write_form_short_name')}
+
+ +
+
+
+
+
{$ctx->lang('pages_write_form_options')}
+
+ +
+
+
+ +
+ +HTML; +} + +function pageFormAddOptions($ctx, $short_name) { +return << +
+
+ +
+ + +HTML; +} + +function pageNew($ctx, $short_name) { +return << + + +HTML; + +} + +// misc +function formError($ctx, $error) { +return <<{$ctx->lang('error')}: {$error} +HTML; +} + +function markdownPreview($ctx, $unsafe_html, $title) { +return << + {$ctx->if_true($title, '

'.$title.'

')} +
{$unsafe_html}
+ +HTML; + +} \ No newline at end of file -- cgit v1.2.3