From 4ef8f4e1358074dae3b054a8bd71c1362e7e44fd Mon Sep 17 00:00:00 2001 From: LukeWCS Date: Sat, 9 Dec 2023 17:09:34 +0100 Subject: [PATCH] 1.1.0-b1 --- .github/workflows/tests.yml | 4 +- .../adm/style/acp_stats_permissions.css | 32 ------- .../adm/style/acp_stats_permissions.js | 72 -------------- .../style/acp_stats_permissions_settings.css | 93 +++++++++++++++++++ .../style/acp_stats_permissions_settings.html | 93 +++++++++++-------- .../style/acp_stats_permissions_settings.js | 80 ++++++++++++++++ .../statspermissions/adm/style/acp_toggle.css | 48 ---------- lukewcs/statspermissions/composer.json | 60 ++++++------ lukewcs/statspermissions/config/services.yml | 1 - .../acp_stats_permissions_controller.php | 74 +++++++++++---- lukewcs/statspermissions/ext.php | 2 +- .../language/de/acp_stats_permissions.php | 6 -- .../de/acp_stats_permissions_lang_author.php | 47 ++++++++++ .../de/info_acp_stats_permissions.php | 5 +- .../de_x_sie/acp_stats_permissions.php | 6 -- .../acp_stats_permissions_lang_author.php | 47 ++++++++++ .../de_x_sie/info_acp_stats_permissions.php | 5 +- .../language/en/acp_stats_permissions.php | 6 -- .../en/acp_stats_permissions_lang_author.php | 47 ++++++++++ .../en/info_acp_stats_permissions.php | 5 +- stats-permissions_build_changelog.md | 33 ++++++- stats-permissions_changelog_de.md | 15 ++- 22 files changed, 505 insertions(+), 276 deletions(-) delete mode 100644 lukewcs/statspermissions/adm/style/acp_stats_permissions.css delete mode 100644 lukewcs/statspermissions/adm/style/acp_stats_permissions.js create mode 100644 lukewcs/statspermissions/adm/style/acp_stats_permissions_settings.css create mode 100644 lukewcs/statspermissions/adm/style/acp_stats_permissions_settings.js delete mode 100644 lukewcs/statspermissions/adm/style/acp_toggle.css create mode 100644 lukewcs/statspermissions/language/de/acp_stats_permissions_lang_author.php create mode 100644 lukewcs/statspermissions/language/de_x_sie/acp_stats_permissions_lang_author.php create mode 100644 lukewcs/statspermissions/language/en/acp_stats_permissions_lang_author.php diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 61b1246..b04ad2e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,11 +21,11 @@ on: jobs: # START Basic Checks Job (EPV, code sniffer, images check, etc.) basic-checks: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 strategy: matrix: include: - - php: '7.1' + - php: '7.3' db: "none" NOTESTS: 1 diff --git a/lukewcs/statspermissions/adm/style/acp_stats_permissions.css b/lukewcs/statspermissions/adm/style/acp_stats_permissions.css deleted file mode 100644 index f33b8ee..0000000 --- a/lukewcs/statspermissions/adm/style/acp_stats_permissions.css +++ /dev/null @@ -1,32 +0,0 @@ -input[type=button][name*="stats_permissions_"], -.submit-buttons input[type=submit], -.submit-buttons input[type=button] { - padding: 3px 4px; -} - -.stats_permissions_copyright { - margin-top: 1em; - text-align: center; - font-size: .75em; -} - -legend { - top: 0; - margin-left: -11px; - padding: 2px 10px; - border-radius: 5px 5px 0 0; - border-top: inherit; - border-left: inherit; - background-color: inherit; -} - -@media (max-width: 700px) { - legend { - margin-left: -6px; - padding: 2px 5px; - } - - #stats_permissions_form dd { - margin-top: .5em; - } -} diff --git a/lukewcs/statspermissions/adm/style/acp_stats_permissions.js b/lukewcs/statspermissions/adm/style/acp_stats_permissions.js deleted file mode 100644 index 9b34486..0000000 --- a/lukewcs/statspermissions/adm/style/acp_stats_permissions.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* -* Stats Permissions. An extension for the phpBB Forum Software package. -* -* @copyright (c) 2019, LukeWCS, https://www.wcsaga.org/ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ - -statspermACP = {}; - -statspermACP.constants = Object.freeze({ - PermNothing : 0, - PermStats : 1, - PermUsers : 2, - PermStatsUsers : 3, - - OpacityEnabled : '1.0', - OpacityDisabled : '0.35', -}); - -statspermACP.setState = function () { - 'use strict'; - - var c = statspermACP.constants; - - $('#stats_permissions_opt_use_permissions').css('opacity', ( - $('input[name="stats_permissions_admin_mode"]').prop('checked') == false - ) ? c.OpacityEnabled : c.OpacityDisabled - ); - $('#stats_permissions_opt_disp_for_guests').css('opacity', ( - $('input[name="stats_permissions_admin_mode"]').prop('checked') == false - && $('input[name="stats_permissions_use_permissions"]').prop('checked') == false - ) ? c.OpacityEnabled : c.OpacityDisabled - ); - $('#stats_permissions_opt_disp_for_bots').css('opacity', ( - $('input[name="stats_permissions_admin_mode"]').prop('checked') == false - && $('input[name="stats_permissions_use_permissions"]').prop('checked') == false - ) ? c.OpacityEnabled : c.OpacityDisabled - ); -}; - -statspermACP.setDefaults = function () { - 'use strict'; - - var c = statspermACP.constants; - - $('input[name="stats_permissions_admin_mode"]' ).prop('checked' , false); - $('input[name="stats_permissions_use_permissions"]' ).prop('checked' , false); - $('select[name="stats_permissions_disp_for_guests"]' ).prop('value' , c.PermStats); - $('select[name="stats_permissions_disp_for_bots"]' ).prop('value' , c.PermNothing); - - statspermACP.setState(); -}; - -statspermACP.customFormReset = function () { - 'use strict'; - - $('#stats_permissions_form').trigger('reset'); - statspermACP.setState(); -}; - -$(window).ready(function() { - 'use strict'; - - statspermACP.setState(); - - $('input[name="stats_permissions_admin_mode"]' ).on('change' , statspermACP.setState); - $('input[name="stats_permissions_use_permissions"]' ).on('change' , statspermACP.setState); - $('input[name="stats_permissions_defaults"]' ).on('click' , statspermACP.setDefaults); - $('input[name="form_reset"]' ).on('click' , statspermACP.customFormReset); -}); diff --git a/lukewcs/statspermissions/adm/style/acp_stats_permissions_settings.css b/lukewcs/statspermissions/adm/style/acp_stats_permissions_settings.css new file mode 100644 index 0000000..ec5fbb4 --- /dev/null +++ b/lukewcs/statspermissions/adm/style/acp_stats_permissions_settings.css @@ -0,0 +1,93 @@ +/* GENERAL */ + +.stats_permissions_footer { + margin-top: 1em; + text-align: center; + font-size: .75em; +} + +/* SETTINGS */ + +input[type=button][name*="stats_permissions_"], +.submit-buttons input[type=submit], +.submit-buttons input[type=button] { + padding: 3px 4px; +} + +legend { + top: 0; + margin-left: -11px; + padding: 2px 10px; + border-radius: 5px 5px 0 0; + border-top: inherit; + border-left: inherit; + background-color: inherit; +} + +fieldset dt label { + cursor: inherit; +} + +/* +* phpBB ACP Toggles - A CSS class that makes it easy to display checkboxes as toggles. +* Source : https://danklammer.com/articles/simple-css-toggle-switch/ +* Revision by: Kirk (customization and optimization), LukeWCS (optimization) +*/ + +.toggle { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + width: 38px; + height: 17px; + position: relative; + border-radius: 50px; + cursor: pointer; + font-family: FontAwesome; + transition: background-color 0.2s; +} + +.toggle:before { + position: absolute; + width: 14px; + height: 13px; + background-color: #ffffff; + top: 2px; + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; + left: 22px; + content: "\f00d"; + transition: 0.2s; +} + +.toggle, +.toggle:hover, +.toggle:focus { + background-color: #cccccc; + border: none; + color: #000000; +} + +.toggle:checked { + background-color: #3b87ab; +} + +.toggle:checked:before { + left: 2px; + content: "\f00c"; +} + +/* RESPONSIVE */ + +@media (max-width: 700px) { + legend { + margin-left: -6px; + padding: 2px 5px; + } + + #stats_permissions_form dd { + margin-top: .5em; + } +} diff --git a/lukewcs/statspermissions/adm/style/acp_stats_permissions_settings.html b/lukewcs/statspermissions/adm/style/acp_stats_permissions_settings.html index 99c8cdb..10c3ee5 100644 --- a/lukewcs/statspermissions/adm/style/acp_stats_permissions_settings.html +++ b/lukewcs/statspermissions/adm/style/acp_stats_permissions_settings.html @@ -8,58 +8,45 @@ #} {% INCLUDE 'overall_header.html' %} + +{% set switch_type = TOGGLECTRL_TYPE ?? 'toggle' %} +

