From f5b43e62036d8ea2788eae4ad094786b3efdcf56 Mon Sep 17 00:00:00 2001 From: trendschau Date: Mon, 19 Feb 2024 18:43:22 +0100 Subject: [PATCH] v2.2.2 Create Live Navigation from DraftNavigation to preserve keyPathArray --- content/00-welcome/00-setup-your-website.md | 2 +- data/navigation/navi-draft.txt | 2 +- data/navigation/navi-extended.txt | 4 +- system/typemill/Models/Folder.php | 216 +------------------- system/typemill/Models/Navigation.php | 37 +++- 5 files changed, 42 insertions(+), 219 deletions(-) diff --git a/content/00-welcome/00-setup-your-website.md b/content/00-welcome/00-setup-your-website.md index 13a3396..4ec3aa8 100644 --- a/content/00-welcome/00-setup-your-website.md +++ b/content/00-welcome/00-setup-your-website.md @@ -1,6 +1,6 @@ # Setup Your Website -Typemill provides detailed settings, and you have access to nearly all settings in the author panel. Learn the basics in this short video: +Typemill provides detailed settings, and you have access to nearly all settings in the author panel. Learn the basics in this short video: mod ![youtube-video](media/live/youtube-7yvlwxjl9dc.jpeg "click to load video"){#7yvlwXJL9dc .youtube} diff --git a/data/navigation/navi-draft.txt b/data/navigation/navi-draft.txt index 472c5d4..84fcabc 100644 --- a/data/navigation/navi-draft.txt +++ b/data/navigation/navi-draft.txt @@ -1 +1 @@ -a:2:{i:0;O:8:"stdClass":22:{s:12:"originalName";s:10:"00-welcome";s:11:"elementType";s:6:"folder";s:8:"contains";s:5:"pages";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"00";s:4:"name";s:7:"welcome";s:4:"slug";s:7:"welcome";s:4:"path";s:11:"/00-welcome";s:15:"pathWithoutType";s:17:"/00-welcome/index";s:9:"urlRelWoF";s:8:"/welcome";s:6:"urlRel";s:17:"/typemill/welcome";s:6:"urlAbs";s:33:"http://localhost/typemill/welcome";s:3:"key";s:1:"0";s:7:"keyPath";s:1:"0";s:12:"keyPathArray";a:1:{i:0;s:1:"0";}s:7:"chapter";i:1;s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:13:"folderContent";a:5:{i:0;O:8:"stdClass":20:{s:12:"originalName";s:24:"00-setup-your-website.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"00";s:4:"name";s:18:"setup your website";s:4:"slug";s:18:"setup-your-website";s:4:"path";s:36:"/00-welcome/00-setup-your-website.md";s:15:"pathWithoutType";s:33:"/00-welcome/00-setup-your-website";s:3:"key";i:0;s:7:"keyPath";s:3:"0.0";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"0";}s:7:"chapter";s:3:"1.1";s:9:"urlRelWoF";s:27:"/welcome/setup-your-website";s:6:"urlRel";s:36:"/typemill/welcome/setup-your-website";s:6:"urlAbs";s:52:"http://localhost/typemill/welcome/setup-your-website";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:1;O:8:"stdClass":20:{s:12:"originalName";s:19:"01-write-content.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"01";s:4:"name";s:13:"write content";s:4:"slug";s:13:"write-content";s:4:"path";s:31:"/00-welcome/01-write-content.md";s:15:"pathWithoutType";s:28:"/00-welcome/01-write-content";s:3:"key";i:1;s:7:"keyPath";s:3:"0.1";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"1";}s:7:"chapter";s:3:"1.2";s:9:"urlRelWoF";s:22:"/welcome/write-content";s:6:"urlRel";s:31:"/typemill/welcome/write-content";s:6:"urlAbs";s:47:"http://localhost/typemill/welcome/write-content";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:2;O:8:"stdClass":20:{s:12:"originalName";s:19:"02-manage-access.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"02";s:4:"name";s:13:"manage access";s:4:"slug";s:13:"manage-access";s:4:"path";s:31:"/00-welcome/02-manage-access.md";s:15:"pathWithoutType";s:28:"/00-welcome/02-manage-access";s:3:"key";i:2;s:7:"keyPath";s:3:"0.2";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"2";}s:7:"chapter";s:3:"1.3";s:9:"urlRelWoF";s:22:"/welcome/manage-access";s:6:"urlRel";s:31:"/typemill/welcome/manage-access";s:6:"urlAbs";s:47:"http://localhost/typemill/welcome/manage-access";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:3;O:8:"stdClass":20:{s:12:"originalName";s:14:"03-get-help.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"03";s:4:"name";s:8:"get help";s:4:"slug";s:8:"get-help";s:4:"path";s:26:"/00-welcome/03-get-help.md";s:15:"pathWithoutType";s:23:"/00-welcome/03-get-help";s:3:"key";i:3;s:7:"keyPath";s:3:"0.3";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"3";}s:7:"chapter";s:3:"1.4";s:9:"urlRelWoF";s:17:"/welcome/get-help";s:6:"urlRel";s:26:"/typemill/welcome/get-help";s:6:"urlAbs";s:42:"http://localhost/typemill/welcome/get-help";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:4;O:8:"stdClass":20:{s:12:"originalName";s:19:"04-markdown-test.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"04";s:4:"name";s:13:"markdown test";s:4:"slug";s:13:"markdown-test";s:4:"path";s:31:"/00-welcome/04-markdown-test.md";s:15:"pathWithoutType";s:28:"/00-welcome/04-markdown-test";s:3:"key";i:4;s:7:"keyPath";s:3:"0.4";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"4";}s:7:"chapter";s:3:"1.5";s:9:"urlRelWoF";s:22:"/welcome/markdown-test";s:6:"urlRel";s:31:"/typemill/welcome/markdown-test";s:6:"urlAbs";s:47:"http://localhost/typemill/welcome/markdown-test";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}}s:7:"noindex";b:0;}i:1;O:8:"stdClass":22:{s:12:"originalName";s:16:"01-cyanine-theme";s:11:"elementType";s:6:"folder";s:8:"contains";s:5:"pages";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"01";s:4:"name";s:13:"cyanine theme";s:4:"slug";s:13:"cyanine-theme";s:4:"path";s:17:"/01-cyanine-theme";s:15:"pathWithoutType";s:23:"/01-cyanine-theme/index";s:9:"urlRelWoF";s:14:"/cyanine-theme";s:6:"urlRel";s:23:"/typemill/cyanine-theme";s:6:"urlAbs";s:39:"http://localhost/typemill/cyanine-theme";s:3:"key";s:1:"1";s:7:"keyPath";s:1:"1";s:12:"keyPathArray";a:1:{i:0;s:1:"1";}s:7:"chapter";i:2;s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:13:"folderContent";a:4:{i:0;O:8:"stdClass":20:{s:12:"originalName";s:17:"00-landingpage.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"00";s:4:"name";s:11:"landingpage";s:4:"slug";s:11:"landingpage";s:4:"path";s:35:"/01-cyanine-theme/00-landingpage.md";s:15:"pathWithoutType";s:32:"/01-cyanine-theme/00-landingpage";s:3:"key";i:0;s:7:"keyPath";s:3:"1.0";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"0";}s:7:"chapter";s:3:"2.1";s:9:"urlRelWoF";s:26:"/cyanine-theme/landingpage";s:6:"urlRel";s:35:"/typemill/cyanine-theme/landingpage";s:6:"urlAbs";s:51:"http://localhost/typemill/cyanine-theme/landingpage";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:1;}i:1;O:8:"stdClass":20:{s:12:"originalName";s:22:"01-colors-and-fonts.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"01";s:4:"name";s:16:"colors and fonts";s:4:"slug";s:16:"colors-and-fonts";s:4:"path";s:40:"/01-cyanine-theme/01-colors-and-fonts.md";s:15:"pathWithoutType";s:37:"/01-cyanine-theme/01-colors-and-fonts";s:3:"key";i:1;s:7:"keyPath";s:3:"1.1";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"1";}s:7:"chapter";s:3:"2.2";s:9:"urlRelWoF";s:31:"/cyanine-theme/colors-and-fonts";s:6:"urlRel";s:40:"/typemill/cyanine-theme/colors-and-fonts";s:6:"urlAbs";s:56:"http://localhost/typemill/cyanine-theme/colors-and-fonts";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:2;O:8:"stdClass":20:{s:12:"originalName";s:12:"02-footer.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"02";s:4:"name";s:6:"footer";s:4:"slug";s:6:"footer";s:4:"path";s:30:"/01-cyanine-theme/02-footer.md";s:15:"pathWithoutType";s:27:"/01-cyanine-theme/02-footer";s:3:"key";i:2;s:7:"keyPath";s:3:"1.2";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"2";}s:7:"chapter";s:3:"2.3";s:9:"urlRelWoF";s:21:"/cyanine-theme/footer";s:6:"urlRel";s:30:"/typemill/cyanine-theme/footer";s:6:"urlAbs";s:46:"http://localhost/typemill/cyanine-theme/footer";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:3;O:8:"stdClass":20:{s:12:"originalName";s:22:"03-content-elements.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"03";s:4:"name";s:16:"content elements";s:4:"slug";s:16:"content-elements";s:4:"path";s:40:"/01-cyanine-theme/03-content-elements.md";s:15:"pathWithoutType";s:37:"/01-cyanine-theme/03-content-elements";s:3:"key";i:3;s:7:"keyPath";s:3:"1.3";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"3";}s:7:"chapter";s:3:"2.4";s:9:"urlRelWoF";s:31:"/cyanine-theme/content-elements";s:6:"urlRel";s:40:"/typemill/cyanine-theme/content-elements";s:6:"urlAbs";s:56:"http://localhost/typemill/cyanine-theme/content-elements";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}}s:7:"noindex";b:0;}} \ No newline at end of file +a:2:{i:0;O:8:"stdClass":22:{s:12:"originalName";s:10:"00-welcome";s:11:"elementType";s:6:"folder";s:8:"contains";s:5:"pages";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"00";s:4:"name";s:7:"welcome";s:4:"slug";s:7:"welcome";s:4:"path";s:11:"/00-welcome";s:15:"pathWithoutType";s:17:"/00-welcome/index";s:9:"urlRelWoF";s:8:"/welcome";s:6:"urlRel";s:17:"/typemill/welcome";s:6:"urlAbs";s:33:"http://localhost/typemill/welcome";s:3:"key";i:0;s:7:"keyPath";i:0;s:12:"keyPathArray";a:1:{i:0;s:1:"0";}s:7:"chapter";i:1;s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:13:"folderContent";a:5:{i:0;O:8:"stdClass":20:{s:12:"originalName";s:24:"00-setup-your-website.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"00";s:4:"name";s:18:"setup your website";s:4:"slug";s:18:"setup-your-website";s:4:"path";s:36:"/00-welcome/00-setup-your-website.md";s:15:"pathWithoutType";s:33:"/00-welcome/00-setup-your-website";s:3:"key";i:0;s:7:"keyPath";s:3:"0.0";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"0";}s:7:"chapter";s:3:"1.1";s:9:"urlRelWoF";s:27:"/welcome/setup-your-website";s:6:"urlRel";s:36:"/typemill/welcome/setup-your-website";s:6:"urlAbs";s:52:"http://localhost/typemill/welcome/setup-your-website";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:1;O:8:"stdClass":20:{s:12:"originalName";s:19:"01-write-content.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"01";s:4:"name";s:13:"write content";s:4:"slug";s:13:"write-content";s:4:"path";s:31:"/00-welcome/01-write-content.md";s:15:"pathWithoutType";s:28:"/00-welcome/01-write-content";s:3:"key";i:1;s:7:"keyPath";s:3:"0.1";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"1";}s:7:"chapter";s:3:"1.2";s:9:"urlRelWoF";s:22:"/welcome/write-content";s:6:"urlRel";s:31:"/typemill/welcome/write-content";s:6:"urlAbs";s:47:"http://localhost/typemill/welcome/write-content";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:2;O:8:"stdClass":20:{s:12:"originalName";s:19:"02-manage-access.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"02";s:4:"name";s:13:"manage access";s:4:"slug";s:13:"manage-access";s:4:"path";s:31:"/00-welcome/02-manage-access.md";s:15:"pathWithoutType";s:28:"/00-welcome/02-manage-access";s:3:"key";i:2;s:7:"keyPath";s:3:"0.2";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"2";}s:7:"chapter";s:3:"1.3";s:9:"urlRelWoF";s:22:"/welcome/manage-access";s:6:"urlRel";s:31:"/typemill/welcome/manage-access";s:6:"urlAbs";s:47:"http://localhost/typemill/welcome/manage-access";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:3;O:8:"stdClass":20:{s:12:"originalName";s:14:"03-get-help.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"03";s:4:"name";s:8:"get help";s:4:"slug";s:8:"get-help";s:4:"path";s:26:"/00-welcome/03-get-help.md";s:15:"pathWithoutType";s:23:"/00-welcome/03-get-help";s:3:"key";i:3;s:7:"keyPath";s:3:"0.3";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"3";}s:7:"chapter";s:3:"1.4";s:9:"urlRelWoF";s:17:"/welcome/get-help";s:6:"urlRel";s:26:"/typemill/welcome/get-help";s:6:"urlAbs";s:42:"http://localhost/typemill/welcome/get-help";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:4;O:8:"stdClass":20:{s:12:"originalName";s:19:"04-markdown-test.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"04";s:4:"name";s:13:"markdown test";s:4:"slug";s:13:"markdown-test";s:4:"path";s:31:"/00-welcome/04-markdown-test.md";s:15:"pathWithoutType";s:28:"/00-welcome/04-markdown-test";s:3:"key";i:4;s:7:"keyPath";s:3:"0.4";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"4";}s:7:"chapter";s:3:"1.5";s:9:"urlRelWoF";s:22:"/welcome/markdown-test";s:6:"urlRel";s:31:"/typemill/welcome/markdown-test";s:6:"urlAbs";s:47:"http://localhost/typemill/welcome/markdown-test";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}}s:7:"noindex";b:0;}i:1;O:8:"stdClass":22:{s:12:"originalName";s:16:"01-cyanine-theme";s:11:"elementType";s:6:"folder";s:8:"contains";s:5:"pages";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"01";s:4:"name";s:13:"cyanine theme";s:4:"slug";s:13:"cyanine-theme";s:4:"path";s:17:"/01-cyanine-theme";s:15:"pathWithoutType";s:23:"/01-cyanine-theme/index";s:9:"urlRelWoF";s:14:"/cyanine-theme";s:6:"urlRel";s:23:"/typemill/cyanine-theme";s:6:"urlAbs";s:39:"http://localhost/typemill/cyanine-theme";s:3:"key";i:1;s:7:"keyPath";i:1;s:12:"keyPathArray";a:1:{i:0;s:1:"1";}s:7:"chapter";i:2;s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:13:"folderContent";a:4:{i:0;O:8:"stdClass":20:{s:12:"originalName";s:17:"00-landingpage.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"00";s:4:"name";s:11:"landingpage";s:4:"slug";s:11:"landingpage";s:4:"path";s:35:"/01-cyanine-theme/00-landingpage.md";s:15:"pathWithoutType";s:32:"/01-cyanine-theme/00-landingpage";s:3:"key";i:0;s:7:"keyPath";s:3:"1.0";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"0";}s:7:"chapter";s:3:"2.1";s:9:"urlRelWoF";s:26:"/cyanine-theme/landingpage";s:6:"urlRel";s:35:"/typemill/cyanine-theme/landingpage";s:6:"urlAbs";s:51:"http://localhost/typemill/cyanine-theme/landingpage";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:1;}i:1;O:8:"stdClass":20:{s:12:"originalName";s:22:"01-colors-and-fonts.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"01";s:4:"name";s:16:"colors and fonts";s:4:"slug";s:16:"colors-and-fonts";s:4:"path";s:40:"/01-cyanine-theme/01-colors-and-fonts.md";s:15:"pathWithoutType";s:37:"/01-cyanine-theme/01-colors-and-fonts";s:3:"key";i:1;s:7:"keyPath";s:3:"1.1";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"1";}s:7:"chapter";s:3:"2.2";s:9:"urlRelWoF";s:31:"/cyanine-theme/colors-and-fonts";s:6:"urlRel";s:40:"/typemill/cyanine-theme/colors-and-fonts";s:6:"urlAbs";s:56:"http://localhost/typemill/cyanine-theme/colors-and-fonts";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:2;O:8:"stdClass":20:{s:12:"originalName";s:12:"02-footer.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"02";s:4:"name";s:6:"footer";s:4:"slug";s:6:"footer";s:4:"path";s:30:"/01-cyanine-theme/02-footer.md";s:15:"pathWithoutType";s:27:"/01-cyanine-theme/02-footer";s:3:"key";i:2;s:7:"keyPath";s:3:"1.2";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"2";}s:7:"chapter";s:3:"2.3";s:9:"urlRelWoF";s:21:"/cyanine-theme/footer";s:6:"urlRel";s:30:"/typemill/cyanine-theme/footer";s:6:"urlAbs";s:46:"http://localhost/typemill/cyanine-theme/footer";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:3;O:8:"stdClass":20:{s:12:"originalName";s:22:"03-content-elements.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"03";s:4:"name";s:16:"content elements";s:4:"slug";s:16:"content-elements";s:4:"path";s:40:"/01-cyanine-theme/03-content-elements.md";s:15:"pathWithoutType";s:37:"/01-cyanine-theme/03-content-elements";s:3:"key";i:3;s:7:"keyPath";s:3:"1.3";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"3";}s:7:"chapter";s:3:"2.4";s:9:"urlRelWoF";s:31:"/cyanine-theme/content-elements";s:6:"urlRel";s:40:"/typemill/cyanine-theme/content-elements";s:6:"urlAbs";s:56:"http://localhost/typemill/cyanine-theme/content-elements";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}}s:7:"noindex";b:0;}} \ No newline at end of file diff --git a/data/navigation/navi-extended.txt b/data/navigation/navi-extended.txt index 4d4caba..69087af 100644 --- a/data/navigation/navi-extended.txt +++ b/data/navigation/navi-extended.txt @@ -3,7 +3,7 @@ hide: false noindex: false path: /00-welcome - keyPath: '0' + keyPath: 0 /welcome/setup-your-website: navtitle: 'setup your website' hide: false @@ -39,7 +39,7 @@ hide: false noindex: false path: /01-cyanine-theme - keyPath: '1' + keyPath: 1 /cyanine-theme/landingpage: navtitle: landingpage hide: false diff --git a/system/typemill/Models/Folder.php b/system/typemill/Models/Folder.php index 9641b91..29fe044 100644 --- a/system/typemill/Models/Folder.php +++ b/system/typemill/Models/Folder.php @@ -35,38 +35,26 @@ class Folder /* - * scans content of a folder recursively and keeps the index order + * scans content of a folder recursively * vars: folder path as string * returns: multi-dimensional array with names of folders and files */ - public function scanFolder($folderPath, $draft = false) + public function scanFolder($folderPath) { $folderItems = scandir($folderPath); $folderContent = array(); - # if it is the live version and if it is a folder that is not published, then do not show the folder and its content. - if(!$draft && !in_array('index.md', $folderItems)){ return false; } - - # Remove '.' and '..' from the array - $folderItems = array_diff($folderItems, array('.', '..')); - - # Reindex the array - $folderItems = array_values($folderItems); - foreach ($folderItems as $key => $item) - { + { + if (!in_array($item, array(".","..")) && substr($item, 0, 1) != '.') + { if (is_dir($folderPath . DIRECTORY_SEPARATOR . $item)) { $subFolder = $item; $folderPublished = file_exists($folderPath . DIRECTORY_SEPARATOR . $item . DIRECTORY_SEPARATOR . 'index.md'); - # scan that folder only if it is a draft or if the folder is published (contains index.md) - if($draft OR $folderPublished) - { - # we need s countable index here - $folderContent[$key . ':' . $subFolder] = $this->scanFolder($folderPath . DIRECTORY_SEPARATOR . $subFolder, $draft); - } + $folderContent[$subFolder] = $this->scanFolder($folderPath . DIRECTORY_SEPARATOR . $subFolder); } else { @@ -79,70 +67,6 @@ class Folder } if($fileType == 'txt') - { - if(isset($last) && ($last == implode($nameParts)) ) - { - array_pop($folderContent); - $item = $item . 'md'; - } - $folderContent[] = $item; - - if(!$draft) - { - $index = count($folderContent)-1; - unset($folderContent[$index]); - } - } - - # store the name of the last file - $last = implode($nameParts); - - } - } - return $folderContent; - } - - - /* - * scans content of a folder recursively - * vars: folder path as string - * returns: multi-dimensional array with names of folders and files - */ - public function scanFolderOLD($folderPath, $draft = false) - { - $folderItems = scandir($folderPath); - $folderContent = array(); - - # if it is the live version and if it is a folder that is not published, then do not show the folder and its content. - if(!$draft && !in_array('index.md', $folderItems)){ return false; } - - foreach ($folderItems as $key => $item) - { - if (!in_array($item, array(".","..")) && substr($item, 0, 1) != '.') - { - if (is_dir($folderPath . DIRECTORY_SEPARATOR . $item)) - { - - $subFolder = $item; - $folderPublished = file_exists($folderPath . DIRECTORY_SEPARATOR . $item . DIRECTORY_SEPARATOR . 'index.md'); - - # scan that folder only if it is a draft or if the folder is published (contains index.md) - if($draft OR $folderPublished) - { - $folderContent[$subFolder] = $this->scanFolder($folderPath . DIRECTORY_SEPARATOR . $subFolder, $draft); - } - } - else - { - $nameParts = $this->getStringParts($item); - $fileType = array_pop($nameParts); - - if($fileType == 'md') - { - $folderContent[] = $item; - } - - if($draft === true && $fileType == 'txt') { if(isset($last) && ($last == implode($nameParts)) ) { @@ -160,7 +84,6 @@ class Folder return $folderContent; } - /* * Transforms array of folder item into an array of item-objects with additional information for each item * vars: multidimensional array with folder- and file-names @@ -173,133 +96,6 @@ class Folder $iteration = 0; $chapternr = 1; - foreach($folderContent as $key => $name) - { - $item = new \stdClass(); - - if(is_array($name)) - { - # get the index of the folder. Limit to 2 parts to ensure only the first ":" is used - $findIndex = explode(':', $key, 2); - $key = $findIndex[0]; - $folderName = $findIndex[1]; - - $nameParts = $this->getStringParts($folderName); - - $fileType = ''; - if(in_array('index.md', $name)) - { - $fileType = 'md'; - $status = 'published'; - } - if(in_array('index.txt', $name)) - { - $fileType = 'txt'; - $status = 'unpublished'; - } - if(in_array('index.txtmd', $name)) - { - $fileType = 'txt'; - $status = 'modified'; - } - - $item->originalName = $folderName; - $item->elementType = 'folder'; - $item->contains = $this->getFolderContentType($name, $fullPath . DIRECTORY_SEPARATOR . $key . DIRECTORY_SEPARATOR . 'index.yaml'); - $item->status = $status; - $item->fileType = $fileType; - $item->order = count($nameParts) > 1 ? array_shift($nameParts) : NULL; - $item->name = implode(" ",$nameParts); - $item->name = iconv(mb_detect_encoding($item->name, mb_detect_order(), true), "UTF-8", $item->name); - $item->slug = implode("-",$nameParts); - $item->slug = $this->createSlug($item->slug, $language); - $item->path = $fullPath . DIRECTORY_SEPARATOR . $folderName; - $item->pathWithoutType = $fullPath . DIRECTORY_SEPARATOR . $folderName . DIRECTORY_SEPARATOR . 'index'; - $item->urlRelWoF = $fullSlugWithoutFolder . '/' . $item->slug; - $item->urlRel = $fullSlugWithFolder . '/' . $item->slug; - $item->urlAbs = $baseUrl . $fullSlugWithoutFolder . '/' . $item->slug; - $item->key = $key; - $item->keyPath = isset($keyPath) ? $keyPath . '.' . $key : $key; - $item->keyPathArray = explode('.', $item->keyPath); - $item->chapter = $chapter ? $chapter . '.' . $chapternr : $chapternr; - $item->active = false; - $item->activeParent = false; - $item->hide = false; - - # sort posts in descending order - if($item->contains == "posts") - { - rsort($name); - } - - $item->folderContent = $this->getFolderContentDetails($name, $language, $baseUrl, $item->urlRel, $item->urlRelWoF, $item->path, $item->keyPath, $item->chapter); - } - elseif($name) - { - # do not use index files - if($name == 'index.md' || $name == 'index.txt' || $name == 'index.txtmd' ) continue; - - $nameParts = $this->getStringParts($name); - $fileType = array_pop($nameParts); - $nameWithoutType = $this->getNameWithoutType($name); - - if($fileType == 'md') - { - $status = 'published'; - } - elseif($fileType == 'txt') - { - $status = 'unpublished'; - } - else - { - $fileType = 'txt'; - $status = 'modified'; - } - - $item->originalName = $name; - $item->elementType = 'file'; - $item->status = $status; - $item->fileType = $fileType; - $item->order = count($nameParts) > 1 ? array_shift($nameParts) : NULL; - $item->name = implode(" ",$nameParts); - $item->name = iconv(mb_detect_encoding($item->name, mb_detect_order(), true), "UTF-8", $item->name); - $item->slug = implode("-",$nameParts); - $item->slug = $this->createSlug($item->slug, $language); - $item->path = $fullPath . DIRECTORY_SEPARATOR . $name; - $item->pathWithoutType = $fullPath . DIRECTORY_SEPARATOR . $nameWithoutType; - $item->key = $key; - $item->keyPath = isset($keyPath) ? $keyPath . '.' . $key : $key; - $item->keyPathArray = explode('.',$item->keyPath); - $item->chapter = $chapter . '.' . $chapternr; - $item->urlRelWoF = $fullSlugWithoutFolder . '/' . $item->slug; - $item->urlRel = $fullSlugWithFolder . '/' . $item->slug; - $item->urlAbs = $baseUrl . $fullSlugWithoutFolder . '/' . $item->slug; - $item->active = false; - $item->activeParent = false; - $item->hide = false; - } - - $iteration++; - $chapternr++; - $contentDetails[$key] = $item; - } - return $contentDetails; - } - - - /* - * Transforms array of folder item into an array of item-objects with additional information for each item - * vars: multidimensional array with folder- and file-names - * returns: array of objects. Each object contains information about an item (file or folder). - */ - - public function getFolderContentDetailsOLD(array $folderContent, $language, $baseUrl, $fullSlugWithFolder = NULL, $fullSlugWithoutFolder = NULL, $fullPath = NULL, $keyPath = NULL, $chapter = NULL) - { - $contentDetails = []; - $iteration = 0; - $chapternr = 1; - foreach($folderContent as $key => $name) { $item = new \stdClass(); diff --git a/system/typemill/Models/Navigation.php b/system/typemill/Models/Navigation.php index 416ee22..83b3d3b 100644 --- a/system/typemill/Models/Navigation.php +++ b/system/typemill/Models/Navigation.php @@ -206,8 +206,6 @@ class Navigation extends Folder { # todo: filter for userrole or username - $basicLiveNavigation = $this->getBasicLiveNavigation($urlinfo, $language); - $this->liveNavigation = $this->storage->getFile('dataFolder', $this->naviFolder, $this->liveNaviName, 'unserialize'); if($this->liveNavigation) @@ -215,8 +213,9 @@ class Navigation extends Folder return $this->liveNavigation; } - # if there is no cached navi, create a basic new draft navi - $basicLiveNavigation = $this->getBasicLiveNavigation($urlinfo, $language); + $draftNavigation = $this->getDraftNavigation($urlinfo, $language); + + $basicLiveNavigation = $this->generateLiveNavigationFromDraft($draftNavigation); # get the extended navigation with additional infos from the meta-files like title or hidden pages $extendedNavigation = $this->getExtendedNavigation($urlinfo, $language); @@ -230,6 +229,33 @@ class Navigation extends Folder return $liveNavigation; } + public function generateLiveNavigationFromDraft($draftNavigation) + { + foreach($draftNavigation as $key => $item) + { + if($item->status == 'unpublished') + { + unset($draftNavigation[$key]); + } + else + { + if($item->status == 'modified') + { + $draftNavigation[$key]->fileType = 'md'; + $draftNavigation[$key]->path = $draftNavigation[$key]->pathWithoutType . '.md'; + } + + if(isset($item->folderContent) && $item->folderContent) + { + $item->folderContent = $this->generateLiveNavigationFromDraft($item->folderContent); + } + } + } + + return $draftNavigation; + } + +/* public function getBasicLiveNavigation($urlinfo, $language) { if(!$this->basicLiveNavigation) @@ -254,7 +280,8 @@ class Navigation extends Folder return false; } - +*/ + # get the extended navigation with additional infos from the meta-files like title or hidden pages public function getExtendedNavigation($urlinfo, $language) {