From f3de51e99286473a85f64339422a1436fe8e3d71 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Mon, 5 Jun 2017 17:36:44 +1000 Subject: [PATCH] Add backend and notifications settings category URL -> url Move mail settings below mail templates --- modules/system/ServiceProvider.php | 20 +++++------ modules/system/classes/PluginBase.php | 38 +++++++++++++-------- modules/system/classes/SettingsManager.php | 2 ++ modules/system/classes/UpdateManager.php | 4 +-- modules/system/lang/en/lang.php | 4 ++- modules/system/traits/PropertyContainer.php | 8 +++-- 6 files changed, 46 insertions(+), 30 deletions(-) diff --git a/modules/system/ServiceProvider.php b/modules/system/ServiceProvider.php index 4de9d8f3d..32f220ed8 100644 --- a/modules/system/ServiceProvider.php +++ b/modules/system/ServiceProvider.php @@ -338,7 +338,7 @@ class ServiceProvider extends ModuleServiceProvider protected function registerBackendReportWidgets() { WidgetManager::instance()->registerReportWidgets(function ($manager) { - $manager->registerReportWidget('System\ReportWidgets\Status', [ + $manager->registerReportWidget(\System\ReportWidgets\Status::class, [ 'label' => 'backend::lang.dashboard.status.widget_title_default', 'context' => 'dashboard' ]); @@ -401,15 +401,6 @@ class ServiceProvider extends ModuleServiceProvider 'permissions' => ['backend.manage_users'], 'order' => 400 ], - 'mail_settings' => [ - 'label' => 'system::lang.mail.menu_label', - 'description' => 'system::lang.mail.menu_description', - 'category' => SettingsManager::CATEGORY_MAIL, - 'icon' => 'icon-envelope', - 'class' => 'System\Models\MailSetting', - 'permissions' => ['system.manage_mail_settings'], - 'order' => 600 - ], 'mail_templates' => [ 'label' => 'system::lang.mail_templates.menu_label', 'description' => 'system::lang.mail_templates.menu_description', @@ -419,6 +410,15 @@ class ServiceProvider extends ModuleServiceProvider 'permissions' => ['system.manage_mail_templates'], 'order' => 610 ], + 'mail_settings' => [ + 'label' => 'system::lang.mail.menu_label', + 'description' => 'system::lang.mail.menu_description', + 'category' => SettingsManager::CATEGORY_MAIL, + 'icon' => 'icon-envelope', + 'class' => 'System\Models\MailSetting', + 'permissions' => ['system.manage_mail_settings'], + 'order' => 620 + ], 'event_logs' => [ 'label' => 'system::lang.event_log.menu_label', 'description' => 'system::lang.event_log.menu_description', diff --git a/modules/system/classes/PluginBase.php b/modules/system/classes/PluginBase.php index 613ef5c97..12ac9d933 100644 --- a/modules/system/classes/PluginBase.php +++ b/modules/system/classes/PluginBase.php @@ -157,16 +157,18 @@ class PluginBase extends ServiceProviderBase /** * Registers any report widgets provided by this plugin. * The widgets must be returned in the following format: - * [ - * 'className1'=>[ - * 'label' => 'My widget 1', - * 'context' => ['context-1', 'context-2'], - * ], - * 'className2' => [ - * 'label' => 'My widget 2', - * 'context' => 'context-1' - * ] - * ] + * + * return [ + * 'className1'=>[ + * 'label' => 'My widget 1', + * 'context' => ['context-1', 'context-2'], + * ], + * 'className2' => [ + * 'label' => 'My widget 2', + * 'context' => 'context-1' + * ] + * ]; + * * @return array */ public function registerReportWidgets() @@ -177,8 +179,12 @@ class PluginBase extends ServiceProviderBase /** * Registers any form widgets implemented in this plugin. * The widgets must be returned in the following format: - * ['className1' => 'alias'], - * ['className2' => 'anotherAlias'] + * + * return [ + * ['className1' => 'alias'], + * ['className2' => 'anotherAlias'] + * ]; + * * @return array */ public function registerFormWidgets() @@ -199,8 +205,12 @@ class PluginBase extends ServiceProviderBase /** * Registers any mail templates implemented by this plugin. * The templates must be returned in the following format: - * ['acme.blog::mail.welcome' => 'This is a description of the welcome template'], - * ['acme.blog::mail.forgot_password' => 'This is a description of the forgot password template'], + * + * return [ + * ['acme.blog::mail.welcome' => 'This is a description of the welcome template'], + * ['acme.blog::mail.forgot_password' => 'This is a description of the forgot password template'], + * ]; + * * @return array */ public function registerMailTemplates() diff --git a/modules/system/classes/SettingsManager.php b/modules/system/classes/SettingsManager.php index b3741aca4..b94eb0841 100644 --- a/modules/system/classes/SettingsManager.php +++ b/modules/system/classes/SettingsManager.php @@ -29,8 +29,10 @@ class SettingsManager const CATEGORY_SOCIAL = 'system::lang.system.categories.social'; const CATEGORY_SYSTEM = 'system::lang.system.categories.system'; const CATEGORY_EVENTS = 'system::lang.system.categories.events'; + const CATEGORY_BACKEND = 'system::lang.system.categories.backend'; const CATEGORY_CUSTOMERS = 'system::lang.system.categories.customers'; const CATEGORY_MYSETTINGS = 'system::lang.system.categories.my_settings'; + const CATEGORY_NOTIFICATIONS = 'system::lang.system.categories.notifications'; /** * @var array Cache of registration callbacks. diff --git a/modules/system/classes/UpdateManager.php b/modules/system/classes/UpdateManager.php index 7a6c20af8..a8cc7f346 100644 --- a/modules/system/classes/UpdateManager.php +++ b/modules/system/classes/UpdateManager.php @@ -2,7 +2,7 @@ use Db; use App; -use URL; +use Url; use File; use Lang; use Http; @@ -874,7 +874,7 @@ class UpdateManager */ protected function applyHttpAttributes($http, $postData) { - $postData['server'] = base64_encode(serialize(['php' => PHP_VERSION, 'url' => URL::to('/')])); + $postData['server'] = base64_encode(serialize(['php' => PHP_VERSION, 'url' => Url::to('/')])); if ($projectId = Parameter::get('system::project.id')) { $postData['project'] = $projectId; diff --git a/modules/system/lang/en/lang.php b/modules/system/lang/en/lang.php index d04cab1ad..cbd6cfd9b 100644 --- a/modules/system/lang/en/lang.php +++ b/modules/system/lang/en/lang.php @@ -61,9 +61,11 @@ return [ 'users' => 'Users', 'system' => 'System', 'social' => 'Social', + 'backend' => 'Backend', 'events' => 'Events', 'customers' => 'Customers', - 'my_settings' => 'My Settings' + 'my_settings' => 'My Settings', + 'notifications' => 'Notifications' ] ], 'theme' => [ diff --git a/modules/system/traits/PropertyContainer.php b/modules/system/traits/PropertyContainer.php index 9760783b4..f156549fb 100644 --- a/modules/system/traits/PropertyContainer.php +++ b/modules/system/traits/PropertyContainer.php @@ -27,16 +27,18 @@ trait PropertyContainer { $definedProperties = $this->defineProperties() ?: []; - // Determine and implement default values + /* + * Determine and implement default values + */ $defaultProperties = []; + foreach ($definedProperties as $name => $information) { if (array_key_exists('default', $information)) { $defaultProperties[$name] = $information['default']; } } - $properties = array_merge($defaultProperties, $properties); - // @todo Check required properties + $properties = array_merge($defaultProperties, $properties); return $properties; }