Compare commits

...

2 Commits

Author SHA1 Message Date
Jean-Christian Paul Denis fe476152d2
code review 2023-11-04 22:03:58 +01:00
Jean-Christian Paul Denis d63eaeb95a
maybe better permissions check 2023-10-21 22:45:58 +02:00
7 changed files with 24 additions and 14 deletions

View File

@ -1,3 +1,9 @@
translater 2023.11.04
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1
* Cosmetic code review
translater 2023.10.21 translater 2023.10.21
=========================================================== ===========================================================
* Require Dotclear 2.28 * Require Dotclear 2.28

View File

@ -1,8 +1,8 @@
# README # README
[![Release](https://img.shields.io/badge/release-2023.10.21-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/translater/releases) [![Release](https://img.shields.io/badge/release-2023.11.04-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/translater/releases)
![Date](https://img.shields.io/badge/date-2023.10.21-c44d58.svg) ![Date](https://img.shields.io/badge/date-2023.11.04-c44d58.svg)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download) [![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/translater) [![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/translater)
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/translater/src/branch/master/LICENSE) [![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/translater/src/branch/master/LICENSE)
@ -10,7 +10,7 @@
_translater_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org). _translater_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
> It helps dev to translate plugin and theme. > Help dev to translate plugin and theme.
## REQUIREMENTS ## REQUIREMENTS

View File

@ -17,7 +17,7 @@ $this->registerModule(
'Translater', 'Translater',
'Translate your Dotclear plugins and themes', 'Translate your Dotclear plugins and themes',
'Jean-Christian Denis & contributors', 'Jean-Christian Denis & contributors',
'2023.10.21', '2023.11.04',
[ [
'requires' => [['core', '2.28']], 'requires' => [['core', '2.28']],
'permissions' => 'My', 'permissions' => 'My',

View File

@ -2,10 +2,10 @@
<modules xmlns:da="http://dotaddict.org/da/"> <modules xmlns:da="http://dotaddict.org/da/">
<module id="translater"> <module id="translater">
<name>Translater</name> <name>Translater</name>
<version>2023.10.21</version> <version>2023.11.04</version>
<author>Jean-Christian Denis &amp; contributors</author> <author>Jean-Christian Denis &amp; contributors</author>
<desc>Translate your Dotclear plugins and themes</desc> <desc>Translate your Dotclear plugins and themes</desc>
<file>https://git.dotclear.watch/JcDenis/translater/releases/download/v2023.10.21/plugin-translater.zip</file> <file>https://git.dotclear.watch/JcDenis/translater/releases/download/v2023.11.04/plugin-translater.zip</file>
<da:dcmin>2.28</da:dcmin> <da:dcmin>2.28</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/translater/src/branch/master/README.md</da:details> <da:details>https://git.dotclear.watch/JcDenis/translater/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/translater/issues</da:support> <da:support>https://git.dotclear.watch/JcDenis/translater/issues</da:support>

View File

@ -120,7 +120,7 @@ class Config extends Process
// parse_userinfo // parse_userinfo
(new Para())->items([ (new Para())->items([
(new Label(__('User info:')))->for('parse_userinfo'), (new Label(__('User info:')))->for('parse_userinfo'),
(new Input('parse_userinfo'))->size(65)->maxlenght(255)->value($s->parse_userinfo), (new Input('parse_userinfo'))->size(65)->maxlength(255)->value($s->parse_userinfo),
]), ]),
(new Note())->text(sprintf( (new Note())->text(sprintf(
__('Following informations can be used: %s'), __('Following informations can be used: %s'),
@ -136,7 +136,7 @@ class Config extends Process
// export_filename // export_filename
(new Para())->items([ (new Para())->items([
(new Label(__('Name of exported package:')))->for('export_filename'), (new Label(__('Name of exported package:')))->for('export_filename'),
(new Input('export_filename'))->size(65)->maxlenght(255)->value($s->export_filename), (new Input('export_filename'))->size(65)->maxlength(255)->value($s->export_filename),
]), ]),
]), ]),
(new Fieldset())->class('fieldset')->legend((new Legend(__('Backups'))))->fields([ (new Fieldset())->class('fieldset')->legend((new Legend(__('Backups'))))->fields([

View File

@ -525,7 +525,7 @@ class Manage extends Process
(new Select(['entries[' . $i . '][group]']))->default($rs['group'])->items(My::l10nGroupsCombo())->disabled($in_dc)->render(), (new Select(['entries[' . $i . '][group]']))->default($rs['group'])->items(My::l10nGroupsCombo())->disabled($in_dc)->render(),
Html::escapeHTML($msgid), Html::escapeHTML($msgid),
(new Hidden(['entries[' . $i . '][msgid]'], Html::escapeHTML($msgid)))->render() . (new Hidden(['entries[' . $i . '][msgid]'], Html::escapeHTML($msgid)))->render() .
(new Input(['entries[' . $i . '][msgstr][0]']))->size(48)->maxlenght(255)->value(Html::escapeHTML($rs['msgstr'][0]))->disabled($in_dc)->render(), (new Input(['entries[' . $i . '][msgstr][0]']))->size(48)->maxlength(255)->value(Html::escapeHTML($rs['msgstr'][0]))->disabled($in_dc)->render(),
implode('', $t_msgstr), implode('', $t_msgstr),
implode('', $t_files) implode('', $t_files)
); );
@ -556,7 +556,7 @@ class Manage extends Process
sprintf(__('Plural "%s"'), $plural), sprintf(__('Plural "%s"'), $plural),
sprintf(__('Plural form of "%s"'), $rs['plural']), sprintf(__('Plural form of "%s"'), $rs['plural']),
(new Hidden(['entries[' . $i . '][msgid_plural]'], Html::escapeHTML($rs['plural'])))->render() . (new Hidden(['entries[' . $i . '][msgid_plural]'], Html::escapeHTML($rs['plural'])))->render() .
(new Input(['entries[' . $i . '][msgstr][' . ($j + 1) . ']']))->size(48)->maxlenght(255)->value(Html::escapeHTML($rs['msgstr'][$j + 1] ?? ''))->disbaled($in_dc)->render(), (new Input(['entries[' . $i . '][msgstr][' . ($j + 1) . ']']))->size(48)->maxlength(255)->value(Html::escapeHTML($rs['msgstr'][$j + 1] ?? ''))->disabled($in_dc)->render(),
implode('', $t_msgstr), implode('', $t_msgstr),
'' ''
); );
@ -569,8 +569,8 @@ class Manage extends Process
' offline', ' offline',
(new Checkbox(['entries[' . $i . '][check]']))->value(1)->render(), (new Checkbox(['entries[' . $i . '][check]']))->value(1)->render(),
(new Select(['entries[' . $i . '][group]']))->items(My::l10nGroupsCombo())->default('main')->render(), (new Select(['entries[' . $i . '][group]']))->items(My::l10nGroupsCombo())->default('main')->render(),
(new Input(['entries[' . $i . '][msgid]']))->size(48)->maxlenght(255)->render(), (new Input(['entries[' . $i . '][msgid]']))->size(48)->maxlength(255)->render(),
(new Input(['entries[' . $i . '][msgstr][0]']))->size(48)->maxlenght(255)->render(), (new Input(['entries[' . $i . '][msgstr][0]']))->size(48)->maxlength(255)->render(),
'', '',
'' ''
); );

View File

@ -25,7 +25,11 @@ class My extends MyPlugin
public static function checkCustomContext(int $context): ?bool public static function checkCustomContext(int $context): ?bool
{ {
return in_array($context, [My::BACKEND, My::MANAGE, My::MENU]) ? App::auth()->isSuperAdmin() : null; return match ($context) {
// Limit to super admin
self::MODULE => App::auth()->isSuperAdmin(),
default => null,
};
} }
/** /**