omnia: start
This commit is contained in:
parent
b7e422c701
commit
c2ee3e24bc
@ -26,6 +26,10 @@
|
|||||||
"app\\ic\\": [
|
"app\\ic\\": [
|
||||||
"src/lib/ic",
|
"src/lib/ic",
|
||||||
"src/handlers/ic"
|
"src/handlers/ic"
|
||||||
|
],
|
||||||
|
"app\\omnia\\": [
|
||||||
|
"src/lib/omnia",
|
||||||
|
"src/handlers/omnia"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@ subdomains:
|
|||||||
dev: foreignone
|
dev: foreignone
|
||||||
ic: ic
|
ic: ic
|
||||||
icdev: ic
|
icdev: ic
|
||||||
|
omnia: omnia
|
||||||
|
omniadev: omnia
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
host: "127.0.0.1"
|
host: "127.0.0.1"
|
||||||
|
@ -22,7 +22,7 @@ while [ $# -gt 0 ]; do
|
|||||||
done
|
done
|
||||||
[ -z "$OUTPUT_ROOT_DIR" ] && die "you must specify output directory"
|
[ -z "$OUTPUT_ROOT_DIR" ] && die "you must specify output directory"
|
||||||
|
|
||||||
for project in ic foreignone; do
|
for project in ic foreignone omnia; do
|
||||||
"$SCRIPT_DIR"/util/build_css.sh -i "$APP_DIR/public/$project/scss" -o "$OUTPUT_ROOT_DIR/public/$project/dist-css" || die "build_css failed"
|
"$SCRIPT_DIR"/util/build_css.sh -i "$APP_DIR/public/$project/scss" -o "$OUTPUT_ROOT_DIR/public/$project/dist-css" || die "build_css failed"
|
||||||
"$SCRIPT_DIR"/util/build_js.sh -i "$APP_DIR/public/common/js" -o "$OUTPUT_ROOT_DIR/public/$project/dist-js" || die "build_js failed"
|
"$SCRIPT_DIR"/util/build_js.sh -i "$APP_DIR/public/common/js" -o "$OUTPUT_ROOT_DIR/public/$project/dist-js" || die "build_js failed"
|
||||||
$PHP "$SCRIPT_DIR"/util/gen_runtime_config.php \
|
$PHP "$SCRIPT_DIR"/util/gen_runtime_config.php \
|
||||||
|
@ -28,7 +28,7 @@ $hashes = [
|
|||||||
'assets' => []
|
'assets' => []
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach (['ic', 'foreignone'] as $project) {
|
foreach (['ic', 'foreignone', 'omnia'] as $project) {
|
||||||
foreach (['js', 'css'] as $type) {
|
foreach (['js', 'css'] as $type) {
|
||||||
$dist_dir = $app_root.'/public/'.$project.'/dist-'.$type;
|
$dist_dir = $app_root.'/public/'.$project.'/dist-'.$type;
|
||||||
$entries = glob_recursive($dist_dir.'/*.'.$type);
|
$entries = glob_recursive($dist_dir.'/*.'.$type);
|
||||||
|
@ -77,6 +77,7 @@
|
|||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
color: $dark-grey; // color of separators
|
color: $dark-grey; // color of separators
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
a.head-item {
|
a.head-item {
|
||||||
border: 1px $head-items-border solid;
|
border: 1px $head-items-border solid;
|
||||||
|
@ -11,6 +11,9 @@ textarea {
|
|||||||
.head, .head-inner, .head-logo-wrap, .head-items, .head-logo {
|
.head, .head-inner, .head-logo-wrap, .head-items, .head-logo {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
.head-items {
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
.head {
|
.head {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-bottom: 1px $border-color solid;
|
border-bottom: 1px $border-color solid;
|
||||||
|
BIN
public/omnia/favicon.ico
Normal file
BIN
public/omnia/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
public/omnia/favicon.png
Normal file
BIN
public/omnia/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
3
public/omnia/scss/common.scss
Normal file
3
public/omnia/scss/common.scss
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@import "../../common/scss/app/common";
|
||||||
|
@import "../../common/scss/app/head";
|
||||||
|
@import "../../common/scss/app/foot";
|
2
public/omnia/scss/common@dark.scss
Normal file
2
public/omnia/scss/common@dark.scss
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
@import '../../common/scss/colors/dark';
|
||||||
|
@import './common';
|
2
public/omnia/scss/common@light.scss
Normal file
2
public/omnia/scss/common@light.scss
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
@import '../../common/scss/colors/light';
|
||||||
|
@import './common';
|
2
public/omnia/scss/targets.txt
Normal file
2
public/omnia/scss/targets.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
common
|
||||||
|
admin
|
@ -45,6 +45,7 @@ abstract class RequestHandler
|
|||||||
|
|
||||||
$router = router::getInstance();
|
$router = router::getInstance();
|
||||||
$route = $router->find($uri);
|
$route = $router->find($uri);
|
||||||
|
|
||||||
if ($route === null)
|
if ($route === null)
|
||||||
throw new NotFound('Route not found');
|
throw new NotFound('Route not found');
|
||||||
|
|
||||||
|
25
src/handlers/omnia/BaseHandler.php
Normal file
25
src/handlers/omnia/BaseHandler.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\omnia;
|
||||||
|
|
||||||
|
use engine\http\RequestHandler;
|
||||||
|
use engine\skin\BaseSkin;
|
||||||
|
|
||||||
|
abstract class BaseHandler
|
||||||
|
extends RequestHandler
|
||||||
|
{
|
||||||
|
public readonly BaseSkin $skin;
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
$this->skin = new OmniaSkin();
|
||||||
|
$this->skin->strings->load('omnia');
|
||||||
|
$this->skin->addStatic(
|
||||||
|
'css/common.css',
|
||||||
|
'js/common.js'
|
||||||
|
);
|
||||||
|
$this->skin->setGlobal([
|
||||||
|
'is_admin' => isAdmin(),
|
||||||
|
'is_dev' => isDev()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
24
src/handlers/omnia/MainHandler.php
Normal file
24
src/handlers/omnia/MainHandler.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\omnia;
|
||||||
|
|
||||||
|
use engine\http\errors\Forbidden;
|
||||||
|
|
||||||
|
class MainHandler
|
||||||
|
extends BaseHandler
|
||||||
|
{
|
||||||
|
public function beforeDispatch(string $http_method, string $action) {
|
||||||
|
if (!isAdmin())
|
||||||
|
throw new Forbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function GET_index() {
|
||||||
|
$this->skin->meta->title = lang('meta_index_title');
|
||||||
|
$this->skin->meta->description = lang('meta_index_description');
|
||||||
|
$this->skin->meta->url = 'https://'.$_SERVER['HTTP_HOST'].'/';
|
||||||
|
|
||||||
|
$this->skin->options->isIndex = true;
|
||||||
|
|
||||||
|
return $this->skin->renderPage('index.twig');
|
||||||
|
}
|
||||||
|
}
|
@ -96,6 +96,7 @@ class ForeignOneSkin
|
|||||||
'admin_email' => $config['admin_email'],
|
'admin_email' => $config['admin_email'],
|
||||||
'script_html' => $this->getFooterScriptTags(),
|
'script_html' => $this->getFooterScriptTags(),
|
||||||
'theme' => ThemesUtil::getUserTheme(),
|
'theme' => ThemesUtil::getUserTheme(),
|
||||||
|
'omnia_url' => 'https://omnia'.(isDev() ? 'dev' : '').'.'.$config['domain'],
|
||||||
];
|
];
|
||||||
return $this->doRender('footer.twig', $footer_vars);
|
return $this->doRender('footer.twig', $footer_vars);
|
||||||
}
|
}
|
||||||
|
78
src/lib/omnia/OmniaSkin.php
Normal file
78
src/lib/omnia/OmniaSkin.php
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\omnia;
|
||||||
|
|
||||||
|
use app\ThemesUtil;
|
||||||
|
use engine\http\Response;
|
||||||
|
use Twig\Loader\FilesystemLoader;
|
||||||
|
use Twig\Loader\LoaderInterface;
|
||||||
|
|
||||||
|
class OmniaSkin
|
||||||
|
extends \engine\skin\FeaturedSkin
|
||||||
|
{
|
||||||
|
public OmniaSkinOptions $options;
|
||||||
|
public string $title {
|
||||||
|
get {
|
||||||
|
$title = isset($this->title) && $this->title ? $this->title : lang('site_title');
|
||||||
|
if (!$this->options->isIndex)
|
||||||
|
$title = $title.' - Omnia';
|
||||||
|
return $title;
|
||||||
|
}
|
||||||
|
|
||||||
|
set(string $title) {
|
||||||
|
$this->title = $title;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$this->options = new OmniaSkinOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getTwigLoader(): LoaderInterface {
|
||||||
|
$twig_loader = new FilesystemLoader(APP_ROOT.'/src/skins/omnia', APP_ROOT);
|
||||||
|
return $twig_loader;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getCacheDir(): string {
|
||||||
|
global $config;
|
||||||
|
return $config['skin_cache_'.(isDev() ? 'dev' : 'prod').'_dir'].'/omnia';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function renderHeader(): string {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$vars = [
|
||||||
|
'title' => $this->title,
|
||||||
|
'meta_html' => $this->meta->getHtml(),
|
||||||
|
'static_html' => $this->getHeaderStaticTags(),
|
||||||
|
'svg_html' => $this->getSVGTags(),
|
||||||
|
'render_options' => $this->options->getOptions(),
|
||||||
|
'home_url' => 'https://'.(isDev() ? 'dev.' : '').$config['domain'],
|
||||||
|
'app_config' => [
|
||||||
|
'domain' => $config['domain'],
|
||||||
|
'devMode' => isDev(),
|
||||||
|
'cookieHost' => $config['cookie_host'],
|
||||||
|
],
|
||||||
|
'theme' => ThemesUtil::getUserTheme(),
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->doRender('header.twig', $vars);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function renderBody(string $template, array $vars): string {
|
||||||
|
return $this->doRender($template, $this->vars + $vars);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function renderFooter(): string {
|
||||||
|
global $config;
|
||||||
|
$footer_vars = [
|
||||||
|
'exec_time' => getExecutionTime(),
|
||||||
|
'render_options' => $this->options->getOptions(),
|
||||||
|
'admin_email' => $config['admin_email'] ?? '',
|
||||||
|
'script_html' => $this->getFooterScriptTags(),
|
||||||
|
'theme' => ThemesUtil::getUserTheme(),
|
||||||
|
];
|
||||||
|
return $this->doRender('footer.twig', $footer_vars);
|
||||||
|
}
|
||||||
|
}
|
9
src/lib/omnia/OmniaSkinOptions.php
Normal file
9
src/lib/omnia/OmniaSkinOptions.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\omnia;
|
||||||
|
|
||||||
|
class OmniaSkinOptions
|
||||||
|
extends \engine\skin\Options
|
||||||
|
{
|
||||||
|
public bool $isIndex = false;
|
||||||
|
}
|
@ -62,5 +62,13 @@ return [
|
|||||||
'tbc/(\d+|appendix)/' => 'tzo_part part=$(1)',
|
'tbc/(\d+|appendix)/' => 'tzo_part part=$(1)',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
})(),
|
||||||
|
|
||||||
|
'omnia' => (function() {
|
||||||
|
return [
|
||||||
|
'Main' => [
|
||||||
|
'/' => 'index',
|
||||||
|
],
|
||||||
|
];
|
||||||
})()
|
})()
|
||||||
];
|
];
|
||||||
|
@ -30,7 +30,7 @@ body {
|
|||||||
width: 220px;
|
width: 220px;
|
||||||
height: 220px;
|
height: 220px;
|
||||||
display: block;
|
display: block;
|
||||||
background: url("/img/eagle.jpg") no-repeat center center;
|
background: url("https://4in1.ws/img/eagle.jpg") no-repeat center center;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
<div class="footer-left">
|
<div class="footer-left">
|
||||||
Theme: <a id="switch-theme" href="javascript:void(0)" onclick="return ThemeSwitcher.next(event)">{{ theme }}</a>
|
Theme: <a id="switch-theme" href="javascript:void(0)" onclick="return ThemeSwitcher.next(event)">{{ theme }}</a>
|
||||||
{% if is_admin %}
|
{% if is_admin %}
|
||||||
<span class="footer-separator">|</span> <a href="/admin/">Admin panel</a>
|
<span class="footer-separator">|</span> <a href="/admin/">Admin</a>
|
||||||
|
<span class="footer-separator">|</span> <a href="{{ omnia_url }}">Omnia</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -36,7 +36,13 @@
|
|||||||
wiki
|
wiki
|
||||||
</a><a class="head-item {% if render_options.head_section == 'about' %} is-selected{% endif %}" href="/info/">
|
</a><a class="head-item {% if render_options.head_section == 'about' %} is-selected{% endif %}" href="/info/">
|
||||||
about
|
about
|
||||||
</a><a class="head-item is-ic" href="{{ ic_url }}">
|
</a><!--
|
||||||
|
{%- if is_admin -%}
|
||||||
|
<a class="head-item" href="{{ omnia_url }}">
|
||||||
|
omnia
|
||||||
|
</a>
|
||||||
|
{%- endif -%}
|
||||||
|
--><a class="head-item is-ic" href="{{ ic_url }}">
|
||||||
invisible college {{ svgInPlace('college_20') }}
|
invisible college {{ svgInPlace('college_20') }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
21
src/skins/omnia/footer.twig
Normal file
21
src/skins/omnia/footer.twig
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="footer">
|
||||||
|
<div class="footer-right">
|
||||||
|
Email: <a href="mailto:{{ admin_email }}">{{ admin_email }}</a>
|
||||||
|
</div>
|
||||||
|
<div class="footer-left">
|
||||||
|
Theme: <a id="switch-theme" href="javascript:void(0)" onclick="return ThemeSwitcher.next(event)">{{ theme }}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{ script_html|raw }}
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
{% if is_admin %}
|
||||||
|
<!-- {{ exec_time }} s -->
|
||||||
|
{% endif %}
|
34
src/skins/omnia/header.twig
Normal file
34
src/skins/omnia/header.twig
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||||
|
<link rel="icon" href="/favicon.png?v=2" type="image/png">
|
||||||
|
<link rel="icon" href="/favicon.ico?v=2" type="image/x-icon">
|
||||||
|
<title>{{ title }}</title>
|
||||||
|
<script type="text/javascript">window.appConfig = {{ app_config|json_encode|raw }};</script>
|
||||||
|
{{ meta_html|raw }}
|
||||||
|
{{ static_html|raw }}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{{ svg_html|raw }}
|
||||||
|
<div class="page-content base-width">
|
||||||
|
|
||||||
|
<div class="head no-subtitle">
|
||||||
|
<div class="head-inner">
|
||||||
|
<div class="head-logo-wrap">
|
||||||
|
<div class="head-logo">
|
||||||
|
<a href="/">
|
||||||
|
<div class="head-logo-title">Omnia</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="head-items">
|
||||||
|
<a class="head-item is-ic" href="{{ home_url }}">
|
||||||
|
foreign one {{ svgInPlace('riverbank_eagle_20') }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="page-content-inner">
|
6
src/skins/omnia/index.twig
Normal file
6
src/skins/omnia/index.twig
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<div class="page is-index">
|
||||||
|
<div class="blog-post-text">
|
||||||
|
<h1>Welcome to Omnia</h1>
|
||||||
|
<p>Hello, world.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
4
src/strings/omnia.yaml
Normal file
4
src/strings/omnia.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# common
|
||||||
|
site_title: Omnia
|
||||||
|
meta_index_title: "Omnia"
|
||||||
|
meta_index_description: "Omnia domain"
|
Loading…
x
Reference in New Issue
Block a user