{{ lang('STATS_PERMISSIONS_CONFIG_TITLE') }}

-

{{ lang('STATS_PERMISSIONS_CONFIG_DESC', STATS_PERMISSIONS_EXT_NAME) }}

+

{{ lang('STATS_PERMISSIONS_CONFIG_DESC', STATS_PERMISSIONS_METADATA.EXT_NAME) }}

-{% if STATS_PERMISSIONS_NOTES|length %} -
- {% for note in STATS_PERMISSIONS_NOTES %} -

{{ note }}

- {% endfor %} -
-{% endif %} +{{ _self.notes(STATS_PERMISSIONS_NOTES) }}
{{ lang('STATS_PERMISSIONS_SECTION_PERMISSIONS') }} -
+

{{ lang('STATS_PERMISSIONS_ADMIN_MODE_EXP') }}
- {{ _self.switch('stats_permissions_admin_mode', STATS_PERMISSIONS_ADMIN_MODE) }} + {{ _self.switch('stats_permissions_admin_mode', STATS_PERMISSIONS_ADMIN_MODE, switch_type) }}
-
+

{{ lang('STATS_PERMISSIONS_USE_PERMISSIONS_EXP') }}
- {{ _self.switch('stats_permissions_use_permissions', STATS_PERMISSIONS_USE_PERMISSIONS) }} + {{ _self.switch('stats_permissions_use_permissions', STATS_PERMISSIONS_USE_PERMISSIONS, switch_type) }}
-
+

