mikuli.cz

:)
git clone https://git.sr.ht/~ashymad/mikuli.cz
Log | Files | Refs

commit c20ef3d9d502d4a03fd4dc3f237683b755917e1c
parent ce87cb714b210a6f9c7910a3e072d5583798b99e
Author: markseu <mark2011@mayberg.se>
Date:   Fri,  1 Feb 2019 17:36:29 +0100

updated templates and snippets

Diffstat:
MREADME.md | 2+-
Acontent/shared/footer.md | 5+++++
Msystem/config/config.ini | 3++-
Msystem/plugins/core.php | 26++++++++++++++++++++------
Msystem/plugins/update.php | 8+++++++-
Msystem/themes/assets/flatsite.css | 40+++++++++++++++++++---------------------
Msystem/themes/assets/flatsite.php | 4++--
Msystem/themes/snippets/footer.php | 5+++--
Msystem/themes/snippets/header.php | 15++++++++-------
Msystem/themes/snippets/navigation-sidebar.php | 2+-
Msystem/themes/snippets/navigation-tree.php | 10+++++-----
Msystem/themes/snippets/navigation.php | 2+-
Msystem/themes/snippets/pagination.php | 6+++---
Msystem/themes/snippets/sidebar.php | 25+++++++++++--------------
14 files changed, 88 insertions(+), 65 deletions(-)

