From 84880b3c0cf8e6725fe1ce78080675779b0b8846 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 24 Jul 2018 19:53:51 +0200 Subject: [PATCH] Version 1.2.2 Draft Management --- cache/lastCache.txt | 2 +- composer.lock | 21 ++++++++++--------- content/5_info/01-release-notes.md | 18 ++++++++++++++++ .../Controllers/ContentBackendController.php | 4 ++-- system/Controllers/ContentController.php | 16 +++++++------- system/Settings.php | 2 +- system/author/layouts/layoutContent.twig | 6 +++--- 7 files changed, 45 insertions(+), 24 deletions(-) diff --git a/cache/lastCache.txt b/cache/lastCache.txt index 3398627..96cdfa0 100644 --- a/cache/lastCache.txt +++ b/cache/lastCache.txt @@ -1 +1 @@ -1532420761 \ No newline at end of file +1532454659 \ No newline at end of file diff --git a/composer.lock b/composer.lock index 361946c..bb1e0a6 100644 --- a/composer.lock +++ b/composer.lock @@ -653,7 +653,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v3.4.12", + "version": "v3.4.13", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -771,7 +771,7 @@ }, { "name": "symfony/yaml", - "version": "v2.8.42", + "version": "v2.8.43", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -821,20 +821,21 @@ }, { "name": "twig/twig", - "version": "v1.35.3", + "version": "v1.35.4", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "b48680b6eb7d16b5025b9bfc4108d86f6b8af86f" + "reference": "7e081e98378a1e78c29cc9eba4aefa5d78a05d2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/b48680b6eb7d16b5025b9bfc4108d86f6b8af86f", - "reference": "b48680b6eb7d16b5025b9bfc4108d86f6b8af86f", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/7e081e98378a1e78c29cc9eba4aefa5d78a05d2a", + "reference": "7e081e98378a1e78c29cc9eba4aefa5d78a05d2a", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.3", + "symfony/polyfill-ctype": "^1.8" }, "require-dev": { "psr/container": "^1.0", @@ -873,16 +874,16 @@ }, { "name": "Twig Team", - "homepage": "http://twig.sensiolabs.org/contributors", + "homepage": "https://twig.symfony.com/contributors", "role": "Contributors" } ], "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", + "homepage": "https://twig.symfony.com", "keywords": [ "templating" ], - "time": "2018-03-20T04:25:58+00:00" + "time": "2018-07-13T07:12:17+00:00" }, { "name": "vlucas/valitron", diff --git a/content/5_info/01-release-notes.md b/content/5_info/01-release-notes.md index 375c89e..589a5f2 100644 --- a/content/5_info/01-release-notes.md +++ b/content/5_info/01-release-notes.md @@ -2,6 +2,24 @@ This is the version history with some release notes. +## Version 1.2.2: Draft Management + +_Release date: 24.07.2018_ + +Version 1.2.2 introduces a draft management. Follow the instruction for simple updates in the [documentation](/gettings-started/update), so update the `system` folder and please also update the theme `typemill`. + +The changes are: + +- Safe a draft. +- Publish a page. +- Depublish a page. +- Delete a page. +- All buttons for editing are fixed at the bottom of the page now. +- Created a new shared contentController for the whole page management. +- Extended the content-api with update, depublish and delete functionalities. +- Converted markdown to json for edit- and draft-management (stored as txt). +- Extended the vue-js for the editor. + ## Version 1.2.1: Improved editor and fixes _Release date: 06.07.2018_ diff --git a/system/Controllers/ContentBackendController.php b/system/Controllers/ContentBackendController.php index 3110f3a..7a00f80 100644 --- a/system/Controllers/ContentBackendController.php +++ b/system/Controllers/ContentBackendController.php @@ -28,13 +28,13 @@ class ContentBackendController extends ContentController # set item if(!$this->setItem()){ die('no item'); return $this->render404($response, array( 'navigation' => $this->structure, 'settings' => $this->settings, 'content' => $this->errors )); } - + # set the status for published and drafted $this->setPublishStatus(); # set path $this->setItemPath($this->item->fileType); - + # add the modified date for the file $this->item->modified = ($this->item->published OR $this->item->drafted) ? filemtime($this->settings['contentFolder'] . $this->path) : false; diff --git a/system/Controllers/ContentController.php b/system/Controllers/ContentController.php index 82a7f0f..f0167cd 100644 --- a/system/Controllers/ContentController.php +++ b/system/Controllers/ContentController.php @@ -143,7 +143,7 @@ abstract class ContentController # search for the url in the structure $item = Folder::getItemForUrl($this->structure, $this->params['url']); } - + if($item) { if($item->elementType == 'file') @@ -161,7 +161,7 @@ abstract class ContentController $this->item = $item; return true; } - + $this->errors = ['errors' => ['message' => 'requested page-url not found']]; return false; } @@ -170,13 +170,13 @@ abstract class ContentController protected function setItemPath($fileType) { $this->path = $this->item->pathWithoutType . '.' . $fileType; - } + } protected function setPublishStatus() { $this->item->published = false; $this->item->drafted = false; - + if(file_exists($this->settings['rootPath'] . $this->settings['contentFolder'] . $this->item->pathWithoutType . '.md')) { $this->item->published = true; @@ -184,14 +184,16 @@ abstract class ContentController # add file-type in case it is a folder $this->item->fileType = "md"; } - elseif(file_exists($this->settings['rootPath'] . $this->settings['contentFolder'] . $this->item->pathWithoutType . '.txt')) + + if(file_exists($this->settings['rootPath'] . $this->settings['contentFolder'] . $this->item->pathWithoutType . '.txt')) { $this->item->drafted = true; # add file-type in case it is a folder $this->item->fileType = "txt"; } - elseif($this->item->elementType == "folder") + + if(!$this->item->drafted && !$this->item->published && $this->item->elementType == "folder") { # set txt as default for a folder, so that we can create an index.txt for a folder. $this->item->fileType = "txt"; @@ -217,7 +219,7 @@ abstract class ContentController } protected function setContent() - { + { # if the file exists if($this->item->published OR $this->item->drafted) { diff --git a/system/Settings.php b/system/Settings.php index e6452fc..ae3b98b 100644 --- a/system/Settings.php +++ b/system/Settings.php @@ -43,7 +43,7 @@ class Settings 'contentFolder' => 'content', 'cache' => true, 'cachePath' => $rootPath . 'cache', - 'version' => '1.2.1', + 'version' => '1.2.2', 'setup' => true, 'welcome' => true ]; diff --git a/system/author/layouts/layoutContent.twig b/system/author/layouts/layoutContent.twig index b30fde5..436ebe1 100644 --- a/system/author/layouts/layoutContent.twig +++ b/system/author/layouts/layoutContent.twig @@ -17,7 +17,7 @@ - + @@ -35,7 +35,7 @@ - - + + \ No newline at end of file