{{ lang('STATS_PERMISSIONS_DISP_FOR_GUESTS_EXP') }}
- + {{ _self.select('stats_permissions_disp_for_guests', STATS_PERMISSIONS_DISP_FOR_GUESTS, STATS_PERMISSIONS_OPTIONS) }}
-
+

{{ lang('STATS_PERMISSIONS_DISP_FOR_BOTS_EXP') }}
- + {{ _self.select('stats_permissions_disp_for_bots', STATS_PERMISSIONS_DISP_FOR_BOTS, STATS_PERMISSIONS_OPTIONS) }}
@@ -67,10 +54,10 @@

{{ lang('STATS_PERMISSIONS_CONFIG_TITLE') }}

{{ lang('STATS_PERMISSIONS_SECTION_RESET') }} -
+

{{ lang('STATS_PERMISSIONS_DEFAULTS_EXP') }}
- + {{ _self.js_button('stats_permissions_defaults', 'STATS_PERMISSIONS_BUTTON_DEFAULTS') }}
@@ -80,24 +67,54 @@

{{ lang('STATS_PERMISSIONS_CONFIG_TITLE') }}

  - +

{{ S_FORM_TOKEN }}
- +{{ _self.footer(STATS_PERMISSIONS_METADATA) }} {% INCLUDE 'overall_footer.html' %} -{% INCLUDEJS '@lukewcs_statspermissions/acp_stats_permissions.js' %} -{% INCLUDECSS '@lukewcs_statspermissions/acp_stats_permissions.css' %} -{% INCLUDECSS '@lukewcs_statspermissions/acp_toggle.css' %} +{% INCLUDEJS '@lukewcs_statspermissions/acp_stats_permissions_settings.js' %} +{% INCLUDECSS '@lukewcs_statspermissions/acp_stats_permissions_settings.css' %} -{% macro switch(name, checked = false) -%} - +{% macro switch(name, checked = false, type = 'toggle') -%} + {% if type == 'toggle' || type == 'checkbox' -%} + + {%- elseif type == 'radio' -%} + + + {%- endif %} {%- endmacro %} + +{% macro select(name, value, options) -%} + +{%- endmacro %} + +{% macro js_button(name, lang_var) -%} + +{%- endmacro %} + +{% macro notes(notes) %} + {% if notes|length %} +
+ {% for note in notes %} +

{{ note }}

+ {% endfor %} +
+ {% endif %} +{% endmacro %} + +{% macro footer(metadata) %} +

+ {{ metadata.EXT_NAME }} {{ metadata.EXT_VER }} © LukeWCS
+ {{ metadata.LANG_DESC|e('html') }} {{ metadata.LANG_VER|e('html') }} • {{ metadata.LANG_AUTHOR|e('html') }} +