diff --git a/README.md b/README.md @@ -5,7 +5,7 @@ Datenstrom Yellow 0.7.10 Datenstrom Yellow is for people who make websites. [See demo](https://developers.datenstrom.se/). 1. [Download Datenstrom Yellow and unzip it](https://github.com/datenstrom/yellow/archive/master.zip). -2. Copy all files to your web hosting. +2. Copy all files to your web server. 3. Open your website in a web browser. We have a developer kit and an API for developers. [Learn more](https://developers.datenstrom.se/help/). diff --git a/content/shared/footer.md b/content/shared/footer.md @@ -0,0 +1,5 @@ +--- +Title: Footer +Status: hidden +--- +[Made with Datenstrom Yellow](https://datenstrom.se/fr/yellow/) diff --git a/system/config/config.ini b/system/config/config.ini @@ -45,9 +45,10 @@ ServerUrl: StartupUpdate: none Template: default Navigation: navigation +Header: header +Footer: footer Sidebar: sidebar Siteicon: icon -Tagline: Parser: markdown MultiLanguageMode: 0 SafeMode: 0 diff --git a/system/plugins/core.php b/system/plugins/core.php @@ -4,7 +4,7 @@ // This file may be used and distributed under the terms of the public license. class YellowCore { - const VERSION = "0.7.10"; + const VERSION = "0.8.1"; public $page; //current page public $pages; //pages from file system public $files; //files from file system @@ -70,9 +70,10 @@ class YellowCore { $this->config->setDefault("startupUpdate", "none"); $this->config->setDefault("template", "default"); $this->config->setDefault("navigation", "navigation"); + $this->config->setDefault("header", "header"); + $this->config->setDefault("footer", "footer"); $this->config->setDefault("sidebar", "sidebar"); $this->config->setDefault("siteicon", "icon"); - $this->config->setDefault("tagline", ""); $this->config->setDefault("parser", "markdown"); $this->config->setDefault("multiLanguageMode", "0"); $this->config->setDefault("safeMode", "0"); @@ -444,7 +445,7 @@ class YellowPage { $this->set("title", $this->yellow->toolbox->createTextTitle($this->location)); $this->set("language", $this->yellow->lookup->findLanguageFromFile($this->fileName, $this->yellow->config->get("language"))); $this->set("modified", date("Y-m-d H:i:s", $this->yellow->toolbox->getFileModified($this->fileName))); - $this->parseMetaRaw(array("theme", "template", "sitename", "siteicon", "tagline", "author", "navigation", "sidebar", "parser")); + $this->parseMetaRaw(array("theme", "template", "sitename", "siteicon", "author", "navigation", "header", "footer", "sidebar", "parser")); $titleHeader = ($this->location==$this->yellow->pages->getHomeLocation($this->location)) ? $this->get("sitename") : $this->get("title")." - ".$this->get("sitename"); if (!$this->isExisting("titleContent")) $this->set("titleContent", $this->get("title")); @@ -834,9 +835,10 @@ class YellowPage { // Return last modification date, Unix time or HTTP format public function getLastModified($httpFormat = false) { - $modified = max($this->lastModified, $this->getModified(), $this->yellow->config->getModified(), - $this->yellow->text->getModified(), $this->yellow->plugins->getModified()); - return $httpFormat ? $this->yellow->toolbox->getHttpDateFormatted($modified) : $modified; + $lastModified = max($this->lastModified, $this->getModified(), $this->pageCollection->getModified(), + $this->yellow->config->getModified(), $this->yellow->text->getModified(), $this->yellow->plugins->getModified()); + foreach ($this->pageRelations as $page) $lastModified = max($lastModified, $page->getModified()); + return $httpFormat ? $this->yellow->toolbox->getHttpDateFormatted($lastModified) : $lastModified; } // Return page status code, number or HTTP format @@ -1247,6 +1249,18 @@ class YellowPages { return $pages; } + // Return page with shared content, null if not found + public function shared($location, $absoluteLocation = false, $name = "shared") { + if ($absoluteLocation) $location = substru($location, strlenu($this->yellow->page->base)); + $locationShared = $this->yellow->lookup->getDirectoryLocation($location); + $page = $this->find($locationShared.$name); + if ($page==null) { + $locationShared = $this->getHomeLocation($location).$this->yellow->config->get("contentSharedDir"); + $page = $this->find($locationShared.$name); + } + return $page; + } + // Return page collection with multiple languages public function multi($location, $absoluteLocation = false, $showInvisible = false) { $pages = new YellowPageCollection($this->yellow); diff --git a/system/plugins/update.php b/system/plugins/update.php @@ -4,7 +4,7 @@ // This file may be used and distributed under the terms of the public license. class YellowUpdate { - const VERSION = "0.7.26"; + const VERSION = "0.8.1"; const PRIORITY = "2"; public $yellow; //access to API public $updates; //number of updates @@ -29,6 +29,12 @@ class YellowUpdate { if ($this->yellow->config->get("staticDir")=="cache/") { $this->yellow->config->save($fileNameConfig, array("staticDir" => "public/")); } + if ($this->yellow->config->isExisting("tagline")) { + $fileNameHeader = $this->yellow->config->get("contentDir").$this->yellow->config->get("contentSharedDir"); + $fileNameHeader .= "header".$this->yellow->config->get("contentExtension"); + $fileDataHeader = "---\nTitle: Header\nStatus: hidden\n---\n".$this->yellow->config->get("tagline"); + if (!is_file($fileNameHeader)) $this->yellow->toolbox->createFile($fileNameHeader, $fileDataHeader, true); + } } if ($update) { //TODO: remove later, converts old robots file $fileNameRobots = $this->yellow->config->get("configDir")."robots.txt"; diff --git a/system/themes/assets/flatsite.css b/system/themes/assets/flatsite.css @@ -1,5 +1,5 @@ /* Flatsite theme, https://github.com/datenstrom/yellow-themes/tree/master/flatsite */ -/* Copyright (c) 2013-2018 Datenstrom, https://datenstrom.se */ +/* Copyright (c) 2013-2019 Datenstrom, https://datenstrom.se */ /* This file may be used and distributed under the terms of the public license. */ html, body, div, form, pre, span, tr, th, td, img { @@ -210,19 +210,25 @@ a:hover { .header .sitename { display: block; float: left; + margin-top: 0.25em; + margin-bottom: 1em; } .header .sitename h1 { - margin: 0; + margin:0; + font-size: 1em; + font-weight: 300; } .header .sitename h1 a { color: #111; text-decoration: none; } -.header .sitename h2 { +.header .sitename h1 a:hover { + color: #07d; + text-decoration: underline; +} +.header .sitename p { margin-top: 0; - color: #717171; - font-size: 1em; - font-weight: 300; + color: #111; } /* Navigation */ @@ -230,10 +236,7 @@ a:hover { .navigation { display: block; float: right; -} -.navigation { - margin-top: 0.9em; - margin-bottom: 0.9em; + margin-bottom: 1em; line-height: 2; } .navigation a { @@ -250,10 +253,7 @@ a:hover { .navigation-tree { display: block; float: right; -} -.navigation-tree { - margin-top: 0.9em; - margin-bottom: 0.9em; + margin-bottom: 1em; line-height: 2; } .navigation-tree a { @@ -296,7 +296,7 @@ a:hover { clear: both; } .navigation-search { - padding-bottom: 1em; + padding-bottom: 0.75em; } .navigation-search .search-form { position: relative; @@ -337,7 +337,7 @@ a:hover { /* Footer */ .footer { - margin-top: 2em; + margin-top: 1em; } .footer .siteinfo a { color: #07d; @@ -505,13 +505,10 @@ a:hover { margin: 0.5em; font-size: 0.9em; } - .header .sitename h1, .content h1, .content h2 { font-size: 1.3em; } - .header .sitename h1, - .header .sitename h2, .footer, .page { margin: 0; @@ -522,8 +519,9 @@ a:hover { .navigation-tree { float: none; } - .navigation { - margin-top: 0.5em; + .header .sitename, + .navigation, + .navigation-tree { margin-bottom: 0.5em; } .navigation-search { diff --git a/system/themes/assets/flatsite.php b/system/themes/assets/flatsite.php @@ -1,8 +1,8 @@ <?php // Flatsite theme, https://github.com/datenstrom/yellow-themes/tree/master/flatsite -// Copyright (c) 2013-2018 Datenstrom, https://datenstrom.se +// Copyright (c) 2013-2019 Datenstrom, https://datenstrom.se // This file may be used and distributed under the terms of the public license. class YellowThemeFlatsite { - const VERSION = "0.7.6"; + const VERSION = "0.8.1"; } diff --git a/system/themes/snippets/footer.php b/system/themes/snippets/footer.php @@ -1,7 +1,8 @@ <div class="footer" role="contentinfo"> <div class="siteinfo"> -<a href="<?php echo $yellow->page->base."/" ?>">&copy; 2019 <?php echo $yellow->page->getHtml("sitename") ?></a>. -<a href="<?php echo $yellow->text->get("yellowUrl") ?>">Made with Datenstrom Yellow</a>. +<?php if ($yellow->page->isPage("footer")) echo $yellow->page->getPage("footer")->getContent() ?> +</div> +<div class="siteinfo-banner"></div> </div> </div> </div> diff --git a/system/themes/snippets/header.php b/system/themes/snippets/header.php @@ -10,16 +10,17 @@ <?php echo $yellow->page->getExtra("header") ?> </head> <body> -<?php $yellow->page->set("pageClass", "page") ?> -<?php $yellow->page->set("pageClass", $yellow->page->get("pageClass")." template-".$yellow->page->get("template")) ?> -<?php if($yellow->page->get("navigation")=="navigation-sidebar") $yellow->page->setPage("sidebar", $yellow->page); ?> -<?php if($page = $yellow->pages->find($yellow->lookup->getDirectoryLocation($yellow->page->location).$yellow->page->get("sidebar"))) $yellow->page->setPage("sidebar", $page) ?> -<?php if($yellow->page->isPage("sidebar")) $yellow->page->set("pageClass", $yellow->page->get("pageClass")." with-sidebar") ?> +<?php if ($page = $yellow->pages->shared($yellow->page->location, false, $yellow->page->get("header"))) $yellow->page->setPage("header", $page) ?> +<?php if ($page = $yellow->pages->shared($yellow->page->location, false, $yellow->page->get("footer"))) $yellow->page->setPage("footer", $page) ?> +<?php if ($page = $yellow->pages->shared($yellow->page->location, false, $yellow->page->get("sidebar"))) $yellow->page->setPage("sidebar", $page) ?> +<?php if ($yellow->page->get("navigation")=="navigation-sidebar") $yellow->page->setPage("navigation-sidebar", $yellow->page->getParentTop(true)) ?> +<?php $yellow->page->set("pageClass", "page template-".$yellow->page->get("template")) ?> +<?php if (!$yellow->page->isError() && ($yellow->page->isPage("sidebar") || $yellow->page->isPage("navigation-sidebar"))) $yellow->page->set("pageClass", $yellow->page->get("pageClass")." with-sidebar") ?> <div class="<?php echo $yellow->page->getHtml("pageClass") ?>"> <div class="header" role="banner"> <div class="sitename"> -<h1><a href="<?php echo $yellow->page->base."/" ?>"><i class="sitename-logo"></i><?php echo $yellow->page->getHtml("sitename") ?></a></h1> -<?php if($yellow->page->isExisting("tagline")): ?><h2><?php echo $yellow->page->getHtml("tagline") ?></h2><?php endif ?> +<h1><a href="<?php echo $yellow->page->getBase(true)."/" ?>"><i class="sitename-logo"></i><?php echo $yellow->page->getHtml("sitename") ?></a></h1> +<?php if ($yellow->page->isPage("header")) echo $yellow->page->getPage("header")->getContent() ?> </div> <div class="sitename-banner"></div> <?php $yellow->snippet($yellow->page->get("navigation")) ?> diff --git a/system/themes/snippets/navigation-sidebar.php b/system/themes/snippets/navigation-sidebar.php @@ -2,7 +2,7 @@ <?php $yellow->page->setLastModified($pages->getModified()) ?> <div class="navigation" role="navigation"> <ul> -<?php foreach($pages as $page): ?> +<?php foreach ($pages as $page): ?> <li><a<?php echo $page->isActive() ? " class=\"active\" aria-current=\"page\"" : "" ?> href="<?php echo $page->getLocation(true) ?>"><?php echo $page->getHtml("titleNavigation") ?></a></li> <?php endforeach ?> </ul> diff --git a/system/themes/snippets/navigation-tree.php b/system/themes/snippets/navigation-tree.php @@ -1,16 +1,16 @@ <?php list($name, $pages, $level) = $yellow->getSnippetArgs() ?> -<?php if(!$pages) $pages = $yellow->pages->top() ?> +<?php if (!$pages) $pages = $yellow->pages->top() ?> <?php $yellow->page->setLastModified($pages->getModified()) ?> -<?php if(!$level): ?> +<?php if (!$level): ?> <div class="navigation-tree" role="navigation"> <?php endif ?> <ul> -<?php foreach($pages as $page): ?> +<?php foreach ($pages as $page): ?> <?php $children = $page->getChildren() ?> -<li><a<?php echo $page->isActive() ? " class=\"active\" aria-current=\"page\"" : "" ?> href="<?php echo $page->getLocation(true) ?>"><?php echo $page->getHtml("titleNavigation") ?></a><?php if($children->count()) { echo "\n"; $yellow->snippet($name, $children, $level+1); } ?></li> +<li><a<?php echo $page->isActive() ? " class=\"active\" aria-current=\"page\"" : "" ?> href="<?php echo $page->getLocation(true) ?>"><?php echo $page->getHtml("titleNavigation") ?></a><?php if ($children->count()) { echo "\n"; $yellow->snippet($name, $children, $level+1); } ?></li> <?php endforeach ?> </ul> -<?php if(!$level): ?> +<?php if (!$level): ?> </div> <div class="navigation-banner"></div> <?php endif ?> diff --git a/system/themes/snippets/navigation.php b/system/themes/snippets/navigation.php @@ -2,7 +2,7 @@ <?php $yellow->page->setLastModified($pages->getModified()) ?> <div class="navigation" role="navigation"> <ul> -<?php foreach($pages as $page): ?> +<?php foreach ($pages as $page): ?> <li><a<?php echo $page->isActive() ? " class=\"active\" aria-current=\"page\"" : "" ?> href="<?php echo $page->getLocation(true) ?>"><?php echo $page->getHtml("titleNavigation") ?></a></li> <?php endforeach ?> </ul> diff --git a/system/themes/snippets/pagination.php b/system/themes/snippets/pagination.php @@ -1,10 +1,10 @@ <?php list($name, $pages) = $yellow->getSnippetArgs() ?> -<?php if($pages->isPagination()): ?> +<?php if ($pages->isPagination()): ?> <div class="pagination" role="navigation"> -<?php if($pages->getPaginationPrevious()): ?> +<?php if ($pages->getPaginationPrevious()): ?> <a class="previous" href="<?php echo $pages->getPaginationPrevious() ?>"><?php echo $yellow->text->getHtml("paginationPrevious") ?></a> <?php endif ?> -<?php if($pages->getPaginationNext()): ?> +<?php if ($pages->getPaginationNext()): ?> <a class="next" href="<?php echo $pages->getPaginationNext() ?>"><?php echo $yellow->text->getHtml("paginationNext") ?></a> <?php endif ?> </div> diff --git a/system/themes/snippets/sidebar.php b/system/themes/snippets/sidebar.php @@ -1,24 +1,21 @@ -<?php if($yellow->page->isPage("sidebar")): ?> -<?php if($yellow->page->get("navigation")=="navigation-sidebar" && $yellow->page->getPage("sidebar")==$yellow->page): ?> -<?php $page = $yellow->page->getParentTop(true) ?> -<?php $pages = $page->getChildren(!$page->isVisible()) ?> -<?php $yellow->page->setLastModified($pages->getModified()) ?> +<?php if ($yellow->page->isPage("sidebar")): ?> +<div class="sidebar" role="complementary"> +<?php $page = $yellow->page->getPage("sidebar") ?> +<?php $page->setPage("main", $yellow->page) ?> +<?php echo $page->getContent() ?> +</div> +<?php elseif ($yellow->page->isPage("navigation-sidebar")): ?> <div class="sidebar" role="complementary"> <div class="navigation-sidebar"> +<?php $page = $yellow->page->getPage("navigation-sidebar") ?> +<?php $pages = $page->getChildren(!$page->isVisible()) ?> +<?php $yellow->page->setLastModified($pages->getModified()) ?> <p><?php echo $page->getHtml("titleNavigation") ?></p> <ul> -<?php foreach($pages as $page): ?> +<?php foreach ($pages as $page): ?> <li><a<?php echo $page->isActive() ? " class=\"active\"" : "" ?> href="<?php echo $page->getLocation(true) ?>"><?php echo $page->getHtml("titleNavigation") ?></a></li> <?php endforeach ?> </ul> </div> </div> -<?php else: ?> -<?php $page = $yellow->page->getPage("sidebar") ?> -<?php $page->setPage("main", $yellow->page) ?> -<?php $yellow->page->setLastModified($page->getModified()) ?> -<div class="sidebar" role="complementary"> -<?php echo $page->getContent() ?> -</div> -<?php endif ?> <?php endif ?>