Przeglądaj źródła

Version 1.3.6 Bugfixes

trendschau 5 lat temu
rodzic
commit
deaf127212

+ 8 - 0
content/.yaml

@@ -0,0 +1,8 @@
+meta:
+    title: 'Hidden Folder'
+    description: Content
+    author: 'Sebastian Schürmanns'
+    created: '2020-05-02'
+    time: 12-41-06
+    navtitle: null
+    modified: '2020-05-02'

BIN
media/live/altdruck.png


BIN
media/live/ivan-bandura-cnsuw8uth-e-unsplash.jpeg


BIN
media/live/knowledge.jpeg


BIN
media/original/altdruck.png


BIN
media/original/ivan-bandura-cnsuw8uth-e-unsplash.jpeg


BIN
media/original/knowledge.jpeg


BIN
media/thumbs/altdruck.png


BIN
media/thumbs/ivan-bandura-cnsuw8uth-e-unsplash.jpeg


BIN
media/thumbs/knowledge.jpeg


+ 8 - 5
system/Controllers/MetaApiController.php

@@ -37,14 +37,17 @@ class MetaApiController extends ContentController
 		}
 
 		# loop through all plugins
-		foreach($this->settings['plugins'] as $name => $plugin)
+		if(!empty($this->settings['plugins']))
 		{
-			if($plugin['active'])
+			foreach($this->settings['plugins'] as $name => $plugin)
 			{
-				$pluginSettings = \Typemill\Settings::getObjectSettings('plugins', $name);
-				if($pluginSettings && isset($pluginSettings['metatabs']))
+				if($plugin['active'])
 				{
-					$metatabs = array_merge_recursive($metatabs, $pluginSettings['metatabs']);
+					$pluginSettings = \Typemill\Settings::getObjectSettings('plugins', $name);
+					if($pluginSettings && isset($pluginSettings['metatabs']))
+					{
+						$metatabs = array_merge_recursive($metatabs, $pluginSettings['metatabs']);
+					}
 				}
 			}
 		}

+ 37 - 20
system/Controllers/PageController.php

@@ -9,7 +9,6 @@ use Typemill\Models\WriteYaml;
 use Typemill\Models\WriteMeta;
 use \Symfony\Component\Yaml\Yaml;
 use Typemill\Models\VersionCheck;
-use Typemill\Models\Helpers;
 use Typemill\Models\Markdown;
 use Typemill\Events\OnPagetreeLoaded;
 use Typemill\Events\OnBreadcrumbLoaded;
@@ -39,17 +38,17 @@ class PageController extends Controller
 
 		try
 		{
-			/* if the cached structure is still valid, use it */
+			# if the cached structure is still valid, use it
 			if($cache->validate('cache', 'lastCache.txt', 600))
 			{
 				$structure	= $this->getCachedStructure($cache);
 			}
 			if(!isset($structure) OR !$structure) 
 			{
-				/* if not, get a fresh structure of the content folder */
+				# if not, get a fresh structure of the content folder
 				$structure 	= $this->getFreshStructure($pathToContent, $cache, $uri);
 
-				/* if there is no structure at all, the content folder is probably empty */
+				# if there is no structure at all, the content folder is probably empty
 				if(!$structure)
 				{
 					$content = '<h1>No Content</h1><p>Your content folder is empty.</p>'; 
@@ -58,13 +57,13 @@ class PageController extends Controller
 				}
 				elseif(!$cache->validate('cache', 'lastSitemap.txt', 86400))
 				{
-					/* update sitemap */
+					# update sitemap
 					$sitemap = new WriteSitemap();
 					$sitemap->updateSitemap('cache', 'sitemap.xml', 'lastSitemap.txt', $structure, $uri->getBaseUrl());
 				}
 			}
 			
-			/* dispatch event and let others manipulate the structure */
+			# dispatch event and let others manipulate the structure
 			$structure = $this->c->dispatcher->dispatch('onPagetreeLoaded', new OnPagetreeLoaded($structure))->getData();
 		}
 		catch (Exception $e)