+{% endmacro %} diff --git a/lukewcs/statspermissions/adm/style/acp_stats_permissions_settings.js b/lukewcs/statspermissions/adm/style/acp_stats_permissions_settings.js new file mode 100644 index 0000000..e5bf19c --- /dev/null +++ b/lukewcs/statspermissions/adm/style/acp_stats_permissions_settings.js @@ -0,0 +1,80 @@ +/** +* +* Stats Permissions. An extension for the phpBB Forum Software package. +* +* @copyright (c) 2019, LukeWCS, https://www.wcsaga.org/ +* @license GNU General Public License, version 2 (GPL-2.0) +* +*/ + +(function ($) { // IIFE start + +'use strict'; + +var constants = Object.freeze({ + PermNothing : 0, + PermStats : 1, + PermUsers : 2, + PermStatsUsers : 3, + + OpacityEnabled : '1.0', + OpacityDisabled : '0.35', +}); + +function setState() { + dimOptionGroup('stats_permissions_use_permissions', + $('[name="stats_permissions_admin_mode"]').prop('checked') + ); + dimOptionGroup('stats_permissions_disp_for_guests', + $('[name="stats_permissions_admin_mode"]').prop('checked') + || $('[name="stats_permissions_use_permissions"]').prop('checked') + ); + dimOptionGroup('stats_permissions_disp_for_bots', + $('[name="stats_permissions_admin_mode"]').prop('checked') + || $('[name="stats_permissions_use_permissions"]').prop('checked') + ); +}; + +function dimOptionGroup(elememtName, dimCondition) { + var c = constants; + + $('[name="' + elememtName + '"]').parents('dl').css('opacity', dimCondition ? c.OpacityDisabled : c.OpacityEnabled); +} + +function setDefaults() { + var c = constants; + + setSwitch( '[name="stats_permissions_admin_mode"]', false); + setSwitch( '[name="stats_permissions_use_permissions"]', false); + $( '[name="stats_permissions_disp_for_guests"]') .prop('value', c.PermStats); + $( '[name="stats_permissions_disp_for_bots"]') .prop('value', c.PermNothing); + + setState(); +}; + +function setSwitch(selector, checked) { + var $elementObject = $(selector); + + if ($elementObject.get(0).type == 'checkbox') { + $elementObject.prop('checked', checked); + } else if ($elementObject.get(0).type == 'radio') { + $('[name="' + $elementObject[0].name + '"][value="' + (checked ? 1 : 0) + '"]').prop('checked', true); + } +}; + +function formReset() { + setTimeout(function() { + setState(); + }); +}; + +$(window).ready(function() { + setState(); + + $('[name="stats_permissions_admin_mode"]') .on('change', setState); + $('[name="stats_permissions_use_permissions"]') .on('change', setState); + $('[name="stats_permissions_defaults"]') .on('click', setDefaults); + $('#stats_permissions_form') .on('reset', formReset); +}); + +})(jQuery); // IIFE end diff --git a/lukewcs/statspermissions/adm/style/acp_toggle.css b/lukewcs/statspermissions/adm/style/acp_toggle.css deleted file mode 100644 index d012a14..0000000 --- a/lukewcs/statspermissions/adm/style/acp_toggle.css +++ /dev/null @@ -1,48 +0,0 @@ -/* - phpBB ACP Toggles - A CSS class that makes it easy to display checkboxes as toggles. - Source : https://danklammer.com/articles/simple-css-toggle-switch/ - Revision by: Kirk (customization and optimization), LukeWCS (optimization) -*/ - -.toggle { - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - width: 38px; - height: 17px; - position: relative; - border-radius: 50px; - cursor: pointer; - font-family: FontAwesome; -} - -.toggle:before { - position: absolute; - width: 14px; - height: 13px; - background-color: #ffffff; - top: 2px; - border-radius: 50%; - display: flex; - justify-content: center; - align-items: center; - left: 22px; - content: "\f00d"; -} - -.toggle, -.toggle:hover, -.toggle:focus { - background-color: #cccccc; - border: none; - color: #000000; -} - -.toggle:checked { - background-color: #3b87ab; -} - -.toggle:checked:before { - left: 2px; - content: "\f00c"; -} diff --git a/lukewcs/statspermissions/composer.json b/lukewcs/statspermissions/composer.json index 0ccad12..203ac51 100644 --- a/lukewcs/statspermissions/composer.json +++ b/lukewcs/statspermissions/composer.json @@ -1,33 +1,33 @@ { - "name": "lukewcs/statspermissions", - "type": "phpbb-extension", - "description": "Allows to define independent permissions for viewing statistics and newest member.", - "homepage": "https://github.com/LukeWCS/stats-permissions", - "version": "1.0.2", - "time": "2023-02-12", - "license": "GPL-2.0-only", - "authors": [ - { - "name": "LukeWCS", - "homepage": "https://www.wcsaga.org", - "role": "Developer" - } - ], - "require": { - "php": ">=7.1.0,<8.3.0@dev", + "name": "lukewcs/statspermissions", + "type": "phpbb-extension", + "description": "Allows to define independent permissions for viewing statistics and newest member.", + "homepage": "https://github.com/LukeWCS/stats-permissions", + "version": "1.1.0-b1", + "time": "2023-12-09", + "license": "GPL-2.0-only", + "authors": [ + { + "name": "LukeWCS", + "homepage": "https://github.com/LukeWCS", + "role": "Developer" + } + ], + "require": { + "php": ">=7.1.0,<8.4.0@dev", "composer/installers": "~1.0.0" - }, - "extra": { - "display-name": "Stats Permissions", - "lang-min-ver": "1.0.1", - "soft-require": { - "phpbb/phpbb": ">=3.2.10,<3.4.0@dev" - }, - "version-check": { - "host": "lukewcs.github.io", - "directory": "/stats-permissions", - "filename": "version_check.json", - "ssl": true - } - } + }, + "extra": { + "display-name": "Stats Permissions", + "lang-min-ver": "1.1.0", + "soft-require": { + "phpbb/phpbb": ">=3.2.10,<3.4.0@dev" + }, + "version-check": { + "host": "lukewcs.github.io", + "directory": "/stats-permissions", + "filename": "version_check.json", + "ssl": true + } + } } diff --git a/lukewcs/statspermissions/config/services.yml b/lukewcs/statspermissions/config/services.yml index 80d2abd..2491911 100644 --- a/lukewcs/statspermissions/config/services.yml +++ b/lukewcs/statspermissions/config/services.yml @@ -21,5 +21,4 @@ services: - '@template' - '@request' - '@config' - - '@user' - '@ext.manager' diff --git a/lukewcs/statspermissions/controller/acp_stats_permissions_controller.php b/lukewcs/statspermissions/controller/acp_stats_permissions_controller.php index e45e8e8..624a681 100644 --- a/lukewcs/statspermissions/controller/acp_stats_permissions_controller.php +++ b/lukewcs/statspermissions/controller/acp_stats_permissions_controller.php @@ -16,8 +16,9 @@ class acp_stats_permissions_controller protected $template; protected $request; protected $config; - protected $user; protected $ext_manager; + protected $metadata; + public $u_action; public function __construct( @@ -25,7 +26,6 @@ public function __construct( \phpbb\template\template $template, \phpbb\request\request $request, \phpbb\config\config $config, - \phpbb\user $user, \phpbb\extension\manager $ext_manager ) { @@ -33,13 +33,17 @@ public function __construct( $this->template = $template; $this->request = $request; $this->config = $config; - $this->user = $user; $this->ext_manager = $ext_manager; + + $this->metadata = $this->ext_manager->create_extension_metadata_manager('lukewcs/statspermissions')->get_metadata('all'); } - public function module_settings() + public function module_settings(): void { - $this->language->add_lang(['acp_stats_permissions'], 'lukewcs/statspermissions'); + $notes = []; + + $this->language->add_lang(['acp_stats_permissions', 'acp_stats_permissions_lang_author'], 'lukewcs/statspermissions'); + $this->set_meta_template_vars('STATS_PERMISSIONS'); if ($this->request->is_set_post('submit')) { @@ -56,18 +60,7 @@ public function module_settings() trigger_error($this->language->lang('STATS_PERMISSIONS_MSG_SAVED_SETTINGS') . adm_back_link($this->u_action)); } - add_form_key('stats_permissions'); - - $md_manager = $this->ext_manager->create_extension_metadata_manager('lukewcs/statspermissions'); - $this_meta = $md_manager->get_metadata('all'); - $notes = []; - - $ext_display_name = $this_meta['extra']['display-name']; - $ext_ver = $this_meta['version']; - $ext_lang_min_ver = $this_meta['extra']['lang-min-ver']; - - $ext_lang_ver = $this->get_lang_ver('STATS_PERMISSIONS_LANG_EXT_VER'); - $lang_outdated_msg = $this->check_lang_ver($ext_display_name, $ext_lang_ver, $ext_lang_min_ver, 'STATS_PERMISSIONS_MSG_LANGUAGEPACK_OUTDATED'); + $lang_outdated_msg = $this->lang_ver_check_msg('STATS_PERMISSIONS_LANG_VER', 'STATS_PERMISSIONS_MSG_LANGUAGEPACK_OUTDATED'); if ($lang_outdated_msg) { $notes[] = $lang_outdated_msg; @@ -75,17 +68,23 @@ public function module_settings() $this->template->assign_vars([ // heading - 'STATS_PERMISSIONS_EXT_NAME' => $ext_display_name, - 'STATS_PERMISSIONS_EXT_VER' => $ext_ver, 'STATS_PERMISSIONS_NOTES' => $notes, // config section 1 'STATS_PERMISSIONS_ADMIN_MODE' => $this->config['stats_permissions_admin_mode'], 'STATS_PERMISSIONS_USE_PERMISSIONS' => $this->config['stats_permissions_use_permissions'], 'STATS_PERMISSIONS_DISP_FOR_GUESTS' => $this->config['stats_permissions_disp_for_guests'], 'STATS_PERMISSIONS_DISP_FOR_BOTS' => $this->config['stats_permissions_disp_for_bots'], + 'STATS_PERMISSIONS_OPTIONS' => [ + 'STATS_PERMISSIONS_PERM_STATS_NEWEST' => '3', + 'STATS_PERMISSIONS_PERM_NEWEST' => '2', + 'STATS_PERMISSIONS_PERM_STATS' => '1', + 'STATS_PERMISSIONS_PERM_NOTHING' => '0', + ], // form elements 'U_ACTION' => $this->u_action, ]); + + add_form_key('stats_permissions'); } public function set_page_url(string $u_action): void @@ -119,4 +118,41 @@ private function check_lang_ver(string $ext_name, string $ext_lang_ver, string $ return $lang_outdated_msg; } + + // Check the language pack version for the minimum version and generate notice if outdated + private function lang_ver_check_msg(string $lang_version_var, string $lang_outdated_var): string + { + $lang_outdated_msg = ''; + $ext_lang_ver = $this->get_lang_ver($lang_version_var); + $ext_lang_min_ver = $this->metadata['extra']['lang-min-ver']; + + if (phpbb_version_compare($ext_lang_ver, $ext_lang_min_ver, '<')) + { + if ($this->language->is_set($lang_outdated_var)) + { + $lang_outdated_msg = $this->language->lang($lang_outdated_var); + } + else // Fallback if the current language package does not yet have the required variable. + { + $lang_outdated_msg = 'Note: The language pack for the extension %1$s is no longer up-to-date. (installed: %2$s / needed: %3$s)'; + } + $lang_outdated_msg = sprintf($lang_outdated_msg, $this->metadata['extra']['display-name'], $ext_lang_ver, $ext_lang_min_ver); + } + + return $lang_outdated_msg; + } + + private function set_meta_template_vars(string $tpl_prefix): void + { + $this->template->assign_vars([ + $tpl_prefix . '_METADATA' => [ + 'EXT_NAME' => $this->metadata['extra']['display-name'], + 'EXT_VER' => $this->language->lang($tpl_prefix . '_VERSION_STRING', $this->metadata['version']), + 'LANG_DESC' => $this->language->lang($tpl_prefix . '_LANG_DESC'), + 'LANG_VER' => $this->language->lang($tpl_prefix . '_VERSION_STRING', $this->language->lang($tpl_prefix . '_LANG_VER')), + 'LANG_AUTHOR' => $this->language->lang($tpl_prefix . '_LANG_AUTHOR'), + 'CLASS' => strtolower($tpl_prefix) . '_footer', + ], + ]); + } } diff --git a/lukewcs/statspermissions/ext.php b/lukewcs/statspermissions/ext.php index 0a47476..6fe5d18 100644 --- a/lukewcs/statspermissions/ext.php +++ b/lukewcs/statspermissions/ext.php @@ -15,7 +15,7 @@ class ext extends \phpbb\extension\base public function is_enableable() { $valid_phpbb = phpbb_version_compare(PHPBB_VERSION, '3.2.10', '>=') && phpbb_version_compare(PHPBB_VERSION, '3.4.0-dev', '<'); - $valid_php = phpbb_version_compare(PHP_VERSION, '7.1.0', '>=') && phpbb_version_compare(PHP_VERSION, '8.3.0-dev', '<'); + $valid_php = phpbb_version_compare(PHP_VERSION, '7.1.0', '>=') && phpbb_version_compare(PHP_VERSION, '8.4.0-dev', '<'); return $valid_phpbb && $valid_php; } diff --git a/lukewcs/statspermissions/language/de/acp_stats_permissions.php b/lukewcs/statspermissions/language/de/acp_stats_permissions.php index 6597b2e..756db91 100644 --- a/lukewcs/statspermissions/language/de/acp_stats_permissions.php +++ b/lukewcs/statspermissions/language/de/acp_stats_permissions.php @@ -37,11 +37,6 @@ // ’ « » “ ” … „ “ // $lang = array_merge($lang, [ - // language pack author - 'STATS_PERMISSIONS_LANG_DESC' => 'Deutsch (Du)', - 'STATS_PERMISSIONS_LANG_EXT_VER' => '1.0.1', - 'STATS_PERMISSIONS_LANG_AUTHOR' => 'LukeWCS', - // config head 'STATS_PERMISSIONS_CONFIG_TITLE' => 'Statistik-Berechtigungen', 'STATS_PERMISSIONS_CONFIG_DESC' => 'Hier kannst du die Einstellungen für die Erweiterung %s ändern.', @@ -69,5 +64,4 @@ // messages 'STATS_PERMISSIONS_MSG_SAVED_SETTINGS' => 'Statistik-Berechtigungen: Einstellungen erfolgreich gespeichert.', - 'STATS_PERMISSIONS_MSG_LANGUAGEPACK_OUTDATED' => 'Hinweis: Das Sprachpaket der Erweiterung %1$s ist nicht mehr aktuell. (vorhanden: %2$s / benötigt: %3$s)', ]); diff --git a/lukewcs/statspermissions/language/de/acp_stats_permissions_lang_author.php b/lukewcs/statspermissions/language/de/acp_stats_permissions_lang_author.php new file mode 100644 index 0000000..333e91b --- /dev/null +++ b/lukewcs/statspermissions/language/de/acp_stats_permissions_lang_author.php @@ -0,0 +1,47 @@ + 'Deutsch (Du)', + 'STATS_PERMISSIONS_LANG_VER' => '1.1.0', + 'STATS_PERMISSIONS_LANG_AUTHOR' => 'LukeWCS', + + // messages + 'STATS_PERMISSIONS_MSG_LANGUAGEPACK_OUTDATED' => 'Hinweis: Das Sprachpaket der Erweiterung %1$s ist nicht mehr aktuell. (vorhanden: %2$s / benötigt: %3$s)', +]); diff --git a/lukewcs/statspermissions/language/de/info_acp_stats_permissions.php b/lukewcs/statspermissions/language/de/info_acp_stats_permissions.php index bf98351..ad7b094 100644 --- a/lukewcs/statspermissions/language/de/info_acp_stats_permissions.php +++ b/lukewcs/statspermissions/language/de/info_acp_stats_permissions.php @@ -38,6 +38,7 @@ // $lang = array_merge($lang, [ // navigation - 'STATS_PERMISSIONS_NAV_TITLE' => 'Statistik-Berechtigungen', - 'STATS_PERMISSIONS_NAV_CONFIG' => 'Einstellungen', + 'STATS_PERMISSIONS_NAV_TITLE' => 'Statistik-Berechtigungen', + 'STATS_PERMISSIONS_NAV_CONFIG' => 'Einstellungen', + 'STATS_PERMISSIONS_VERSION_STRING' => 'v%s', ]); diff --git a/lukewcs/statspermissions/language/de_x_sie/acp_stats_permissions.php b/lukewcs/statspermissions/language/de_x_sie/acp_stats_permissions.php index f497b7d..683432e 100644 --- a/lukewcs/statspermissions/language/de_x_sie/acp_stats_permissions.php +++ b/lukewcs/statspermissions/language/de_x_sie/acp_stats_permissions.php @@ -37,11 +37,6 @@ // ’ « » “ ” … „ “ // $lang = array_merge($lang, [ - // language pack author - 'STATS_PERMISSIONS_LANG_DESC' => 'Deutsch (Sie)', - 'STATS_PERMISSIONS_LANG_EXT_VER' => '1.0.1', - 'STATS_PERMISSIONS_LANG_AUTHOR' => 'LukeWCS', - // config head 'STATS_PERMISSIONS_CONFIG_TITLE' => 'Statistik-Berechtigungen', 'STATS_PERMISSIONS_CONFIG_DESC' => 'Hier können Sie die Einstellungen für die Erweiterung %s ändern.', @@ -69,5 +64,4 @@ // messages 'STATS_PERMISSIONS_MSG_SAVED_SETTINGS' => 'Statistik-Berechtigungen: Einstellungen erfolgreich gespeichert.', - 'STATS_PERMISSIONS_MSG_LANGUAGEPACK_OUTDATED' => 'Hinweis: Das Sprachpaket der Erweiterung %1$s ist nicht mehr aktuell. (vorhanden: %2$s / benötigt: %3$s)', ]); diff --git a/lukewcs/statspermissions/language/de_x_sie/acp_stats_permissions_lang_author.php b/lukewcs/statspermissions/language/de_x_sie/acp_stats_permissions_lang_author.php new file mode 100644 index 0000000..5bfac32 --- /dev/null +++ b/lukewcs/statspermissions/language/de_x_sie/acp_stats_permissions_lang_author.php @@ -0,0 +1,47 @@ + 'Deutsch (Sie)', + 'STATS_PERMISSIONS_LANG_VER' => '1.1.0', + 'STATS_PERMISSIONS_LANG_AUTHOR' => 'LukeWCS', + + // messages + 'STATS_PERMISSIONS_MSG_LANGUAGEPACK_OUTDATED' => 'Hinweis: Das Sprachpaket der Erweiterung %1$s ist nicht mehr aktuell. (vorhanden: %2$s / benötigt: %3$s)', +]); diff --git a/lukewcs/statspermissions/language/de_x_sie/info_acp_stats_permissions.php b/lukewcs/statspermissions/language/de_x_sie/info_acp_stats_permissions.php index bf98351..ad7b094 100644 --- a/lukewcs/statspermissions/language/de_x_sie/info_acp_stats_permissions.php +++ b/lukewcs/statspermissions/language/de_x_sie/info_acp_stats_permissions.php @@ -38,6 +38,7 @@ // $lang = array_merge($lang, [ // navigation - 'STATS_PERMISSIONS_NAV_TITLE' => 'Statistik-Berechtigungen', - 'STATS_PERMISSIONS_NAV_CONFIG' => 'Einstellungen', + 'STATS_PERMISSIONS_NAV_TITLE' => 'Statistik-Berechtigungen', + 'STATS_PERMISSIONS_NAV_CONFIG' => 'Einstellungen', + 'STATS_PERMISSIONS_VERSION_STRING' => 'v%s', ]); diff --git a/lukewcs/statspermissions/language/en/acp_stats_permissions.php b/lukewcs/statspermissions/language/en/acp_stats_permissions.php index ab7dcbc..cd11ffc 100644 --- a/lukewcs/statspermissions/language/en/acp_stats_permissions.php +++ b/lukewcs/statspermissions/language/en/acp_stats_permissions.php @@ -37,11 +37,6 @@ // ’ « » “ ” … „ “ // $lang = array_merge($lang, [ - // language pack author - 'STATS_PERMISSIONS_LANG_DESC' => 'English', - 'STATS_PERMISSIONS_LANG_EXT_VER' => '1.0.1', - 'STATS_PERMISSIONS_LANG_AUTHOR' => 'LukeWCS', - // config head 'STATS_PERMISSIONS_CONFIG_TITLE' => 'Stats Permissions', 'STATS_PERMISSIONS_CONFIG_DESC' => 'Here you can change the settings for the %s extension.', @@ -69,5 +64,4 @@ // messages 'STATS_PERMISSIONS_MSG_SAVED_SETTINGS' => 'Stats Permissions: Configuration updated successfully.', - 'STATS_PERMISSIONS_MSG_LANGUAGEPACK_OUTDATED' => 'Note: The language pack for the extension %1$s is no longer up-to-date. (installed: %2$s / needed: %3$s)', ]); diff --git a/lukewcs/statspermissions/language/en/acp_stats_permissions_lang_author.php b/lukewcs/statspermissions/language/en/acp_stats_permissions_lang_author.php new file mode 100644 index 0000000..7ddb0d7 --- /dev/null +++ b/lukewcs/statspermissions/language/en/acp_stats_permissions_lang_author.php @@ -0,0 +1,47 @@ + 'English', + 'STATS_PERMISSIONS_LANG_VER' => '1.1.0', + 'STATS_PERMISSIONS_LANG_AUTHOR' => 'LukeWCS', + + // messages + 'STATS_PERMISSIONS_MSG_LANGUAGEPACK_OUTDATED' => 'Note: The language pack for the extension %1$s is no longer up-to-date. (installed: %2$s / needed: %3$s)', +]); diff --git a/lukewcs/statspermissions/language/en/info_acp_stats_permissions.php b/lukewcs/statspermissions/language/en/info_acp_stats_permissions.php index 3934268..0ddc241 100644 --- a/lukewcs/statspermissions/language/en/info_acp_stats_permissions.php +++ b/lukewcs/statspermissions/language/en/info_acp_stats_permissions.php @@ -38,6 +38,7 @@ // $lang = array_merge($lang, [ // navigation - 'STATS_PERMISSIONS_NAV_TITLE' => 'Stats Permissions', - 'STATS_PERMISSIONS_NAV_CONFIG' => 'Settings', + 'STATS_PERMISSIONS_NAV_TITLE' => 'Stats Permissions', + 'STATS_PERMISSIONS_NAV_CONFIG' => 'Settings', + 'STATS_PERMISSIONS_VERSION_STRING' => 'v%s', ]); diff --git a/stats-permissions_build_changelog.md b/stats-permissions_build_changelog.md index e2afa6b..6ae4482 100644 --- a/stats-permissions_build_changelog.md +++ b/stats-permissions_build_changelog.md @@ -1,7 +1,31 @@ -### 1.0.2 +#### 1.1.0-b1 +* Freigegeben für PHP 8.3. +* Erweiterung ist jetzt kompatibel mit Toggle Control. Somit können Administratoren zentral an einer Stelle entscheiden, ob für Ja/Nein Schalter Radio Buttons, Checkboxen oder Toggles verwendet werden sollen. +* ACP-Template: + * Bei allen Optionsgruppen die ID entfernt, die für die Abblenden-Funktion benötigt wurde. + * Das `switch()` Makro wurde erweitert, um auch Checkboxen und Radio Buttons generieren zu können. Notwendig für die TC Kompatibilität. + * Footer durch `footer()` Makro ersetzt. + * Benachrichtigungen durch `notes()` Makro ersetzt. + * PullDown Menüs durch `select()` Makro ersetzt. + * JS Button durch `js_button()` Makro ersetzt. +* ACP-Controller: + * Meine Metadata Funktion eingebaut für das Footer Makro. + * Auf das Sprachpaket-Info-Modul von EMP umgestellt. +* CSS: + * Das Toggle-CSS in das ACP-CSS integriert und die separate Datei entfernt. + * Bei Toggles wird jetzt eine Bewegungs-Animation beim Slider verwendet, sowie eine Farb-Animation (Übergang) bei der Hintergrundfarbe. [Vorschlag von Kirk (phpBB.de)] + * Pointer Cursor bei `dt label` deaktiviert. +* JS: + * Da Schalter jetzt auch als Radio Buttons dargestellt werden können, musste die Funktion zum Zurücksetzen auf Installationsstandard angepasst werden. + * Der Formular-Reset ist nicht mehr an einen Button gebunden, sondern wird per Reset-Event überwacht und so `setState` automatisch ausgeführt. + * Funktion hinzugefügt, mit der eine Optionsgruppe anhand des Element-Namens abgeblendet werden kann. Somit keine ID im Template mehr notwendig. + * Globales Objekt entfernt und auf IIFE umgestellt. +* Sprachdateien: + * An das Footer Makro angepasst. + * Sprachdatei für das Sprachpaket-Info-Modul hinzugefügt. #### 1.0.2 -* Release +* Release (2023-02-12) #### 1.0.2-b2 * ACP-Modul: @@ -30,9 +54,7 @@ * Kleinere Korrekturen. ### 1.0.1 - -#### 1.0.1 -* Release +* Release (2022-12-01) #### 1.0.1-b2 * ACP-Template: @@ -72,6 +94,7 @@ * Überflüssige (redundante) Angabe des phpBB Versionsbereichs entfernt. ### 1.0.0 +* Release (2022-03-26) #### b10 * GitHub: `.gitattributes` ergänzt. diff --git a/stats-permissions_changelog_de.md b/stats-permissions_changelog_de.md index 5872252..2781dfb 100644 --- a/stats-permissions_changelog_de.md +++ b/stats-permissions_changelog_de.md @@ -1,5 +1,12 @@ +### 1.1.0 +(2023-12-) + +* Freigegeben für PHP 8.3. +* Erweiterung ist jetzt kompatibel mit Toggle Control. Somit können Administratoren zentral an einer Stelle entscheiden, ob für Ja/Nein Schalter Radio Buttons, Checkboxen oder Toggles verwendet werden sollen. +* Technik auf den Stand von EMP 2.0 gebracht. + ### 1.0.2 -GH (2023-02-12) +(2023-02-12) * Fix: Von LFWWH einen Fix im Rechtesystem bezüglich Bots übernommen, der sich auf eine Warnung im Foren-Frontend bezieht. * ACP-Template: @@ -13,7 +20,7 @@ GH (2023-02-12) * PHP Minimalversion auf 7.1 erhöht und Maximalversion auf 8.2. ### 1.0.1 -GH (2022-12-01) +(2022-12-01) * Rechte: * Beschreibungen der Rechte erweitert, damit man auch in den Rechten sofort sieht, was zu StatsPerm gehört. @@ -26,7 +33,7 @@ GH (2022-12-01) * Javascript Events werden jetzt direkt in jQuery registriert und Elemente werden nicht mehr über die ID sondern über den Element-Namen angesprochen, der ohnehin vorhanden sein muss. ### 1.0.0 -GH (2022-03-26) +(2022-03-26) * Den API-Modus von LFWWH übernommen, damit andere Entwickler die Anzeige des Templates deaktivieren können. Dieser Modus kann momentan nur per PHP Event getriggert werden, die ACP Einstellung dafür kommt später. * Das PHP Event `lukewcs.statspermissions.display_condition` eingebaut, mit dem bestimmte Variablen übersteuert werden können um das Verhalten von StatsPerm zu ändern. Hilfreich für Bridge-Entwickler. Die folgenden Event-Variablen werden erstmalig unterstützt: @@ -37,7 +44,7 @@ GH (2022-03-26) * Die von phpBB nicht genutzte CSS Klasse `statistics` in `statsperm-statistics` umbenannt. (Vorschlag von: Kirk) ### 1.0.0-rc1 -GH (2022-02-28) +(2022-02-28) * Erste öffentliche Version. * Komplette Überarbeitung und Anpassung an die aktuellen Richtlinien.