diff --git a/.gitattributes b/.gitattributes index e3cf70c0..c5ef7313 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1,7 @@ # Linguist Normalizer *.yaml linguistic-language=PHP *.twig linguistic-language=PHP -**/gulpfile.js linguist-vendored +**/gulpfile.babel.js linguist-vendored **/webpack.conf.js linguist-vendored **/js/*.js linguist-vendored **/js/*.json linguist-vendored diff --git a/.gitignore b/.gitignore index fcd73813..77d39444 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ tests/_output/* tests/_support/_generated/* tests/cache/* tests/error.log +/crowdin.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index b194ac9f..c6c77ca0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,354 @@ +# v1.10.0 +## 01/19/2021 + +1. [](#new) + * Requires **Grav 1.7 and PHP 7.3.6** + * Read about this release in the [Grav 1.7 Released](https://getgrav.org/blog/grav-1.7-released) blog post + * Read the full list of changes in the [Changelog on GitHub](https://github.com/getgrav/grav-plugin-admin/blob/1.10.0/CHANGELOG.md) + * Please read [Grav 1.7 Upgrade Guide](https://learn.getgrav.org/17/advanced/grav-development/grav-17-upgrade-guide) before upgrading! +1. [](#improved) + * Various notifications improvements +1. [](#bugfix) + * Fixed missed highlight on the selected page in Parents field + * Fixed notifications that would not be remembered as hidden + * Fixed taxonomy field not listing existing options in Flex Pages + * Fixed taxonomy field not working outside pages + * Fixed fatal error when moving a page using the old implementation [#2019](https://github.com/getgrav/grav-plugin-admin/issues/2019) + * Fixed evaluating default value in `hidden` field (thanks @NicoHood) + +# v1.10.0-rc.20 +## 12/14/2020 + +1. [](#improved) + * Cookies now explicitly set `SameSite` to `Lax` unless otherwise specified [#1998](https://github.com/getgrav/grav-plugin-admin/issues/1998) + * Exposed **Cookies** class (`Grav.default.Utils.Cookies`) for developers that need it in Admin. +1. [](#bugfix) + * Fixed Plugins references in Themes details page. + * Fixed issue preventing purchase of Themes within Admin and redirecting instead. + * Regression: Values inside Fieldset do not display [#1995](https://github.com/getgrav/grav-plugin-admin/issues/1995) + +# v1.10.0-rc.19 +## 12/02/2020 + +1. [](#improved) + * Just keeping sync with Grav rc.19 + +# v1.10.0-rc.18 +## 12/02/2020 + +1. [](#new) + * Retired "Secure Delete" and "Warn on page delete". You are now always warned and asked to confirm a deletion. +1. [](#improved) + * Auto-link a plugin/theme license in details if it starts with `http` + * Allow to fallback to `docs:` instead of `readme:` + * Forward a `sid` to GPM when downloading a premium package + * Better support for array field key/value when either key or value is stored empty [#1972](https://github.com/getgrav/grav-plugin-admin/issues/1972) + * Remember the open state of the sidebar [#1973](https://github.com/getgrav/grav-plugin-admin/issues/1973) + * Upgraded node dependencies to latest version. Improved speed of JS compilation. + * Added modal to confirm updating Grav as well as cool down counter before enabling Update button [#1257](https://github.com/getgrav/grav-plugin-admin/issues/1257) + * Better handling of offline/intranet mode when the repository index is missing. Faster admin. [#1916](https://github.com/getgrav/grav-plugin-admin/issues/1916) + * Statistics is now Page View Statistics [#1885](https://github.com/getgrav/grav-plugin-admin/issues/1885) + * It is now possible to use regex as values for "Hide page types in Admin" and "Hide modular page types in Admin" settings [#1828](https://github.com/getgrav/grav-plugin-admin/issues/1828) + * Default to `disabled` state for all cron-jobs +1. [](#bugfix) + * Fixed Safari issue with new ACL picker field [#1955](https://github.com/getgrav/grav-plugin-admin/issues/1955) + * Stop propagation of ACL add button in ACL picker [flex-objects#83](https://github.com/trilbymedia/grav-plugin-flex-objects/issues/83) + * Fixed missing special groups `authors` and `defaults` for pages + * Fixed Page Move action and selection highlight in Parents selector modal [flex-objects#80](https://github.com/trilbymedia/grav-plugin-flex-objects/issues/80) + * Fixed folder auto-naming in Add Module [#1937](https://github.com/getgrav/grav-plugin-admin/issues/1937) + * Fixed remodal issue triggering close when selecting a dropdown item ending outside of scope [#1682](https://github.com/getgrav/grav-plugin-admin/issues/1682) + * Reworked how collapsed lists work so the tooltip is not cut off [#1928](https://github.com/getgrav/grav-plugin-admin/issues/1928) + * Fixed KeepAlive issue where too large of a session value would fire the keep alive immediately [#1860](https://github.com/getgrav/grav-plugin-admin/issues/1860) + * Fixed stringable objects breaking the inputs + * Fixed filepicker, pagemediaselect fields with `multiple: true` and `array: true` [#1580](https://github.com/getgrav/grav-plugin-admin/issues/1580) + +# v1.10.0-rc.17 +## 10/07/2020 + +1. [](#new) + * Support premium themes +1. [](#improved) + * Improved some error messages for better readability + * Strip tags from browser title +1. [](#bugfix) + * More multi-site routing fixes + * Fixed issue that would force a page reload when failing to install/update a plugin or theme. + * Fixed proxy/browser caching issues in admin pages + +# v1.10.0-rc.16 +## 09/01/2020 + +1. [](#improved) + * Made all the `onAdmin*` CRUD events to pass `object` (and backwards compatible `page`) to make them easier to use + * Updated vendor libraries including `SCSSPHP` to v1.2 +1. [](#bugfix) + * Fixed issue with File field being used in Theme/Plugins + * Fixed bad redirection after successful admin login in subdirectory multisite [#1487](https://github.com/getgrav/grav-plugin-admin/issues/1487) + +# v1.10.0-rc.15 +## 07/22/2020 + +1. [](#bugfix) + * Disabled the EXIF library for Dropzone for fixing the orientation as it was getting applied twice [#1923](https://github.com/getgrav/grav-plugin-admin/issues/1923) + * Forked Dropzone fo fix issue with Resize + Exif orientation [#1923](https://github.com/getgrav/grav-plugin-admin/issues/1923) + * Fixed URI encode for the preview of images names + +# v1.10.0-rc.14 +## 07/09/2020 + +1. [](#improved) + * Completely removed old Google font support for upgrade compatibility +1. [](#bugfix) + * Fixed bad `use` reference to `UserObject` + +# v1.10.0-rc.13 +## 07/01/2020 + +1. [](#improved) + * Improved color picker field + * Trim login route for safety + * Composer update to grab latest vendor libs + +# v1.10.0-rc.12 +## 06/08/2020 + +1. [](#new) + * Added ability to set a preferred markdown editor in user profile + * Added new `onAdminListContentEditors` event to add a custom editor to the list of available +1. [](#bugfix) + * Fixed issue deleting file from a plugin's configuration + * Use `Pages::find()` instead of `Pages::dispatch()` as we do not want to redirect out of admin + * Fixed broken `parent` field when using the old pages + * Fixed broken `file` field preview when using streams in the path + +# v1.10.0-rc.11 +## 05/14/2020 + +1. [](#new) + * Major enhancements to "White Label" functionality including ability to export/import presets + * New horizontal scroller for theme presets + * Codemirror Fontsize / Preset / Font preference options +1. [](#improved) + * Fixed lots of styling issues related to "White Label" presets + * Changed out "One Light" theme for new "Firewatch Light" theme + * New scrolling system based on `SimpleBar` + native CSS scrollbar styling + +# v1.10.0-rc.10 +## 04/30/2020 + +1. [](#new) + * Addd new `taskConvertUrls` method for use with 3rd party editors + +# v1.10.0-rc.9 +## 04/27/2020 + +1. [](#new) + * Added new "White Label" functionality to customize admin colors + logos + * Added badge count for children in the Parents field +1. [](#improved) + * Added markdown support to `text` in `section` field +1. [](#bugfix) + * Prevent loading Pages in Parents field if they don't have children + * Fixed custom folder in `mediapicker` field not working with streams + * Fixed language redirect adding extra language prefix in Flex + * Fixed `Invalid input in "Parent"` when saving page in raw mode [#1869](https://github.com/getgrav/grav-plugin-admin/issues/1869) + +# v1.10.0-rc.8 +## 03/19/2020 + +1. [](#new) + * Added `has-children` flag in parent field data response + * Added `RESET` en lang string +1. [](#bugfix) + * Fixed parent field not working with regular pages + +# v1.10.0-rc.7 +## 03/05/2020 + +1. [](#new) + * Enable admin cache by default (for existing sites, check `Plugins > Admin Panel > Enable Admin Caching`) +1. [](#improved) + * Removed old `scss.sh` and `watch.sh` scripts, use `gulp watch-css` + * Added keysOnly parameter to `AdminPlugin::pagesTypes()` and `AdminPlugin::pagesModularTypes()` methods + * Added ignore parameter to `Admin::types()` and `Admin::modularTypes()` methods + * Improved configuration fields for hiding page types in Admin +1. [](#bugfix) + * Fixed minor UI padding in Flex pages [#1825](https://github.com/getgrav/grav-plugin-admin/issues/1825) + * Fixed `column` and `section` fields loosing user entered value when form submit fails + * Fixed `order` field not working with a new Flex Page + +# v1.10.0-rc.6 +## 02/11/2020 + +1. [](#new) + * Pass phpstan level 1 tests + * Updated semver library to v1.5 + * Require flex-objects plugin +1. [](#improved) + * Added some debugging messages (turned off by default) + +# v1.10.0-rc.5 +## 02/03/2020 + +1. [](#new) + * No changes, just keeping things in sync with Grav RC version + +# v1.10.0-rc.4 +## 02/03/2020 + +1. [](#new) + * Added message to dashboard to install Flex Objects plugin if it is missing + * Updated `permissions` field to use new `$grav['permissions']` + * DEPRECATED `onAdminRegisterPermissions` event, use `PermissionsRegisterEvent::class` event instead + * DEPRECATED `Admin::setPermissions()` and `Admin::addPermissions()`, use `PermissionsRegisterEvent::class` event instead + * DEPRECATED `Admin::getPermissions()`, use `$grav['permissions']->getInstances()` instead +1. [](#improved) + * Added `field.show_label` and `field.label` display logic from frontend forms +1. [](#bugfix) + * Fixed user profile when using `Flex Users` only in admin + * Fixed saving data with empty field, default value (from config, plugin, theme) was used instead + * Fixed JS bug is using empty Grav URI param key + * Fixed bug in toggleable field being disabled with empty value (`''` `0`, `false`, `[]`...) + * Fixed `admin_route()` twig function to work properly with Grav 1.7.0-rc.4, which fixes `Route` base + * Fixed misleading 'Show sensitive data' configuration option wording [#1818](https://github.com/getgrav/grav-plugin-admin/issues/1818) + +# v1.10.0-rc.3 +## 01/02/2020 + +1. [](#new) + * Added ability to display **Changelogs** for `Grav`, `Plugins` and `Themes` + * Added raw root page support for `Flex Pages` + +# v1.10.0-rc.2 +## 12/04/2019 + +1. [](#new) + * Added support for hiding parts of admin by `Deny` permissions (`Flex Users` only) + * Optimized `parent` field for Flex Pages +1. [](#improved) + * Improved `permissions` field to add support for displaying calculated permissions + * Grav 1.7: Updated deprecated `$page->modular()` method calls to `$page->isModule()` + * Output the current process user name in Scheduler instructions + * Translations: rename MODULAR to MODULE everywhere +1. [](#bugfix) + * Fixed `permissions` field with nested permissions + * Fixed Save Shortcut (CTRL + S / CMD + S) not working with new Flex Pages [#1787](https://github.com/getgrav/grav-plugin-admin/issues/1787) + +# v1.10.0-rc.1 +## 11/06/2019 + +1. [](#new) + * Added a new `onAdminLogFiles()` event for 3rd party plugins to register log files for log viewer [#1765](https://github.com/getgrav/grav-plugin-admin/issues/1765) +1. [](#improved) + * Improved delete button UI [#1769](https://github.com/getgrav/grav-plugin-admin/issues/1769) + * Ability to configure display of 3rd party dashboard widgets [#1766](https://github.com/getgrav/grav-plugin-admin/issues/1766) +1. [](#bugfix) + * Fixed administrator user creation when `Flex Users` is enabled + * Fixed minor button alignment in FF [#1760](https://github.com/getgrav/grav-plugin-admin/issues/1760) + +# v1.10.0-beta.10 +## 10/03/2019 + +1. [](#bugfix) + * Regression: Fixed language assignments for the pages without set language + +# v1.10.0-beta.9 +## 09/26/2019 + +1. [](#bugfix) + * Make pages field to work with Flex Pages + +# v1.10.0-beta.8 +## 09/19/2019 + +1. [](#new) + * Add ability to Sanitize SVGs on file upload + * Add ability to Sanitize SVGs in Page media +1. [](#improved) + * YAML linter report now supports multi-language + * Better colors/placement of toolbar buttons in page edit view +1. [](#bugfix) + * Fixed missing language for AJAX requests + * Fixed redirect with absolute language URL + * Fixed issue with user avatar reference not being deleted when image removed + +# v1.10.0-beta.7 +## 08/30/2019 + +1. [](#bugfix) + * Fixed regression: Do not require Flex Objects plugin [grav#2653](https://github.com/getgrav/grav/issues/2653) + +# v1.10.0-beta.6 +## 08/29/2019 + +1. [](#improved) + * Optimized admin for speed (only load frontend pages on demand) + * Updated navigation menu to be fully controlled and overrideable by `onAdminMenu` event + * Lots of Flex Page speed improvements + +# v1.10.0-beta.5 +## 08/11/2019 + +1. [](#new) + * Added `data()` twig function to create data object from an array +1. [](#improved) + * Better support for `array` field into `list` field + * Made RAW blueprints (expert mode) to work properly with Flex Form + * Better support for `clockwork` logs +1. [](#bugfix) + * Fixed issue with nested `list` fields both utilizing the custom `key` functionality + * Regression: Page Preview not working, bad url [#1715](https://github.com/getgrav/grav-plugin-admin/issues/1715) + * Fixed '+New Folder' to work with new parent picker + * Fixed missing XSS check field when editing modular page as raw + * Fixed minor CSS layout issue [#1717](https://github.com/getgrav/grav-plugin-admin/issues/1717) + +# v1.10.0-beta.4 +## 07/01/2019 + +1. [](#new) + * Added `Admin::redirect()` method to allow redirects to be used outside of controllers + * Added `$admin->adminRoute()` method and `admin_route()` twig function to create language aware admin page links + * Renamed `Admin::route()` to `Admin::getCurrentRoute()` and deprecated the old call +1. [](#improved) + * Much improved multi-language support for pages + * Admin redirects should now work better with multiple languages enabled +1. [](#bugfix) + * Fixed default language being renamed to `page.en.md` (English) instead of keeping existing `page.md` filename + * Fixed possibility to override already existing translation by `Save As Language` + * Fixed missing default translation if page used plain `.md` file extension without language code + * Fixed wrong translation showing up as page fallback language + * Integrated Admin 1.9.8 bug fixes + +# v1.10.0-beta.3 +## 06/24/2019 + +1. [](#improved) + * Smarter handling of symlinks in parent field +1. [](#bugfix) + * Fixed issue with windows paths in `parent` field [#1699](https://github.com/getgrav/grav-plugin-admin/issues/1699) + +# v1.10.0-beta.2 +## 06/21/2019 + +1. [](#improved) + * Moved Remodal in-house and added support for stackable modals [#1698](https://github.com/getgrav/grav-plugin-admin/issues/1698), [#1699](https://github.com/getgrav/grav-plugin-admin/issues/1699) +1. [](#bugfix) + * Fixed missing check for maximum allowed files in `files` field + +# v1.10.0-beta.1 +## 06/14/2019 + +1. [](#new) + * New Parent/Move field using Ajax for better performance + * Improvements to cache clearing when admin cache is enabled + * Require Grav v1.7 + * Use PSR-4 for plugin classes + * Added support for Twig 2.11 (compatible with Twig 1.40+) +1. [](#improved) + * Various admin performance improvements +1. [](#bugfix) + * Fixed admin caching issues + # v1.9.19 ## 12/14/2020 diff --git a/README.md b/README.md index 430509d1..d894296b 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,47 @@ The **standard free version**, is very powerful, and has more functionality than We also intend to release in the near future a more feature-rich **pro version** that will include enhanced functionality, as well as some additional nice-to-have capabilities. This pro version will be a **paid** plugin the price of which is not yet 100% finalized. +# Admin Events + +## General events + +- onAdminRegisterPermissions - (admin) +- onAdminThemeInitialized +- onAdminPage - (page) +- onAdminMenu +- onAdminTwigTemplatePaths - (paths) + +## Page specific events + +- onAdminDashboard +- onAdminTools - (tools) +- onAdminLogFiles - (logs) +- onAdminGenerateReports - (reports) + +## Tasks + +- onAdminControllerInit - (controller) +- onAdminTaskExecute - (controller, method) + +## Editing + +- onAdminData +- onAdminSave - (object) +- onAdminAfterSave - (object) + +## Pages + +- onAdminPageTypes - (types) +- onAdminModularPageTypes +- onAdminSave - (page) +- onAdminAfterSaveAs - (path) +- onAdminAfterSave - (page) +- onAdminAfterDelete - (page) +- onAdminAfterAddMedia - (page) +- onAdminAfterDelMedia - (page) +- onAdminCreatePageFrontmatter - (header, data) + + # Running Tests First install the dev dependencies by running `composer update` from the Grav root. diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 00000000..de0e3528 --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,6 @@ +# Upgrading to Admin 1.10 + +Twig: + +* **Admin link**: When linking to another admin page, use `{{ admin_route('/config/site') }}` instead of any other method, such as `{{ base_url_relative }}/config/site` (fixes multi-language issues) + diff --git a/admin.php b/admin.php index 326bd95b..5c4280bf 100644 --- a/admin.php +++ b/admin.php @@ -3,6 +3,7 @@ namespace Grav\Plugin; use Composer\Autoload\ClassLoader; use Grav\Common\Cache; +use Grav\Common\Data\Data; use Grav\Common\Debugger; use Grav\Common\File\CompiledYamlFile; use Grav\Common\Grav; @@ -18,6 +19,10 @@ use Grav\Common\Session; use Grav\Common\Uri; use Grav\Common\User\Interfaces\UserCollectionInterface; use Grav\Common\Utils; +use Grav\Common\Yaml; +use Grav\Events\PermissionsRegisterEvent; +use Grav\Framework\Acl\PermissionsReader; +use Grav\Framework\Psr7\Response; use Grav\Framework\Session\Exceptions\SessionException; use Grav\Plugin\Admin\Admin; use Grav\Plugin\Admin\Popularity; @@ -25,8 +30,10 @@ use Grav\Plugin\Admin\Router; use Grav\Plugin\Admin\Themes; use Grav\Plugin\Admin\AdminController; use Grav\Plugin\Admin\Twig\AdminTwigExtension; +use Grav\Plugin\Admin\WhiteLabel; use Grav\Plugin\Form\Form; use Grav\Plugin\Login\Login; +use Pimple\Container; use RocketTheme\Toolbox\Event\Event; class AdminPlugin extends Plugin @@ -87,6 +94,8 @@ class AdminPlugin extends Plugin 'onShutdown' => ['onShutdown', 1000], 'onAdminDashboard' => ['onAdminDashboard', 0], 'onAdminTools' => ['onAdminTools', 0], + 'onAdminSave' => ['onAdminSave', 0], + PermissionsRegisterEvent::class => ['onRegisterPermissions', 1000], ]; } @@ -115,6 +124,33 @@ class AdminPlugin extends Plugin ], 'file' => [ 'array' => true + ], + 'permissions' => [ + 'ignore_empty' => true, + 'validate' => [ + 'type' => 'array' + ], + 'filter' => [ + 'type' => 'flatten_array', + 'value_type' => 'bool', + ] + ], + 'acl_picker' => [ + 'ignore_empty' => true, + 'validate' => [ + 'type' => 'array' + ], + 'filter' => [ + 'type' => 'array', + 'key_type' => 'string', + 'value_type' => 'bool', + ] + ], + 'taxonomy' => [ + 'multiple' => true, + 'validate' => [ + 'type' => 'array' + ] ] ]; } @@ -158,6 +194,10 @@ class AdminPlugin extends Plugin // Only activate admin if we're inside the admin path. if ($this->isAdminPath()) { + $pages = $this->grav['pages']; + if (method_exists($pages, 'disablePages')) { + $pages->disablePages(); + } try { $this->grav['session']->init(); } catch (SessionException $e) { @@ -200,7 +240,7 @@ class AdminPlugin extends Plugin } // Turn on Twig autoescaping - if (method_exists($this->grav['twig'], 'setAutoescape') && $this->grav['uri']->param('task') !== 'processmarkdown') { + if ($this->grav['uri']->param('task') !== 'processmarkdown') { $this->grav['twig']->setAutoescape(true); } @@ -216,6 +256,9 @@ class AdminPlugin extends Plugin $this->grav['themes'] = function () { return new Themes($this->grav); }; + + // Initialize white label functionality + $this->grav['admin-whitelabel'] = new WhiteLabel(); } // We need popularity no matter what @@ -244,6 +287,25 @@ class AdminPlugin extends Plugin } } + /** + * Force compile during save if admin plugin save + * + * @param Event $event + */ + public function onAdminSave(Event $event) + { + $obj = $event['object']; + + if ($obj instanceof Data && $obj->blueprints()->getFilename() === 'admin/blueprints') { + + [$status, $msg] = $this->grav['admin-whitelabel']->compilePresetScss($obj); + if (!$status) { + $this->grav['messages']->add($msg, 'error'); + } + } + } + + /** * [onPageInitialized:0] */ @@ -270,9 +332,9 @@ class AdminPlugin extends Plugin $form = $event['form']; $action = $event['action']; + Admin::DEBUG && Admin::addDebugMessage('Admin Form: ' . $action); switch ($action) { case 'register_admin_user': - if (Admin::doAnyUsersExist()) { throw new \RuntimeException('A user account already exists, please create an admin account manually.'); } @@ -320,7 +382,6 @@ class AdminPlugin extends Plugin $data['fullname'] = $data['fullname'] ?? $inflector->titleize($username); $data['title'] = $data['title'] ?? 'Administrator'; $data['state'] = 'enabled'; - $data['access'] = ['admin' => ['login' => true, 'super' => true], 'site' => ['login' => true]]; /** @var UserCollectionInterface $users */ $users = $this->grav['accounts']; @@ -328,14 +389,15 @@ class AdminPlugin extends Plugin // Create user object and save it $user = $users->load($username); $user->update($data); + $user->set('access', ['admin' => ['login' => true, 'super' => true], 'site' => ['login' => true]]); $user->save(); - //Login user + // Login user $this->grav['session']->user = $user; unset($this->grav['user']); $this->grav['user'] = $user; $user->authenticated = true; - $user->authorized = $user->authorize('admin.login'); + $user->authorized = $user->authorize('admin.login') ?? false; $messages = $this->grav['messages']; $messages->add($this->grav['language']->translate('PLUGIN_ADMIN.LOGIN_LOGGED_IN'), 'info'); @@ -370,11 +432,27 @@ class AdminPlugin extends Plugin */ public function onAdminDashboard() { - $this->grav['twig']->plugins_hooked_dashboard_widgets_top[] = ['template' => 'dashboard-maintenance']; - $this->grav['twig']->plugins_hooked_dashboard_widgets_top[] = ['template' => 'dashboard-statistics']; - $this->grav['twig']->plugins_hooked_dashboard_widgets_top[] = ['template' => 'dashboard-notifications']; - $this->grav['twig']->plugins_hooked_dashboard_widgets_top[] = ['template' => 'dashboard-feed']; - $this->grav['twig']->plugins_hooked_dashboard_widgets_main[] = ['template' => 'dashboard-pages']; + $lang = $this->grav['language']; + $this->grav['twig']->plugins_hooked_dashboard_widgets_top[] = [ + 'name' => $lang->translate('PLUGIN_ADMIN.MAINTENANCE'), + 'template' => 'dashboard-maintenance', + ]; + $this->grav['twig']->plugins_hooked_dashboard_widgets_top[] = [ + 'name' => $lang->translate('PLUGIN_ADMIN.VIEWS_STATISTICS'), + 'template' => 'dashboard-statistics', + ]; + $this->grav['twig']->plugins_hooked_dashboard_widgets_top[] = [ + 'name' => $lang->translate('PLUGIN_ADMIN.NOTIFICATIONS'), + 'template' => 'dashboard-notifications', + ]; + $this->grav['twig']->plugins_hooked_dashboard_widgets_top[] = [ + 'name' => $lang->translate('PLUGIN_ADMIN.NEWS_FEED'), + 'template' => 'dashboard-feed', + ]; + $this->grav['twig']->plugins_hooked_dashboard_widgets_main[] = [ + 'name' => $lang->translate('PLUGIN_ADMIN.LATEST_PAGE_UPDATES'), + 'template' => 'dashboard-pages', + ]; } @@ -387,12 +465,13 @@ class AdminPlugin extends Plugin */ public function onAdminTools(Event $event) { + $lang = $this->grav['language']; $event['tools'] = array_merge($event['tools'], [ - 'backups' => [['admin.maintenance', 'admin.super'], $this->grav['language']->translate('PLUGIN_ADMIN.BACKUPS')], - 'scheduler' => [['admin.super'], $this->grav['language']->translate('PLUGIN_ADMIN.SCHEDULER')], - 'logs' => [['admin.super'], $this->grav['language']->translate('PLUGIN_ADMIN.LOGS')], - 'reports' => [['admin.super'], $this->grav['language']->translate('PLUGIN_ADMIN.REPORTS')], - 'direct-install' => [['admin.super'], $this->grav['language']->translate('PLUGIN_ADMIN.DIRECT_INSTALL')], + 'backups' => [['admin.maintenance', 'admin.super'], $lang->translate('PLUGIN_ADMIN.BACKUPS')], + 'scheduler' => [['admin.super'], $lang->translate('PLUGIN_ADMIN.SCHEDULER')], + 'logs' => [['admin.super'], $lang->translate('PLUGIN_ADMIN.LOGS')], + 'reports' => [['admin.super'], $lang->translate('PLUGIN_ADMIN.REPORTS')], + 'direct-install' => [['admin.super'], $lang->translate('PLUGIN_ADMIN.DIRECT_INSTALL')], ]); return $event; @@ -408,6 +487,7 @@ class AdminPlugin extends Plugin // Force SSL with redirect if required if ($config->get('system.force_ssl')) { if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on') { + Admin::DEBUG && Admin::addDebugMessage('Admin SSL forced on, redirect'); $url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $this->grav->redirect($url); } @@ -415,9 +495,6 @@ class AdminPlugin extends Plugin $this->session = $this->grav['session']; - // Set original route for the home page. - $home = '/' . trim($this->config->get('system.home.alias'), '/'); - // set session variable if it's passed via the url if ($this->uri->param('mode') === 'expert') { $this->session->expert = true; @@ -428,37 +505,19 @@ class AdminPlugin extends Plugin $this->session->expert = $this->session->expert ?? false; } - /** @var Pages $pages */ - $pages = $this->grav['pages']; - - $this->grav['admin']->routes = $pages->routes(); - - // Remove default route from routes. - if (isset($this->grav['admin']->routes['/'])) { - unset($this->grav['admin']->routes['/']); - } - - $page = $pages->dispatch('/', true); - - // If page is null, the default page does not exist, and we cannot route to it - if ($page) { - $page->route($home); - } - // Make local copy of POST. $post = $this->grav['uri']->post(); - // Initialize Page Types - Pages::types(); - // Handle tasks. $this->admin->task = $task = $this->grav['task'] ?? $this->grav['action']; if ($task) { + Admin::DEBUG && Admin::addDebugMessage("Admin task: {$task}"); $this->initializeController($task, $post); } elseif ($this->template === 'logs' && $this->route) { // Display RAW error message. - echo $this->admin->logEntry(); - exit(); + $response = new Response(200, [], $this->admin->logEntry()); + + $this->grav->close($response); } $self = $this; @@ -466,8 +525,6 @@ class AdminPlugin extends Plugin // make sure page is not frozen! unset($this->grav['page']); - $this->admin->pagesCount(); - // Replace page service with admin. $this->grav['page'] = function () use ($self) { $page = new Page(); @@ -481,12 +538,15 @@ class AdminPlugin extends Plugin $page = $event['page']; if ($page->slug()) { + Admin::DEBUG && Admin::addDebugMessage('Admin page: from event'); return $page; } } // Look in the pages provided by the Admin plugin itself if (file_exists(__DIR__ . "/pages/admin/{$self->template}.md")) { + Admin::DEBUG && Admin::addDebugMessage("Admin page: {$self->template}"); + $page->init(new \SplFileInfo(__DIR__ . "/pages/admin/{$self->template}.md")); $page->slug(basename($self->template)); @@ -505,6 +565,8 @@ class AdminPlugin extends Plugin $path = $locator->findResource("plugins://{$plugin->name}/admin/pages/{$self->template}.md"); if ($path) { + Admin::DEBUG && Admin::addDebugMessage("Admin page: plugin {$plugin->name}/{$self->template}"); + $page->init(new \SplFileInfo($path)); $page->slug(basename($self->template)); @@ -517,6 +579,7 @@ class AdminPlugin extends Plugin if (empty($this->grav['page'])) { if ($this->grav['user']->authenticated) { + Admin::DEBUG && Admin::addDebugMessage('Admin page: fire onPageNotFound event'); $event = new Event(['page' => null]); $event->page = null; $event = $this->grav->fireEvent('onPageNotFound', $event); @@ -524,6 +587,7 @@ class AdminPlugin extends Plugin $page = $event->page; if (!$page || !$page->routable()) { + Admin::DEBUG && Admin::addDebugMessage('Admin page: 404 Not Found'); $error_file = $this->grav['locator']->findResource('plugins://admin/pages/admin/error.md'); $page = new Page(); $page->init(new \SplFileInfo($error_file)); @@ -534,6 +598,7 @@ class AdminPlugin extends Plugin unset($this->grav['page']); $this->grav['page'] = $page; } else { + Admin::DEBUG && Admin::addDebugMessage('Admin page: login'); // Not Found and not logged in: Display login page. $login_file = $this->grav['locator']->findResource('plugins://admin/pages/admin/login.md'); $page = new Page(); @@ -557,6 +622,14 @@ class AdminPlugin extends Plugin $assets = $this->grav['assets']; $assets->setJsPipeline(false); $assets->setCssPipeline(false); + + // Compile a missing preset.css file + $preset_css = 'asset://admin-preset.css'; + $preset_path = $this->grav['locator']->findResource($preset_css); + if (!$preset_path) { + $this->grav['admin-whitelabel']->compilePresetScss($this->config->get('plugins.admin.whitelabel')); + } + } /** @@ -581,6 +654,7 @@ class AdminPlugin extends Plugin $page = $this->grav['page']; $twig->twig_vars['location'] = $this->template; + $twig->twig_vars['nav_route'] = trim($this->template . '/' . $this->route, '/') . '/'; $twig->twig_vars['base_url_relative_frontend'] = $twig->twig_vars['base_url_relative'] ?: '/'; $twig->twig_vars['admin_route'] = trim($this->admin_route, '/'); $twig->twig_vars['template_route'] = $this->template; @@ -590,14 +664,45 @@ class AdminPlugin extends Plugin $theme_url = '/' . ltrim($this->grav['locator']->findResource('plugin://admin/themes/' . $this->theme, false), '/'); $twig->twig_vars['theme_url'] = $theme_url; - $twig->twig_vars['preset_url'] = $twig->twig_vars['preset_url'] ?? $theme_url; $twig->twig_vars['base_url'] = $twig->twig_vars['base_url_relative']; $twig->twig_vars['base_path'] = GRAV_ROOT; $twig->twig_vars['admin'] = $this->admin; + $twig->twig_vars['user'] = $this->admin->user; $twig->twig_vars['admin_version'] = $this->version; $twig->twig_vars['logviewer'] = new LogViewer(); $twig->twig_vars['form_max_filesize'] = Utils::getUploadLimit() / 1024 / 1024; + // Start white label functionality + $twig->twig_vars['whitelabel_presets'] = $this->getPresets(); + + $custom_logo = $this->config->get('plugins.admin.whitelabel.logo_custom', false); + $custom_login_logo = $this->config->get('plugins.admin.whitelabel.logo_login', false); + $custom_footer = $this->config->get('plugins.admin.whitelabel.custom_footer', false); + + if ($custom_logo && is_array($custom_logo)) { + $custom_logo = array_keys($custom_logo); + $path = array_shift($custom_logo); + $twig->twig_vars['custom_admin_logo'] = $path; + } + + if ($custom_login_logo && is_array($custom_login_logo)) { + $custom_login_logo = array_keys($custom_login_logo); + $path = array_shift($custom_login_logo); + $twig->twig_vars['custom_login_logo'] = $path; + } + + if ($custom_footer) { + $footer = Utils::processMarkdown($custom_footer); + $twig->twig_vars['custom_admin_footer'] = $footer; + } + + $custom_css = $this->config->get('plugins.admin.whitelabel.custom_css', false); + + if ($custom_css) { + $this->grav['assets']->addInlineCss($custom_css); + } + // End white label functionality + $fa_icons_file = CompiledYamlFile::instance($this->grav['locator']->findResource('plugin://admin/themes/grav/templates/forms/fields/iconpicker/icons' . YAML_EXT)); $fa_icons = $fa_icons_file->content(); $fa_icons = array_map(function ($icon) { @@ -625,16 +730,22 @@ class AdminPlugin extends Plugin } } - // Gather Plugin-hooked nav items + // Gather all nav items + $this->grav['twig']->plugins_hooked_nav = []; $this->grav->fireEvent('onAdminMenu'); + uasort($this->grav['twig']->plugins_hooked_nav, function ($a, $b) { + $ac = $a['priority'] ?? 0; + $bc = $b['priority'] ?? 0; + + return $bc <=> $ac; + }); + + // Gather Plugin-hooked dashboard items + $this->grav->fireEvent('onAdminDashboard'); switch ($this->template) { case 'dashboard': $twig->twig_vars['popularity'] = $this->popularity; - - // Gather Plugin-hooked dashboard items - $this->grav->fireEvent('onAdminDashboard'); - break; } @@ -659,8 +770,6 @@ class AdminPlugin extends Plugin */ public function onTwigExtensions() { - require_once __DIR__ . '/classes/Twig/AdminTwigExtension.php'; - $this->grav['twig']->twig->addExtension(new AdminTwigExtension); } @@ -688,10 +797,13 @@ class AdminPlugin extends Plugin { $type = $e['type'] ?? null; switch ($type) { + case 'config': + $e['type'] = $this->admin->authorize(['admin.configuration.system', 'admin.super']) ? 'config/system' : 'config/site'; + break; case 'tools/scheduler': $e['type'] = 'config/scheduler'; break; - case 'tools': + case 'tools': case 'tools/backups': $e['type'] = 'config/backups'; break; @@ -719,30 +831,74 @@ class AdminPlugin extends Plugin /** * Initial stab at registering permissions (WIP) * - * @param Event $e + * @param PermissionsRegisterEvent $event */ - public function onAdminRegisterPermissions(Event $e) + public function onRegisterPermissions(PermissionsRegisterEvent $event): void { - $admin = $e['admin']; - $permissions = [ - 'admin.super' => 'boolean', - 'admin.login' => 'boolean', - 'admin.cache' => 'boolean', - 'admin.configuration' => 'boolean', - 'admin.configuration_system' => 'boolean', - 'admin.configuration_site' => 'boolean', - 'admin.configuration_media' => 'boolean', - 'admin.configuration_info' => 'boolean', - 'admin.settings' => 'boolean', - 'admin.pages' => 'boolean', - 'admin.maintenance' => 'boolean', - 'admin.statistics' => 'boolean', - 'admin.plugins' => 'boolean', - 'admin.themes' => 'boolean', - 'admin.tools' => 'boolean', - 'admin.users' => 'boolean', + $actions = PermissionsReader::fromYaml("plugin://{$this->name}/permissions.yaml"); + + $permissions = $event->permissions; + $permissions->addActions($actions); + } + + public function onAdminMenu() + { + // Dashboard + $this->grav['twig']->plugins_hooked_nav['PLUGIN_ADMIN.DASHBOARD'] = [ + 'route' => 'dashboard', + 'icon' => 'fa-th', + 'authorize' => ['admin.login', 'admin.super'], + 'priority' => 10 + ]; + + // Configuration + $this->grav['twig']->plugins_hooked_nav['PLUGIN_ADMIN.CONFIGURATION'] = [ + 'route' => 'config', + 'icon' => 'fa-wrench', + 'authorize' => [ + 'admin.configuration.system', + 'admin.configuration.site', + 'admin.super'], + 'priority' => 9 + ]; + + // Pages + $count = new Container(['count' => function () { return $this->admin->pagesCount(); }]); + $this->grav['twig']->plugins_hooked_nav['PLUGIN_ADMIN.PAGES'] = [ + 'route' => 'pages', + 'icon' => 'fa-file-text-o', + 'authorize' => ['admin.pages', 'admin.super'], + 'badge' => $count, + 'priority' => 5 + ]; + + // Plugins + $count = new Container(['updates' => 0, 'count' => function () { return count($this->admin->plugins()); }]); + $this->grav['twig']->plugins_hooked_nav['PLUGIN_ADMIN.PLUGINS'] = [ + 'route' => 'plugins', + 'icon' => 'fa-plug', + 'authorize' => ['admin.plugins', 'admin.super'], + 'badge' => $count, + 'priority' => -8 + ]; + + // Themes + $count = new Container(['updates' => 0, 'count' => function () { return count($this->admin->themes()); }]); + $this->grav['twig']->plugins_hooked_nav['PLUGIN_ADMIN.THEMES'] = [ + 'route' => 'themes', + 'icon' => 'fa-tint', + 'authorize' => ['admin.themes', 'admin.super'], + 'badge' => $count, + 'priority' => -9 + ]; + + // Tools + $this->grav['twig']->plugins_hooked_nav['PLUGIN_ADMIN.TOOLS'] = [ + 'route' => 'tools', + 'icon' => 'fa-briefcase', + 'authorize' => $this->admin::toolsPermissions(), + 'priority' => -10 ]; - $admin->addPermissions($permissions); } /** @@ -758,53 +914,71 @@ class AdminPlugin extends Plugin } /** - * Helper function to replace Pages::Types() - * and to provide an event to manipulate the data + * Helper function to replace Pages::Types() and to provide an event to manipulate the data * - * Dispatches 'onAdminPageTypes' event - * with 'types' data member which is a - * reference to the data + * Dispatches 'onAdminPageTypes' event with 'types' data member which is a reference to the data + * + * @param bool $keysOnly + * @return array */ - public static function pagesTypes() + public static function pagesTypes(bool $keysOnly = false) { $types = Pages::types(); // First filter by configuration $hideTypes = Grav::instance()['config']->get('plugins.admin.hide_page_types', []); - foreach ((array) $hideTypes as $type) { - unset($types[$type]); + foreach ((array) $hideTypes as $hide) { + if (isset($types[$hide])) { + unset($types[$hide]); + } else { + foreach ($types as $key => $type) { + $match = preg_match('#' . $hide . '#i', $key); + if ($match) { + unset($types[$key]); + } + } + } } // Allow manipulating of the data by event $e = new Event(['types' => &$types]); Grav::instance()->fireEvent('onAdminPageTypes', $e); - return $types; + return $keysOnly ? array_keys($types) : $types; } /** - * Helper function to replace Pages::modularTypes() - * and to provide an event to manipulate the data + * Helper function to replace Pages::modularTypes() and to provide an event to manipulate the data * - * Dispatches 'onAdminModularPageTypes' event - * with 'types' data member which is a - * reference to the data + * Dispatches 'onAdminModularPageTypes' event with 'types' data member which is a reference to the data + * + * @param bool $keysOnly + * @return array */ - public static function pagesModularTypes() + public static function pagesModularTypes(bool $keysOnly = false) { $types = Pages::modularTypes(); // First filter by configuration $hideTypes = (array) Grav::instance()['config']->get('plugins.admin.hide_modular_page_types', []); - foreach ($hideTypes as $type) { - unset($types[$type]); + foreach ((array) $hideTypes as $hide) { + if (isset($types[$hide])) { + unset($types[$hide]); + } else { + foreach ($types as $key => $type) { + $match = preg_match('#' . $hide . '#i', $key); + if ($match) { + unset($types[$key]); + } + } + } } // Allow manipulating of the data by event $e = new Event(['types' => &$types]); Grav::instance()->fireEvent('onAdminModularPageTypes', $e); - return $types; + return $keysOnly ? array_keys($types) : $types; } /** @@ -830,6 +1004,8 @@ class AdminPlugin extends Plugin protected function initializeController($task, $post) { + Admin::DEBUG && Admin::addDebugMessage('Admin controller: execute'); + $controller = new AdminController(); $controller->initialize($this->grav, $this->template, $task, $this->route, $post); $controller->execute(); @@ -850,16 +1026,12 @@ class AdminPlugin extends Plugin 'onTwigTemplatePaths' => ['onTwigTemplatePaths', 1000], 'onTwigSiteVariables' => ['onTwigSiteVariables', 1000], 'onAssetsInitialized' => ['onAssetsInitialized', 1000], - 'onAdminRegisterPermissions' => ['onAdminRegisterPermissions', 0], 'onOutputGenerated' => ['onOutputGenerated', 0], 'onAdminAfterSave' => ['onAdminAfterSave', 0], 'onAdminData' => ['onAdminData', 0], + 'onAdminMenu' => ['onAdminMenu', 1000], ]); - // Autoload classes - require_once __DIR__ . '/vendor/autoload.php'; - - // Check for required plugins if (!$this->grav['config']->get('plugins.login.enabled') || !$this->grav['config']->get('plugins.form.enabled') || !$this->grav['config']->get('plugins.email.enabled')) { throw new \RuntimeException('One of the required plugins is missing or not enabled'); @@ -955,8 +1127,8 @@ class AdminPlugin extends Plugin 'EDITOR', 'PREVIEW', 'FULLSCREEN', - 'MODULAR', - 'NON_MODULAR', + 'MODULE', + 'NON_MODULE', 'VISIBLE', 'NON_VISIBLE', 'ROUTABLE', @@ -1034,4 +1206,49 @@ class AdminPlugin extends Plugin $assets->addInlineJs($translations); } + + public static function themeOptions() + { + static $options = []; + + if (empty($options)) { + $theme_files = glob(__dir__ . '/themes/grav/css/codemirror/themes/*.css'); + foreach ($theme_files as $theme_file) { + $theme = basename(basename($theme_file, '.css')); + $options[$theme] = Inflector::titleize($theme); + } + } + + return $options; + } + + public function getPresets() + { + $filename = $this->grav['locator']->findResource('plugin://admin/presets.yaml', false); + + $file = CompiledYamlFile::instance($filename); + $presets = (array)$file->content(); + + $custom_presets = $this->config->get('plugins.admin.whitelabel.custom_presets'); + + if (isset($custom_presets)) { + $custom_presets = Yaml::parse($custom_presets); + + if (is_array($custom_presets)) { + if (isset($custom_presets['name']) && isset($custom_presets['colors']) && isset($custom_presets['accents'])) { + $preset = [Inflector::hyphenize($custom_presets['name']) => $custom_presets]; + $presets = $preset + $presets; + } else { + foreach ($custom_presets as $value) { + if (isset($value['name']) && isset($value['colors']) && isset($value['accents'])) { + $preset = [Inflector::hyphenize($value['name']) => $value]; + $presets = $preset + $presets; + } + } + } + } + } + + return $presets; + } } diff --git a/admin.yaml b/admin.yaml index 56b39778..e785124d 100644 --- a/admin.yaml +++ b/admin.yaml @@ -1,19 +1,18 @@ enabled: true route: '/admin' -cache_enabled: false +cache_enabled: true theme: grav logo_text: '' body_classes: '' content_padding: true twofa_enabled: true -log_viewer_files: ['grav', 'email'] sidebar: activate: tab hover_delay: 100 size: auto dashboard: days_of_stats: 7 -widgets: +widgets_display: dashboard-maintenance: true dashboard-statistics: true dashboard-notifications: true @@ -24,14 +23,10 @@ pages: show_modular: true session: timeout: 1800 -warnings: - delete_page: true - secure_delete: false edit_mode: normal frontend_preview_target: inline show_github_msg: true pages_list_display_field: title -google_fonts: false admin_icons: line-awesome enable_auto_updates_check: true notifications: @@ -46,3 +41,45 @@ popularity: daily: 30 monthly: 12 visitors: 20 +whitelabel: + quicktray_recompile: false + codemirror_theme: paper + codemirror_fontsize: md + codemirror_md_font: sans + logo_custom: + logo_login: + color_scheme: + accents: + primary-accent: button + secondary-accent: notice + tertiary-accent: critical + colors: + logo-bg: '#323640' + logo-link: '#FFFFFF' + nav-bg: '#3D424E' + nav-text: '#B7B9BD' + nav-link: '#ffffff' + nav-selected-bg: '#323640' + nav-selected-link: '#ffffff' + nav-hover-bg: '#434753' + nav-hover-link: '#ffffff' + toolbar-bg: '#ffffff' + toolbar-text: '#3D424E' + page-bg: '#F6F6F6' + page-text: '#6f7b8a' + page-link: '#0090D9' + content-bg: '#ffffff' + content-text: '#6f7b8a' + content-link: '#0090D9' + content-link2: '#da4b46' + content-header: '#414147' + content-tabs-bg: '#e6e6e6' + content-tabs-text: '#808080' + button-bg: '#0090D9' + button-text: '#ffffff' + notice-bg: '#06A599' + notice-text: '#ffffff' + update-bg: '#77559D' + update-text: '#ffffff' + critical-bg: '#F45857' + critical-text: '#ffffff' diff --git a/blueprints.yaml b/blueprints.yaml index 3565971c..f70cd80f 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,8 +1,7 @@ name: Admin Panel slug: admin type: plugin -version: 1.9.19 -testing: false +version: 1.10.0 description: Adds an advanced administration panel to manage your site icon: empire author: @@ -16,513 +15,768 @@ docs: https://github.com/getgrav/grav-plugin-admin/blob/develop/README.md license: MIT dependencies: - - { name: grav, version: '>=1.6.31' } - - { name: form, version: '>=3.0.0' } - - { name: login, version: '>=3.0.0' } - - { name: email, version: '>=3.0.0' } + - { name: grav, version: '>=1.7.0' } + - { name: form, version: '>=4.1.0' } + - { name: login, version: '>=3.3.5' } + - { name: email, version: '>=3.0.9' } + - { name: flex-objects, version: '>=1.0.0' } form: validation: loose fields: - Basics: - type: section - title: Basics - underline: false + admin_tabs: + type: tabs + fields: + config_tab: + type: tab + title: Configuration - enabled: - type: hidden - label: PLUGIN_ADMIN.PLUGIN_STATUS - highlight: 1 - default: 0 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool + fields: - cache_enabled: - type: toggle - label: PLUGIN_ADMIN.ADMIN_CACHING - help: PLUGIN_ADMIN.ADMIN_CACHING_HELP - highlight: 0 - options: - 1: PLUGIN_ADMIN.YES - 0: PLUGIN_ADMIN.NO - validate: - type: bool + Basics: + type: section + title: Basics + underline: false - twofa_enabled: - type: toggle - label: PLUGIN_LOGIN.2FA_TITLE - help: PLUGIN_LOGIN.2FA_ENABLED_HELP - default: 1 - highlight: 1 - options: - 1: PLUGIN_ADMIN.YES - 0: PLUGIN_ADMIN.NO - validate: - type: bool + enabled: + type: hidden + label: PLUGIN_ADMIN.PLUGIN_STATUS + highlight: 1 + default: 0 + options: + 1: PLUGIN_ADMIN.ENABLED + 0: PLUGIN_ADMIN.DISABLED + validate: + type: bool - route: - type: text - label: Administrator path - size: medium - placeholder: "Default route for administrator (relative to base)" - help: If you want to change the URL for the administrator, you can provide a path here + cache_enabled: + type: toggle + label: PLUGIN_ADMIN.ADMIN_CACHING + help: PLUGIN_ADMIN.ADMIN_CACHING_HELP + highlight: 1 + options: + 1: PLUGIN_ADMIN.YES + 0: PLUGIN_ADMIN.NO + validate: + type: bool - logo_text: - type: text - label: Logo text - size: medium - placeholder: "Grav" - help: Text to display in place of the default Grav logo + twofa_enabled: + type: toggle + label: PLUGIN_LOGIN.2FA_TITLE + help: PLUGIN_LOGIN.2FA_ENABLED_HELP + default: 1 + highlight: 1 + options: + 1: PLUGIN_ADMIN.YES + 0: PLUGIN_ADMIN.NO + validate: + type: bool - content_padding: - type: toggle - label: PLUGIN_ADMIN.CONTENT_PADDING - help: PLUGIN_ADMIN.CONTENT_PADDING_HELP - highlight: 1 - options: - 1: PLUGIN_ADMIN.YES - 0: PLUGIN_ADMIN.NO - validate: - type: bool + route: + type: text + label: Administrator path + size: medium + placeholder: "Default route for administrator (relative to base)" + help: If you want to change the URL for the administrator, you can provide a path here - body_classes: - type: text - label: Body classes - size: medium - help: Add a space separated name of custom body classes + logo_text: + type: text + label: Logo text + size: medium + placeholder: "Grav" + help: Text to display in place of the default Grav logo - sidebar.activate: - type: select - label: Sidebar Activation - help: Control how the sidebar is activated - size: small - default: tab - options: - tab: Tab - hover: Hover + content_padding: + type: toggle + label: PLUGIN_ADMIN.CONTENT_PADDING + help: PLUGIN_ADMIN.CONTENT_PADDING_HELP + highlight: 1 + options: + 1: PLUGIN_ADMIN.YES + 0: PLUGIN_ADMIN.NO + validate: + type: bool - sidebar.hover_delay: - type: text - size: x-small - append: millseconds - label: Hover delay - default: 500 - validate: - type: number - min: 1 + body_classes: + type: text + label: Body classes + size: medium + help: Add a space separated name of custom body classes + + sidebar.activate: + type: select + label: Sidebar Activation + help: Control how the sidebar is activated + size: small + default: tab + options: + tab: Tab + hover: Hover + + sidebar.hover_delay: + type: text + size: x-small + append: millseconds + label: Hover delay + default: 500 + validate: + type: number + min: 1 - sidebar.size: - type: select - label: Sidebar Size - help: Control the width of the sidebar - size: medium - default: auto - options: - auto: Automatic width - small: Small width + sidebar.size: + type: select + label: Sidebar Size + help: Control the width of the sidebar + size: medium + default: auto + options: + auto: Automatic width + small: Small width - theme: - type: hidden - label: Theme - default: grav + theme: + type: hidden + label: Theme + default: grav - edit_mode: - type: select - label: Edit mode - size: small - default: normal - options: - normal: Normal - expert: Expert - help: Auto will use blueprint if available, if none found, it will use "Expert" mode. + edit_mode: + type: select + label: Edit mode + size: small + default: normal + options: + normal: Normal + expert: Expert + help: Auto will use blueprint if available, if none found, it will use "Expert" mode. - frontend_preview_target: - type: select - label: Preview pages target - size: medium - default: inline - options: - inline: Inline in Admin - _blank: New tab - _self: Current tab + frontend_preview_target: + type: select + label: Preview pages target + size: medium + default: inline + options: + inline: Inline in Admin + _blank: New tab + _self: Current tab - pages.show_parents: - type: select - size: medium - label: Parent dropdown - highlight: 1 - options: - both: Show slug and folder - folder: Show folder - fullpath: Show fullpath + pages.show_parents: + type: select + size: medium + label: Parent dropdown + highlight: 1 + options: + both: Show slug and folder + folder: Show folder + fullpath: Show fullpath - pages.parents_levels: - type: text - label: Parents Levels - size: small - help: The number of levels to show in parent select list + pages.parents_levels: + type: text + label: Parents Levels + size: small + help: The number of levels to show in parent select list - pages.show_modular: - type: toggle - label: Modular parents - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Show modular pages in the parent select list + pages.show_modular: + type: toggle + label: Modular parents + highlight: 1 + default: 1 + options: + 1: PLUGIN_ADMIN.ENABLED + 0: PLUGIN_ADMIN.DISABLED + validate: + type: bool + help: Show modular pages in the parent select list - google_fonts: - type: toggle - label: Use Google Fonts - highlight: 0 - default: 0 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Use Google custom fonts. Disable this to use Helvetica. Useful when using Cyrillic and other languages with unsupported characters. + show_beta_msg: + type: hidden - show_beta_msg: - type: hidden + show_github_msg: + type: toggle + label: Show GitHub Link + highlight: 1 + default: 1 + options: + 1: PLUGIN_ADMIN.ENABLED + 0: PLUGIN_ADMIN.DISABLED + validate: + type: bool + help: Show the "Found an issue? Please report it on GitHub." message. - show_github_msg: - type: toggle - label: Show GitHub Link - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Show the "Found an issue? Please report it on GitHub." message. + pages_list_display_field: + type: text + size: small + label: Pages List Display Field + help: "Field of the page to use in the list of pages if present. Defaults/Fallback to title." - pages_list_display_field: - type: text - size: small - label: Pages List Display Field - help: "Field of the page to use in the list of pages if present. Defaults/Fallback to title." + enable_auto_updates_check: + type: toggle + label: Automatically check for updates + highlight: 1 + default: 1 + options: + 1: PLUGIN_ADMIN.ENABLED + 0: PLUGIN_ADMIN.DISABLED + validate: + type: bool + help: Shows an informative message, in the admin panel, when an update is available. - enable_auto_updates_check: - type: toggle - label: Automatically check for updates - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Shows an informative message, in the admin panel, when an update is available. + session.timeout: + type: text + size: small + label: Session Timeout + append: secs + help: "Sets the session timeout in seconds" + validate: + type: number + min: 1 - session.timeout: - type: text - size: small - label: Session Timeout - append: secs - help: "Sets the session timeout in seconds" - validate: - type: number - min: 1 + hide_page_types: + type: select + size: large + label: Hide page types in Admin + classes: fancy + multiple: true + array: true + selectize: + create: true + data-options@: ['\Grav\Plugin\AdminPlugin::pagesTypes', true] - warnings.delete_page: - type: toggle - label: Warn on page delete - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Ask the user confirmation when deleting a page + hide_modular_page_types: + type: select + size: large + label: Hide modular page types in Admin + classes: fancy + multiple: true + array: true + selectize: + create: true + data-options@: ['\Grav\Plugin\AdminPlugin::pagesModularTypes', true] - warnings.secure_delete: - type: toggle - label: Secure Delete - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Shows the user a field to enter the word DELETE and enable the confirm delete button. + Dashboard: + type: section + title: Dashboard + underline: true - hide_page_types: - type: array - label: Hide page types in Admin - value_only: true + widgets_display: + type: widgets + label: Widget Display Status + validate: + type: array - hide_modular_page_types: - type: array - label: Hide modular page types in Admin - value_only: true + Notifications: + type: section + title: Notifications + underline: true - log_viewer_files: - type: selectize - size: medium - label: PLUGIN_ADMIN.LOG_VIEWER_FILES - help: PLUGIN_ADMIN.LOG_VIEWER_FILES_HELP - classes: fancy - validate: - type: commalist + notifications.feed: + type: toggle + label: Feed Notifications + highlight: 1 + default: 1 + options: + 1: PLUGIN_ADMIN.ENABLED + 0: PLUGIN_ADMIN.DISABLED + validate: + type: bool + help: Display feed-based notifications - MediaResize: - type: section - title: Page Media Image Resizer - underline: true + notifications.dashboard: + type: toggle + label: Dashboard Notifications + highlight: 1 + default: 1 + options: + 1: PLUGIN_ADMIN.ENABLED + 0: PLUGIN_ADMIN.DISABLED + validate: + type: bool + help: Display dashboard-based notifications - MediaResizeNote: - type: spacer - text: PLUGIN_ADMIN.PAGEMEDIA_RESIZER - markdown: true + notifications.plugins: + type: toggle + label: Plugins Notifications + highlight: 1 + default: 1 + options: + 1: PLUGIN_ADMIN.ENABLED + 0: PLUGIN_ADMIN.DISABLED + validate: + type: bool + help: Display plugins-targeted notifications - pagemedia.resize_width: - type: number - size: x-small - append: pixels - label: Resize Width - default: 0 - validate: - type: number - help: Resize wide images down to the set value + notifications.themes: + type: toggle + label: Themes Notifications + highlight: 1 + default: 1 + options: + 1: PLUGIN_ADMIN.ENABLED + 0: PLUGIN_ADMIN.DISABLED + validate: + type: bool + help: Display themes-targeted notifications - pagemedia.resize_height: - type: number - size: x-small - append: pixels - label: Resize Height - default: 0 - validate: - type: number - help: Resize tall images down to the set value + customization_tab: + type: tab + title: Customization - pagemedia.res_min_width: - type: number - size: x-small - append: pixels - label: Resolution Min Width - default: 0 - validate: - type: number - help: The minimum width allowed for an image to be added + fields: + whitelabel.logos: + type: section + underline: true + title: PLUGIN_ADMIN.LOGOS - pagemedia.res_min_height: - type: number - size: x-small - append: pixels - label: Resolution Min Height - default: 0 - validate: - type: number - help: The minimum height allowed for an image to be added + whitelabel.logo_login: + type: file + label: PLUGIN_ADMIN.LOGIN_SCREEN_CUSTOM_LOGO_LABEL + destination: 'user://assets' + accept: + - image/* - pagemedia.res_max_width: - type: number - size: x-small - append: pixels - label: Resolution Max Width - default: 0 - validate: - type: number - help: The maximum width allowed for an image to be added + whitelabel.logo_custom: + type: file + label: PLUGIN_ADMIN.TOP_LEFT_CUSTOM_LOGO_LABEL + destination: 'user://assets' + accept: + - image/* - pagemedia.res_max_height: - type: number - size: x-small - append: pixels - label: Resolution Max Height - default: 0 - validate: - type: number - help: The maximum height allowed for an image to be added + codemirror_section: + type: section + underline: true + title: PLUGIN_ADMIN.CODEMIRROR + + whitelabel.codemirror_theme: + type: select + label: PLUGIN_ADMIN.CODEMIRROR_THEME + default: paper + markdown: true + data-options@: '\Grav\Plugin\AdminPlugin::themeOptions' + description: PLUGIN_ADMIN.CODEMIRROR_THEME_DESC + + whitelabel.codemirror_fontsize: + type: select + label: PLUGIN_ADMIN.CODEMIRROR_FONTSIZE + default: md + options: + sm: Small Font + md: Medium Font + lg: Large Font + + whitelabel.codemirror_md_font: + type: select + label: PLUGIN_ADMIN.CODEMIRROR_MD_FONT + default: sans + options: + sans: Sans Font + mono: Mono/Fixed Width Font + + customization_section: + type: section + underline: true + title: PLUGIN_ADMIN.CUSTOMIZATION + + whitelabel.quicktray_recompile: + type: toggle + label: PLUGIN_ADMIN.QUICKTRAY_RECOMPILE + help: PLUGIN_ADMIN.QUICKTRAY_RECOMPILE_HELP + highlight: 0 + default: 0 + options: + 1: PLUGIN_ADMIN.ENABLED + 0: PLUGIN_ADMIN.DISABLED + validate: + type: bool - pagemedia.resize_quality: - type: number - size: x-small - append: 0...1 - label: Resize Quality - default: 0.8 - validate: - type: number - step: 0.01 - help: The quality to use when resizing an image. Between 0 and 1 value. - Dashboard: - type: section - title: Dashboard - underline: true + whitelabel.color_scheme.name: + type: text + label: PLUGIN_ADMIN.COLOR_SCHEME_NAME + help: PLUGIN_ADMIN.COLOR_SCHEME_NAME_HELP + placeholder: PLUGIN_ADMIN.COLOR_SCHEME_NAME_PLACEHOLDER - widgets.dashboard-maintenance: - type: toggle - label: Maintenance Widget - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Display dashboard maintenance widget + themes-preview: + type: themepreview + ignore: true; + label: PLUGIN_ADMIN.PRESETS + style: vertical - widgets.dashboard-statistics: - type: toggle - label: Statistics Widget - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Display dashboard statistics widget + colorschemes: + type: colorscheme + label: PLUGIN_ADMIN.COLOR_SCHEME_LABEL + style: vertical + help: PLUGIN_ADMIN.COLOR_SCHEME_HELP - widgets.dashboard-notifications: - type: toggle - label: Notifications Feed Widget - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Display dashboard notifications feed widget + fields: + whitelabel.color_scheme.colors.logo-bg: + type: colorscheme.color + default: '#1e333e' + help: "Logo bg" - widgets.dashboard-feed: - type: toggle - label: News Feed Widget - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Display dashboard news feed widget + whitelabel.color_scheme.colors.logo-link: + type: colorscheme.color + default: '#ffffff' + help: "Logo link" - widgets.dashboard-pages: - type: toggle - label: Latest Pages Widget - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Display dashboard latest pages widget + whitelabel.color_scheme.colors.nav-bg: + type: colorscheme.color + default: '#253a47' + help: "Nav bg" - Notifications: - type: section - title: Notifications - underline: true + whitelabel.color_scheme.colors.nav-text: + type: colorscheme.color + default: '#afc7d5' + help: "Nav text" - notifications.feed: - type: toggle - label: Feed Notifications - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Display feed-based notifications + whitelabel.color_scheme.colors.nav-link: + type: colorscheme.color + default: '#d1dee7' + help: "Nav link" - notifications.dashboard: - type: toggle - label: Dashboard Notifications - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Display dashboard-based notifications + whitelabel.color_scheme.colors.nav-selected-bg: + type: colorscheme.color + default: '#2d4d5b' + help: "Nav selected bg" - notifications.plugins: - type: toggle - label: Plugins Notifications - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Display plugins-targeted notifications + whitelabel.color_scheme.colors.nav-selected-link: + type: colorscheme.color + default: '#ffffff' + help: "Nav selected link" - notifications.themes: - type: toggle - label: Themes Notifications - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Display themes-targeted notifications + whitelabel.color_scheme.colors.nav-hover-bg: + type: colorscheme.color + default: '#1e333e' + help: "Nav hover bg" - Popularity: - type: section - title: Popularity - underline: true + whitelabel.color_scheme.colors.nav-hover-link: + type: colorscheme.color + default: '#ffffff' + help: "Nav hover link" - popularity.enabled: - type: toggle - label: Visitor tracking - highlight: 1 - default: 1 - options: - 1: PLUGIN_ADMIN.ENABLED - 0: PLUGIN_ADMIN.DISABLED - validate: - type: bool - help: Enable the visitors stats collecting feature + whitelabel.color_scheme.colors.toolbar-bg: + type: colorscheme.color + default: '#349886' + help: "Toolbar bg" - dashboard.days_of_stats: - type: text - label: Days of stats - append: days - size: x-small - default: 7 - help: Keep stats for the specified number of days, then drop them - validate: - type: int + whitelabel.color_scheme.colors.toolbar-text: + type: colorscheme.color + default: '#ffffff' + help: "Toolbar text" - popularity.ignore: - type: array - label: Ignore - size: large - help: "URLs to ignore" - default: ['/test*','/modular'] - value_only: true - placeholder_value: /ignore-this-route + whitelabel.color_scheme.colors.page-bg: + type: colorscheme.color + default: '#314d5b' + help: "Page bg" - popularity.history.daily: - type: hidden - label: Daily history - default: 30 + whitelabel.color_scheme.colors.page-text: + type: colorscheme.color + default: '#81a5b5' + help: "Page text" - popularity.history.monthly: - type: hidden - label: Monthly history - default: 12 + whitelabel.color_scheme.colors.page-link: + type: colorscheme.color + default: '#aad9ed' + help: "Page link" - popularity.history.visitors: - type: hidden - label: Visitors history - default: 20 + whitelabel.color_scheme.colors.content-bg: + type: colorscheme.color + default: '#eeeeee' + help: "Content bg" + + whitelabel.color_scheme.colors.content-text: + type: colorscheme.color + default: '#737c81' + help: "Content text" + + whitelabel.color_scheme.colors.content-link: + type: colorscheme.color + default: '#0082ba' + help: "Content link" + + whitelabel.color_scheme.colors.content-link2: + type: colorscheme.color + default: '#da4b46' + help: "Content link 2" + + whitelabel.color_scheme.colors.content-header: + type: colorscheme.color + default: '#314d5b' + help: "Content header" + + whitelabel.color_scheme.colors.content-tabs-bg: + type: colorscheme.color + default: '#223a47' + help: "Content tabs bg" + + whitelabel.color_scheme.colors.content-tabs-text: + type: colorscheme.color + default: '#d1dee7' + help: "Content tabs text" + + whitelabel.color_scheme.colors.button-bg: + type: colorscheme.color + default: '#41bea8' + help: "Button bg" + + whitelabel.color_scheme.colors.button-text: + type: colorscheme.color + default: '#ffffff' + help: "Button text" + + whitelabel.color_scheme.colors.notice-bg: + type: colorscheme.color + default: '#00a6cf' + help: "Notice bg" + + whitelabel.color_scheme.colors.notice-text: + type: colorscheme.color + default: '#ffffff' + help: "Notice text" + + whitelabel.color_scheme.colors.update-bg: + type: colorscheme.color + default: '#8f5aad' + help: "Updates bg" + + whitelabel.color_scheme.colors.update-text: + type: colorscheme.color + default: '#ffffff' + help: "Updates text" + + whitelabel.color_scheme.colors.critical-bg: + type: colorscheme.color + default: '#da4b46' + help: "Critical bg" + + whitelabel.color_scheme.colors.critical-text: + type: colorscheme.color + default: '#ffffff' + help: "Critical text" + + whitelabel.color_scheme.accents.primary-accent: + type: select + size: meidum + classes: fancy + label: PLUGIN_ADMIN.PRIMARY_ACCENT_LABEL + help: PLUGIN_ADMIN.PRIMARY_ACCENT_HELP + options: + button: 'Button colors' + content: 'Content colors' + tabs: 'Tabs colors' + critical: 'Critical colors' + logo: 'Logo colors' + nav: 'Nav colors' + notice: 'Notice colors' + page: 'Page colors' + toolbar: 'Toolbar colors' + update: 'Update colors' + + whitelabel.color_scheme.accents.secondary-accent: + type: select + size: meidum + classes: fancy + label: PLUGIN_ADMIN.SECONDARY_ACCENT_LABEL + help: PLUGIN_ADMIN.SECONDARY_ACCENT_HELP + options: + button: 'Button colors' + content: 'Content colors' + tabs: 'Tabs colors' + critical: 'Critical colors' + logo: 'Logo colors' + nav: 'Nav colors' + notice: 'Notice colors' + page: 'Page colors' + toolbar: 'Toolbar colors' + update: 'Update colors' + + whitelabel.color_scheme.accents.tertiary-accent: + type: select + size: meidum + classes: fancy + label: PLUGIN_ADMIN.TERTIARY_ACCENT_LABEL + help: PLUGIN_ADMIN.TERTIARY_ACCENT_HELP + options: + button: 'Button colors' + content: 'Content colors' + tabs: 'Tabs colors' + critical: 'Critical colors' + logo: 'Logo colors' + nav: 'Nav colors' + notice: 'Notice colors' + page: 'Page colors' + toolbar: 'Toolbar colors' + update: 'Update colors' + + whitelabel.custom_footer: + type: textarea + rows: 2 + label: PLUGIN_ADMIN.CUSTOM_FOOTER + help: PLUGIN_ADMIN.CUSTOM_FOOTER_HELP + placeholder: Enter HTML/Markdown to override default footer + + + whitelabel.custom_css: + label: PLUGIN_ADMIN.CUSTOM_CSS_LABEL + placeholder: "Put your custom CSS in here..." + help: PLUGIN_ADMIN.CUSTOM_CSS_HELP + type: editor + codemirror: + mode: 'css' + indentUnit: 2 + autofocus: true + indentWithTabs: true + lineNumbers: true + styleActiveLine: true + + whitelabel.custom_presets: + label: PLUGIN_ADMIN.CUSTOM_PRESETS + help: PLUGIN_ADMIN.CUSTOM_PRESETS_HELP + placeholder: "Put your presets here" + type: editor + codemirror: + mode: 'yaml' + indentUnit: 2 + autofocus: true + indentWithTabs: false + lineNumbers: true + styleActiveLine: true + gutters: ['CodeMirror-lint-markers'] + lint: true + + extras_tab: + type: tab + title: Extras + + fields: + + Popularity: + type: section + title: Popularity + underline: true + + popularity.enabled: + type: toggle + label: Visitor tracking + highlight: 1 + default: 1 + options: + 1: PLUGIN_ADMIN.ENABLED + 0: PLUGIN_ADMIN.DISABLED + validate: + type: bool + help: Enable the visitors stats collecting feature + + dashboard.days_of_stats: + type: text + label: Days of stats + append: days + size: x-small + default: 7 + help: Keep stats for the specified number of days, then drop them + validate: + type: int + + popularity.ignore: + type: array + label: Ignore + size: large + help: "URLs to ignore" + default: ['/test*','/modular'] + value_only: true + placeholder_value: /ignore-this-route + + popularity.history.daily: + type: hidden + label: Daily history + default: 30 + + popularity.history.monthly: + type: hidden + label: Monthly history + default: 12 + + popularity.history.visitors: + type: hidden + label: Visitors history + default: 20 + + MediaResize: + type: section + title: Page Media Image Resizer + underline: true + + MediaResizeNote: + type: spacer + text: PLUGIN_ADMIN.PAGEMEDIA_RESIZER + markdown: true + + pagemedia.resize_width: + type: number + size: x-small + append: pixels + label: Resize Width + default: 0 + validate: + type: number + help: Resize wide images down to the set value + + pagemedia.resize_height: + type: number + size: x-small + append: pixels + label: Resize Height + default: 0 + validate: + type: number + help: Resize tall images down to the set value + + pagemedia.res_min_width: + type: number + size: x-small + append: pixels + label: Resolution Min Width + default: 0 + validate: + type: number + help: The minimum width allowed for an image to be added + + pagemedia.res_min_height: + type: number + size: x-small + append: pixels + label: Resolution Min Height + default: 0 + validate: + type: number + help: The minimum height allowed for an image to be added + + pagemedia.res_max_width: + type: number + size: x-small + append: pixels + label: Resolution Max Width + default: 0 + validate: + type: number + help: The maximum width allowed for an image to be added + + pagemedia.res_max_height: + type: number + size: x-small + append: pixels + label: Resolution Max Height + default: 0 + validate: + type: number + help: The maximum height allowed for an image to be added + + pagemedia.resize_quality: + type: number + size: x-small + append: 0...1 + label: Resize Quality + default: 0.8 + validate: + type: number + step: 0.01 + help: The quality to use when resizing an image. Between 0 and 1 value. diff --git a/blueprints/admin/pages/modular_new.yaml b/blueprints/admin/pages/modular_new.yaml index 85aa7b08..1bda975e 100644 --- a/blueprints/admin/pages/modular_new.yaml +++ b/blueprints/admin/pages/modular_new.yaml @@ -10,7 +10,7 @@ form: section: type: section - title: PLUGIN_ADMIN.ADD_MODULAR_CONTENT + title: PLUGIN_ADMIN.ADD_MODULE_CONTENT title: type: text @@ -35,7 +35,7 @@ form: name: type: select classes: fancy - label: PLUGIN_ADMIN.MODULAR_TEMPLATE + label: PLUGIN_ADMIN.MODULE_TEMPLATE help: PLUGIN_ADMIN.PAGE_FILE_HELP default: default data-options@: '\Grav\Plugin\AdminPlugin::pagesModularTypes' diff --git a/blueprints/admin/pages/modular_raw.yaml b/blueprints/admin/pages/modular_raw.yaml index abd21930..f5181392 100644 --- a/blueprints/admin/pages/modular_raw.yaml +++ b/blueprints/admin/pages/modular_raw.yaml @@ -18,6 +18,9 @@ form: title: PLUGIN_ADMIN.CONTENT fields: + xss_check: + type: xss + frontmatter: classes: frontmatter type: editor @@ -39,7 +42,7 @@ form: header.media_order: type: pagemedia label: PLUGIN_ADMIN.PAGE_MEDIA - + options: type: tab title: PLUGIN_ADMIN.OPTIONS @@ -83,7 +86,7 @@ form: name: type: select classes: fancy - label: PLUGIN_ADMIN.MODULAR_TEMPLATE + label: PLUGIN_ADMIN.MODULE_TEMPLATE default: default data-options@: '\Grav\Plugin\AdminPlugin::pagesModularTypes' validate: diff --git a/blueprints/admin/pages/move.yaml b/blueprints/admin/pages/move.yaml index 89fa414d..a0af3b6c 100644 --- a/blueprints/admin/pages/move.yaml +++ b/blueprints/admin/pages/move.yaml @@ -2,6 +2,4 @@ form: validation: loose fields: route: - type: parents - label: PLUGIN_ADMIN.PARENT - classes: fancy + type: hidden diff --git a/blueprints/admin/pages/raw.yaml b/blueprints/admin/pages/raw.yaml index 788e9e23..5b222ad1 100644 --- a/blueprints/admin/pages/raw.yaml +++ b/blueprints/admin/pages/raw.yaml @@ -20,7 +20,7 @@ form: fields: xss_check: type: xss - + frontmatter: classes: frontmatter type: editor @@ -37,7 +37,7 @@ form: lint: true content: - type: markdown + type: codemirror header.media_order: type: pagemedia @@ -81,8 +81,6 @@ form: type: parents label: PLUGIN_ADMIN.PARENT classes: fancy - validate: - required: true name: type: select diff --git a/blueprints/admin/pages/root_raw.yaml b/blueprints/admin/pages/root_raw.yaml new file mode 100644 index 00000000..6b44bdad --- /dev/null +++ b/blueprints/admin/pages/root_raw.yaml @@ -0,0 +1,34 @@ +rules: + slug: + pattern: '[a-zA-Zа-яA-Я0-9_\-]+' + min: 1 + max: 200 + +form: + validation: loose + fields: + + tabs: + type: tabs + active: 1 + + fields: + content: + type: tab + title: PLUGIN_ADMIN.CONTENT + + fields: + frontmatter: + classes: frontmatter + type: editor + label: PLUGIN_ADMIN.FRONTMATTER + autofocus: true + codemirror: + mode: 'yaml' + indentUnit: 4 + autofocus: true + indentWithTabs: false + lineNumbers: true + styleActiveLine: true + gutters: ['CodeMirror-lint-markers'] + lint: true diff --git a/classes/Router.php b/classes/Router.php deleted file mode 100644 index 8f483113..00000000 --- a/classes/Router.php +++ /dev/null @@ -1,31 +0,0 @@ -startTimer(); - $response = $handler->handle($request); - $this->stopTimer(); - - // Never allow admin pages to be rendered in ,