@@ -86,31 +85,45 @@ class PageController extends Controller
 		{
 			$home = true;
 			$item = Folder::getItemForUrl($navigation, $uri->getBasePath(), $uri->getBasePath());
-			$urlRel = $uri->getBasePath();		
+			$urlRel = $uri->getBasePath();
 		}
 		else
 		{
-			/* get the request url */
+			# get the request url
 			$urlRel = $uri->getBasePath() . '/' . $args['params'];
 			
-			/* find the url in the content-item-tree and return the item-object for the file */
+			# find the url in the content-item-tree and return the item-object for the file
+			# important to use the structure here so it is found, even if the item is hidden.
 			$item = Folder::getItemForUrl($structure, $urlRel, $uri->getBasePath());
 
-			/* if there is still no item, return a 404-page */
+			# if there is still no item, return a 404-page
 			if(!$item)
 			{
 				return $this->render404($response, array( 'navigation' => $navigation, 'settings' => $settings,  'base_url' => $base_url )); 
 			}
 
-			/* get breadcrumb for page */
-			$breadcrumb = Folder::getBreadcrumb($structure, $item->keyPathArray);
-			$breadcrumb = $this->c->dispatcher->dispatch('onBreadcrumbLoaded', new OnBreadcrumbLoaded($breadcrumb))->getData();
+			if(!$item->hide)
+			{
+				# get breadcrumb for page and set pages active
+				# use navigation, the hidden pages won't get a breadcrumb
+				$breadcrumb = Folder::getBreadcrumb($navigation, $item->keyPathArray);
+				$breadcrumb = $this->c->dispatcher->dispatch('onBreadcrumbLoaded', new OnBreadcrumbLoaded($breadcrumb))->getData();
 
-			# set pages active for navigation again
-			Folder::getBreadcrumb($structure, $item->keyPathArray);
-			
-			/* add the paging to the item */
-			$item = Folder::getPagingForItem($navigation, $item);
+				# set pages active for navigation again
+				# Folder::getBreadcrumb($navigation, $item->keyPathArray);
+				
+				# add the paging to the item
+				$item = Folder::getPagingForItem($navigation, $item);
+			}
+		}
+
+		if(isset($item->hide) && $item->hide) 
+		{
+			# delete the paging elements
+			$item->thisChapter = false;
+			$item->nextItem = false;
+			$item->prevItem = false;
+			$breadcrumb = false;
 		}
 
 		# dispatch the item
@@ -124,8 +137,12 @@ class PageController extends Controller
 		{
 			$filePath 	= $filePath . DIRECTORY_SEPARATOR . 'index.md';
 
-			# use navigation instead of structure to get
-			$item = Folder::getItemForUrl($navigation, $urlRel, $uri->getBasePath());
+			# if folder is not hidden
+			if(isset($item->hide) && !$item->hide)
+			{
+				# use the navigation instead of the structure so that hidden elements are erased
+				$item = Folder::getItemForUrl($navigation, $urlRel, $uri->getBasePath());
+			}
 		}
 
 		# read the content of the file

+ 1 - 1
system/Settings.php

@@ -39,7 +39,7 @@ class Settings
 		}
 
 		# let us load translations only for admin area to improve performance for frontend
-		$uri = $_SERVER[REQUEST_URI];
+		$uri = $_SERVER['REQUEST_URI'];
 		if(isset($uri) && (strpos($uri,'/tm/') !== false OR strpos($uri,'/setup') !== false))
 		{
 		    # i18n

+ 21 - 4
themes/typemill/css/style.css

@@ -116,13 +116,15 @@ header{
 }
 aside{
 	display: block;
-	position: absolute;
-	top: 175px;
 	padding: 0;
 	margin: 0;
 	left: 20px;
 	right: 20px;
 }
+aside#tmnavigation{
+	position: absolute;
+	top: 175px;
+}
 article{
 	width: 100%;
 	position: relative;
@@ -402,7 +404,22 @@ article .gitlink{
 	left: 10%;
 	width: 80%;	
 }
-
+/*
+.p-image{
+	display: table;
+	margin:auto;
+	max-width: 100%;
+}
+.p-image + .left{
+	float:left;
+}
+.p-image img{
+	display: block;
+}
+.p-image em{
+	display: table-caption;
+	caption-side: bottom;
+}
 /************************
 *  	PAGING / BREADCRUMB *
 ************************/
@@ -881,7 +898,7 @@ img.myClass{
 	header{ 
 		text-align: left;
 	}
-	aside{
+	aside, aside#tmnavigation{
 		position: relative;
 		top: 0;
 		left: 0;

+ 2 - 2
themes/typemill/js/script.js

@@ -1,5 +1,5 @@
-var menu = document.getElementById("menu"),
-	navi = document.getElementById("navigation");
+var menu = document.getElementById("tmmenu"),
+	navi = document.getElementById("tmnavigation");
 				
 if(menu)
 {

+ 2 - 3
themes/typemill/partials/breadcrumb.twig

@@ -1,4 +1,4 @@
-	{% if item.prevItem or item.nextItem %}
+
 		<div class="breadcrumb">
 			{% if item.prevItem %}
 				<span class="prev"><a href="{{ item.prevItem.urlRel }}"><i class="icon-left-open-big"></i></a></span>
@@ -8,9 +8,8 @@
 				<li><a href="{{ crumb.urlRel }}">{{ crumb.name }}</a></li>
 			{% endfor %}
 			</ul>
-			<button id="menu" class="menu">contents</button>
+			<button id="tmmenu" class="menu">contents</button>
 			{% if item.nextItem %}
 				<span class="next"><a href="{{ item.nextItem.urlRel }}"><i class="icon-right-open-big"></i></a></span>
 			{% endif %}			
 		</div>
-	{% endif %}

+ 1 - 1
themes/typemill/partials/layout.twig

@@ -62,7 +62,7 @@
 					</aside>
 				{% endfor %}
 			{% endif %}
-			<aside id="navigation" class="close">
+			<aside id="tmnavigation" class="close">
 				<nav class="main-menu">
 					{% include 'partials/navigation.twig' %}
 				</nav>