From 34da752f70e6e24df0be8a8a9f47b827fda3b2ee Mon Sep 17 00:00:00 2001 From: Andrew Miller Date: Mon, 26 Dec 2016 09:41:27 -0700 Subject: [PATCH 01/16] No longer needed --- themes/grav/templates/plugins.json.twig | 5 ----- themes/grav/templates/themes.json.twig | 5 ----- 2 files changed, 10 deletions(-) delete mode 100644 themes/grav/templates/plugins.json.twig delete mode 100644 themes/grav/templates/themes.json.twig diff --git a/themes/grav/templates/plugins.json.twig b/themes/grav/templates/plugins.json.twig deleted file mode 100644 index b98dabca..00000000 --- a/themes/grav/templates/plugins.json.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% if admin.json_response %} -{{ admin.json_response|json_encode|raw }} -{% else %} -{} -{% endif %} diff --git a/themes/grav/templates/themes.json.twig b/themes/grav/templates/themes.json.twig deleted file mode 100644 index b98dabca..00000000 --- a/themes/grav/templates/themes.json.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% if admin.json_response %} -{{ admin.json_response|json_encode|raw }} -{% else %} -{} -{% endif %} From 92eb33493e8ac4a50e05eda5646765351e522652 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Sat, 31 Dec 2016 11:21:38 +0100 Subject: [PATCH 02/16] Allow to clear the cache if admin.maintenance, as stated in the docs --- classes/admincontroller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/admincontroller.php b/classes/admincontroller.php index 5391e944..64e358f7 100644 --- a/classes/admincontroller.php +++ b/classes/admincontroller.php @@ -1102,7 +1102,7 @@ class AdminController extends AdminBaseController */ protected function taskClearCache() { - if (!$this->authorizeTask('clear cache', ['admin.cache', 'admin.super'])) { + if (!$this->authorizeTask('clear cache', ['admin.cache', 'admin.super', 'admin.maintenance'])) { return false; } From 25bcaff4e28712eb1eadeb30d204453b31eefc3c Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Sat, 31 Dec 2016 11:23:15 +0100 Subject: [PATCH 03/16] Changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 259151b8..1f8d9762 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.2.x +## xx/xx/201x + +1. [](#improved) + * Allow to clear the cache if admin.maintenance, as stated in the docs [#908](https://github.com/getgrav/grav-plugin-admin/issues/908) + # v1.2.7 ## 12/22/2016 From 721c3bbe9048a039faef2ef8797dc1e0a2e04b66 Mon Sep 17 00:00:00 2001 From: Andrew Miller Date: Mon, 2 Jan 2017 20:55:55 -0700 Subject: [PATCH 04/16] Added lang strings --- CHANGELOG.md | 1 + languages/en.yaml | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f8d9762..b7a40766 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ 1. [](#improved) * Allow to clear the cache if admin.maintenance, as stated in the docs [#908](https://github.com/getgrav/grav-plugin-admin/issues/908) + * Added lang strings for `DEFAULT_LANG` in Site configuration # v1.2.7 ## 12/22/2016 diff --git a/languages/en.yaml b/languages/en.yaml index d112bb40..518c0159 100644 --- a/languages/en.yaml +++ b/languages/en.yaml @@ -187,6 +187,9 @@ PLUGIN_ADMIN: SITE_TITLE: "Site Title" SITE_TITLE_PLACEHOLDER: "Site wide title" SITE_TITLE_HELP: "Default title for your site, often used in themes" + SITE_DEFAULT_LANG: "Default language" + SITE_DEFAULT_LANG_PLACEHOLDER: "Default language to be used by theme's tag" + SITE_DEFAULT_LANG_HELP: "Default language to be used by theme's tag" DEFAULT_AUTHOR: "Default Author" DEFAULT_AUTHOR_HELP: "A default author name, often used in themes or page content" DEFAULT_EMAIL: "Default Email" @@ -625,4 +628,4 @@ PLUGIN_ADMIN: REDIS_SOCKET: "Redis socket" REDIS_SOCKET_HELP: "The Redis socket" NOT_SET: "Not set" - PERMISSIONS: "Permissions" \ No newline at end of file + PERMISSIONS: "Permissions" From 964a4f8ea39900ea2af0cfd875de19391506a1eb Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Tue, 3 Jan 2017 10:58:24 +0100 Subject: [PATCH 05/16] Fixed saving the configuration if not `admin.super` --- CHANGELOG.md | 2 ++ classes/adminbasecontroller.php | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7a40766..0fb5cc94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ 1. [](#improved) * Allow to clear the cache if admin.maintenance, as stated in the docs [#908](https://github.com/getgrav/grav-plugin-admin/issues/908) * Added lang strings for `DEFAULT_LANG` in Site configuration +1. [](#bugfix) + * Fixed saving the configuration if not `admin.super` # v1.2.7 ## 12/22/2016 diff --git a/classes/adminbasecontroller.php b/classes/adminbasecontroller.php index deea2244..0bf63a6b 100644 --- a/classes/adminbasecontroller.php +++ b/classes/adminbasecontroller.php @@ -420,6 +420,7 @@ class AdminBaseController switch ($type) { case 'configuration': + case 'config': case 'system': $permissions[] = 'admin.configuration'; break; From 888a15cbc61d4e3c9fba83265a17733f88d7a46c Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Mon, 9 Jan 2017 14:25:30 +0100 Subject: [PATCH 06/16] Show the clear cache buttons if the user has `admin.cache` permissions [#908] --- CHANGELOG.md | 1 + themes/grav/templates/dashboard.html.twig | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fb5cc94..5fb64e73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Added lang strings for `DEFAULT_LANG` in Site configuration 1. [](#bugfix) * Fixed saving the configuration if not `admin.super` + * Show the clear cache buttons if the user has `admin.cache` permissions [#908](https://github.com/getgrav/grav-plugin-admin/issues/908#issuecomment-270748616) # v1.2.7 ## 12/22/2016 diff --git a/themes/grav/templates/dashboard.html.twig b/themes/grav/templates/dashboard.html.twig index 12406cc9..e6f85927 100644 --- a/themes/grav/templates/dashboard.html.twig +++ b/themes/grav/templates/dashboard.html.twig @@ -6,7 +6,7 @@ {% block titlebar %}
- {% if authorize(['admin.maintenance', 'admin.super']) %} + {% if authorize(['admin.maintenance', 'admin.super', 'admin.cache']) %}
- + {% endif %} + {% if authorize(['admin.maintenance', 'admin.super']) %} {% endif %}
From d7d0fe5b53ae70ad3249b932511fab2c7fb29432 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Wed, 11 Jan 2017 17:07:56 +0100 Subject: [PATCH 07/16] Fix #921 colorpicker validation, failed when transparency was set to 1.00 --- CHANGELOG.md | 1 + .../templates/forms/fields/colorpicker/colorpicker.html.twig | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fb64e73..7fef0aa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ 1. [](#bugfix) * Fixed saving the configuration if not `admin.super` * Show the clear cache buttons if the user has `admin.cache` permissions [#908](https://github.com/getgrav/grav-plugin-admin/issues/908#issuecomment-270748616) + * Fix colorpicker validation when transparency is set to 1.00 [#921](https://github.com/getgrav/grav-plugin-admin/issues/921) # v1.2.7 ## 12/22/2016 diff --git a/themes/grav/templates/forms/fields/colorpicker/colorpicker.html.twig b/themes/grav/templates/forms/fields/colorpicker/colorpicker.html.twig index a1355a31..5b53c63d 100644 --- a/themes/grav/templates/forms/fields/colorpicker/colorpicker.html.twig +++ b/themes/grav/templates/forms/fields/colorpicker/colorpicker.html.twig @@ -1,7 +1,7 @@ {% extends "forms/field.html.twig" %} {% set originalValue = originalValue is defined ? originalValue : value %} {% set value = (value is null ? field.default : value) %} -{% set pattern = '^#([a-fA-F0-9]{6})|(rgba\\(\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*((0.[0-9]+)|[01])\\s*\\))$' %} +{% set pattern = '^#([a-fA-F0-9]{6})|(rgba\\(\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*((0.[0-9]+)|(1.00)|1.0|1)\\s*\\))$' %} {% block input %}
From 78a7d60c826aa6fb0da98384f7e116ea3a0866ef Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 11 Jan 2017 20:05:07 -0700 Subject: [PATCH 08/16] Fix for processing exiting after removing package so events are not fired on missing plugins --- classes/admincontroller.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/classes/admincontroller.php b/classes/admincontroller.php index 64e358f7..40af7f94 100644 --- a/classes/admincontroller.php +++ b/classes/admincontroller.php @@ -958,12 +958,11 @@ class AdminController extends AdminBaseController $type = isset($data['type']) ? $data['type'] : ''; if (!$this->authorizeTask('uninstall ' . $type, ['admin.' . $type, 'admin.super'])) { - $this->admin->json_response = [ + $json_response = [ 'status' => 'error', 'message' => $this->admin->translate('PLUGIN_ADMIN.INSUFFICIENT_PERMISSIONS_FOR_TASK') ]; - - return false; + echo json_encode($json_response);exit; } //check if there are packages that have this as a dependency. Abort and show which ones @@ -977,31 +976,31 @@ class AdminController extends AdminBaseController $dependent_packages) . " depends on this package. Please remove it first."; } - $this->admin->json_response = ['status' => 'error', 'message' => $message]; - - return false; + $json_response = ['status' => 'error', 'message' => $message]; + echo json_encode($json_response);exit; } try { $dependencies = $this->admin->dependenciesThatCanBeRemovedWhenRemoving($package); $result = Gpm::uninstall($package, []); } catch (\Exception $e) { - $this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()]; - - return false; + $json_response = ['status' => 'error', 'message' => $e->getMessage()]; + echo json_encode($json_response);exit; } if ($result) { - $this->admin->json_response = [ + $json_response = [ 'status' => 'success', 'dependencies' => $dependencies, 'message' => $this->admin->translate(is_string($result) ? $result : 'PLUGIN_ADMIN.UNINSTALL_SUCCESSFUL') ]; + echo json_encode($json_response);exit; } else { - $this->admin->json_response = [ + $json_response = [ 'status' => 'error', 'message' => $this->admin->translate('PLUGIN_ADMIN.UNINSTALL_FAILED') ]; + echo json_encode($json_response);exit; } return true; From 41537db3626bdb8775d48be060f3431b9e03c28a Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 11 Jan 2017 21:33:17 -0700 Subject: [PATCH 09/16] Added lang strings for `never_cache_twig` --- languages/en.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/languages/en.yaml b/languages/en.yaml index 518c0159..7221a21a 100644 --- a/languages/en.yaml +++ b/languages/en.yaml @@ -629,3 +629,5 @@ PLUGIN_ADMIN: REDIS_SOCKET_HELP: "The Redis socket" NOT_SET: "Not set" PERMISSIONS: "Permissions" + NEVER_CACHE_TWIG: "Never Cache Twig" + NEVER_CACHE_TWIG_HELP: "Only cache content and process Twig every time for pages. Ignores twig_first setting." From 5a659b6978bf300b614fbce748716c7e27a52eaf Mon Sep 17 00:00:00 2001 From: Ole Vik Date: Thu, 12 Jan 2017 18:54:55 +0100 Subject: [PATCH 10/16] Update section.html.twig (#922) Close an open paragraph-tag, thus avoiding incorrect HTML and an empty extra paragraph. --- themes/grav/templates/forms/fields/section/section.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/grav/templates/forms/fields/section/section.html.twig b/themes/grav/templates/forms/fields/section/section.html.twig index 4f967b7b..e168bd00 100644 --- a/themes/grav/templates/forms/fields/section/section.html.twig +++ b/themes/grav/templates/forms/fields/section/section.html.twig @@ -5,7 +5,7 @@ {% endif %} {% if field.text %} -

{% if grav.twig.twig.filters['tu'] is defined %}{{ field.text|tu|raw }}{% else %}{{ field.text|t|raw }}{% endif %}

+

{% if grav.twig.twig.filters['tu'] is defined %}{{ field.text|tu|raw }}{% else %}{{ field.text|t|raw }}{% endif %}

{% endif %} {% if field.fields %} From 689f4f977bb59ab89e2ec91367631a0ce0c0421b Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Thu, 12 Jan 2017 18:58:20 +0100 Subject: [PATCH 11/16] Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fef0aa4..20296fb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Fixed saving the configuration if not `admin.super` * Show the clear cache buttons if the user has `admin.cache` permissions [#908](https://github.com/getgrav/grav-plugin-admin/issues/908#issuecomment-270748616) * Fix colorpicker validation when transparency is set to 1.00 [#921](https://github.com/getgrav/grav-plugin-admin/issues/921) + * Fix html markup in section twig [#922](https://github.com/getgrav/grav-plugin-admin/pull/922) # v1.2.7 ## 12/22/2016 From ca00a9b150856526d773e9c5a2d1e36c6f0dcb05 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Thu, 12 Jan 2017 19:36:13 +0100 Subject: [PATCH 12/16] Fix #920 bug in deleting a file uploaded with the `file` field --- CHANGELOG.md | 1 + classes/adminbasecontroller.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20296fb7..5f281e5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Show the clear cache buttons if the user has `admin.cache` permissions [#908](https://github.com/getgrav/grav-plugin-admin/issues/908#issuecomment-270748616) * Fix colorpicker validation when transparency is set to 1.00 [#921](https://github.com/getgrav/grav-plugin-admin/issues/921) * Fix html markup in section twig [#922](https://github.com/getgrav/grav-plugin-admin/pull/922) + * Fix bug in deleting a file uploaded with the `file` field [#920](github.com/getgrav/grav-plugin-admin/issues/920) # v1.2.7 ## 12/22/2016 diff --git a/classes/adminbasecontroller.php b/classes/adminbasecontroller.php index 0bf63a6b..4106366d 100644 --- a/classes/adminbasecontroller.php +++ b/classes/adminbasecontroller.php @@ -806,7 +806,7 @@ class AdminBaseController $field = $uri->param('field'); $event = $this->grav->fireEvent('onAdminCanSave', new Event(['controller' => &$this])); - if (!$event['can_save']) { + if (isset($event['can_save']) && $event['can_save'] == false) { return false; } From 6a1ee7481ac7ed4cf803d62143185660b741b941 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Thu, 12 Jan 2017 19:55:43 +0100 Subject: [PATCH 13/16] Remove unnneded code, related to https://github.com/getgrav/grav-plugin-admin/commit/ca00a9b150856526d773e9c5a2d1e36c6f0dcb05 --- classes/adminbasecontroller.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/classes/adminbasecontroller.php b/classes/adminbasecontroller.php index 4106366d..5e651286 100644 --- a/classes/adminbasecontroller.php +++ b/classes/adminbasecontroller.php @@ -805,11 +805,6 @@ class AdminBaseController $type = $uri->param('type'); $field = $uri->param('field'); - $event = $this->grav->fireEvent('onAdminCanSave', new Event(['controller' => &$this])); - if (isset($event['can_save']) && $event['can_save'] == false) { - return false; - } - $this->taskRemoveMedia(); if ($type == 'pages') { From 41a5ebea8c592070b15eb1440de331f25343ba9d Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 12 Jan 2017 11:59:53 -0700 Subject: [PATCH 14/16] Added changlog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fef0aa4..eda5c4e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Fixed saving the configuration if not `admin.super` * Show the clear cache buttons if the user has `admin.cache` permissions [#908](https://github.com/getgrav/grav-plugin-admin/issues/908#issuecomment-270748616) * Fix colorpicker validation when transparency is set to 1.00 [#921](https://github.com/getgrav/grav-plugin-admin/issues/921) + * Fix for plugin throwing event-based errors when plugin is removed and no longer available to process said event # v1.2.7 ## 12/22/2016 From 730fbf3e332ff3632c24054daf42a8b6ac3994a6 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 12 Jan 2017 12:40:30 -0700 Subject: [PATCH 15/16] Updated changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0066b419..c16caf98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ ## xx/xx/201x 1. [](#improved) - * Allow to clear the cache if admin.maintenance, as stated in the docs [#908](https://github.com/getgrav/grav-plugin-admin/issues/908) + * Allow the ability to clear the cache if `admin.maintenance`, as stated in the docs [#908](https://github.com/getgrav/grav-plugin-admin/issues/908) * Added lang strings for `DEFAULT_LANG` in Site configuration + * Added lang strings for `NEVER_CACHE_TWIG` in System and Page configuration 1. [](#bugfix) * Fixed saving the configuration if not `admin.super` * Show the clear cache buttons if the user has `admin.cache` permissions [#908](https://github.com/getgrav/grav-plugin-admin/issues/908#issuecomment-270748616) From 9706016de9549c8d96af84b187d3614eb1c35088 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 17 Jan 2017 13:16:45 -0700 Subject: [PATCH 16/16] Prepare for release --- CHANGELOG.md | 4 ++-- blueprints.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c16caf98..22a2c791 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ -# v1.2.x -## xx/xx/201x +# v1.2.8 +## 01/17/2017 1. [](#improved) * Allow the ability to clear the cache if `admin.maintenance`, as stated in the docs [#908](https://github.com/getgrav/grav-plugin-admin/issues/908) diff --git a/blueprints.yaml b/blueprints.yaml index 2e16b39b..b4f17127 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Admin Panel -version: 1.2.7 +version: 1.2.8 description: Adds an advanced administration panel to manage your site icon: empire author: