From b1fb245b4ba5d539dd17cb66fe61c3c83a49a520 Mon Sep 17 00:00:00 2001 From: trendschau Date: Thu, 9 Jan 2020 08:30:37 +0100 Subject: [PATCH] Version 1.3.1: Improve Meta-Tabs --- .gitignore | 1 + cache/lastCache.txt | 2 +- system/Controllers/SettingsController.php | 11 +++++++++-- system/Models/Folder.php | 11 +++++++++-- system/Models/Validation.php | 6 +++--- system/author/auth/welcome.twig | 2 +- system/author/settings/plugins.twig | 2 +- 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index ece6436..a2f4976 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ cache +cache/lastCache.txt content/index.yaml content/00-Welcome/index.yaml content/00-Welcome/00-Setup.yaml diff --git a/cache/lastCache.txt b/cache/lastCache.txt index b753fc9..5c17eb9 100644 --- a/cache/lastCache.txt +++ b/cache/lastCache.txt @@ -1 +1 @@ -1578328271 \ No newline at end of file +1577899842 \ No newline at end of file diff --git a/system/Controllers/SettingsController.php b/system/Controllers/SettingsController.php index 31eadc3..2d4b9df 100644 --- a/system/Controllers/SettingsController.php +++ b/system/Controllers/SettingsController.php @@ -301,7 +301,7 @@ class SettingsController extends Controller { /* validate the user-input */ $this->validateInput('plugins', $pluginName, $userInput[$pluginName], $validate); - + /* use the input data */ $pluginSettings[$pluginName] = $userInput[$pluginName]; } @@ -364,6 +364,13 @@ class SettingsController extends Controller $originalFields['recaptcha_secretkey'] = ['type' => 'text', 'label' => 'Recaptcha Secret Key', 'help' => 'Add the recaptcha secret key here. You can get the key from the recaptcha website.', 'description' => 'The secret key is mandatory if you activate the recaptcha field']; } + # if plugin is not active, then skip required + $skiprequired = false; + if($objectType == 'plugins' && !isset($userInput['active'])) + { + $skiprequired = true; + } + /* take the user input data and iterate over all fields and values */ foreach($userInput as $fieldName => $fieldValue) { @@ -373,7 +380,7 @@ class SettingsController extends Controller if($fieldDefinition) { /* validate user input for this field */ - $validate->objectField($fieldName, $fieldValue, $objectName, $fieldDefinition); + $validate->objectField($fieldName, $fieldValue, $objectName, $fieldDefinition, $skiprequired); } if(!$fieldDefinition && $fieldName != 'active') { diff --git a/system/Models/Folder.php b/system/Models/Folder.php index 7c4b3fd..036ba62 100644 --- a/system/Models/Folder.php +++ b/system/Models/Folder.php @@ -53,8 +53,15 @@ class Folder { if (is_dir($folderPath . DIRECTORY_SEPARATOR . $item)) { - $subFolder = $item; - $folderContent[$subFolder] = self::scanFolder($folderPath . DIRECTORY_SEPARATOR . $subFolder, $draft); + + $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] = self::scanFolder($folderPath . DIRECTORY_SEPARATOR . $subFolder, $draft); + } } else { diff --git a/system/Models/Validation.php b/system/Models/Validation.php index 5e0d8d9..bcea4ca 100644 --- a/system/Models/Validation.php +++ b/system/Models/Validation.php @@ -329,11 +329,11 @@ class Validation * @return obj $v the validation object passed to a result method. */ - public function objectField($fieldName, $fieldValue, $objectName, $fieldDefinitions) + public function objectField($fieldName, $fieldValue, $objectName, $fieldDefinitions, $skiprequired = NULL) { $v = new Validator(array($fieldName => $fieldValue)); - - if(isset($fieldDefinitions['required'])) + + if(isset($fieldDefinitions['required']) && !$skiprequired) { $v->rule('required', $fieldName); } diff --git a/system/author/auth/welcome.twig b/system/author/auth/welcome.twig index 6cc77e2..faa6ede 100644 --- a/system/author/auth/welcome.twig +++ b/system/author/auth/welcome.twig @@ -11,7 +11,7 @@

Hurra!

Your account has been created and you are logged in now.

Next step: Visit the author panel and setup your new website. You can configure the system, choose themes and add plugins.

-

New:Hurra! Version 1.3.0 is out and now you can edit meta-information like title and description.

+

New:Hurra! Series 1.3 is out and now you can edit meta-information like title and description.

Get help: If you have any questions, please consult the docs or open a new issue on github.

Configure your website diff --git a/system/author/settings/plugins.twig b/system/author/settings/plugins.twig index b747801..8644c83 100644 --- a/system/author/settings/plugins.twig +++ b/system/author/settings/plugins.twig @@ -6,7 +6,7 @@
-
+