Merge branch 'release/1.2.8'

This commit is contained in:
Andy Miller
2017-01-17 13:17:00 -07:00
10 changed files with 39 additions and 33 deletions

View File

@@ -1,3 +1,18 @@
# 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)
* 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)
* 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)
* 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

View File

@@ -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:

View File

@@ -420,6 +420,7 @@ class AdminBaseController
switch ($type) {
case 'configuration':
case 'config':
case 'system':
$permissions[] = 'admin.configuration';
break;
@@ -804,11 +805,6 @@ class AdminBaseController
$type = $uri->param('type');
$field = $uri->param('field');
$event = $this->grav->fireEvent('onAdminCanSave', new Event(['controller' => &$this]));
if (!$event['can_save']) {
return false;
}
$this->taskRemoveMedia();
if ($type == 'pages') {

View File

@@ -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) . "</cyan> 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;
@@ -1102,7 +1101,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;
}

View File

@@ -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 <HTML> tag"
SITE_DEFAULT_LANG_HELP: "Default language to be used by theme's <HTML> 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,6 @@ PLUGIN_ADMIN:
REDIS_SOCKET: "Redis socket"
REDIS_SOCKET_HELP: "The Redis socket"
NOT_SET: "Not set"
PERMISSIONS: "Permissions"
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."

View File

@@ -6,7 +6,7 @@
{% block titlebar %}
<div class="button-bar">
{% if authorize(['admin.maintenance', 'admin.super']) %}
{% if authorize(['admin.maintenance', 'admin.super', 'admin.cache']) %}
<div class="button-group">
<button data-clear-cache-type="" data-clear-cache="{{ uri.addNonce(clear_cache_url, 'admin-form', 'admin-nonce') }}" class="button"><i class="fa fa-trash"></i> {{ "PLUGIN_ADMIN.CLEAR_CACHE"|tu }}</button>
<button type="button" class="button dropdown-toggle" data-toggle="dropdown">
@@ -20,7 +20,8 @@
<li><a data-clear-cache-type="tmp-only" data-clear-cache="{{ uri.addNonce(clear_cache_url ~'/cleartype' ~ config.system.param_sep ~ 'tmp-only', 'admin-form', 'admin-nonce') }}" href="#">{{ "PLUGIN_ADMIN.CLEAR_CACHE_TMP_ONLY"|tu }}</a></li>
</ul>
</div>
{% endif %}
{% if authorize(['admin.maintenance', 'admin.super']) %}
<button data-gpm-checkupdates="" class="button"><i class="fa fa-refresh"></i> {{ "PLUGIN_ADMIN.CHECK_FOR_UPDATES"|tu }}</button>
{% endif %}
</div>

View File

@@ -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 %}
<div class="form-list-wrapper {{ field.size }}" data-type="collection">

View File

@@ -5,7 +5,7 @@
{% endif %}
{% if field.text %}
<p>{% if grav.twig.twig.filters['tu'] is defined %}{{ field.text|tu|raw }}{% else %}{{ field.text|t|raw }}{% endif %}<p>
<p>{% if grav.twig.twig.filters['tu'] is defined %}{{ field.text|tu|raw }}{% else %}{{ field.text|t|raw }}{% endif %}</p>
{% endif %}
{% if field.fields %}

View File

@@ -1,5 +0,0 @@
{% if admin.json_response %}
{{ admin.json_response|json_encode|raw }}
{% else %}
{}
{% endif %}

View File

@@ -1,5 +0,0 @@
{% if admin.json_response %}
{{ admin.json_response|json_encode|raw }}
{% else %}
{}
{% endif %}