Improvement: config registration form settings (#3932)

* wip

* wip

* i18n en-us

* phpcs fixes

* wip i18n

* wip i18n

* i18n ignore en-us

* delete registration.help

* i18n de

* JS Syntax fixed for config.js

* JavaScript lint fixes config.js

* fix typo in i18n/de

* improve the JS

* improve HTML

* phpcs fixes

* update main.js from edge

* fix i18n comments

* Update app/i18n/fr/admin.php

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
This commit is contained in:
maTh
2022-02-05 13:50:33 +01:00
committed by GitHub
parent e28a2e320e
commit ba1259bb21
20 changed files with 337 additions and 52 deletions

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Maximální počet kategorií na uživatele',
'max-feeds' => 'Maximální počet kanálů na uživatele',
'registration' => array(
'help' => '0 znamená žádná omezení účtu',
'number' => 'Maximální počet účtů',
'select' => array(
'label' => 'Registration form', // TODO
'option' => array(
'noform' => 'Disabled: No registration form', // TODO
'nolimit' => 'Enabled: No limit of accounts', // TODO
'setaccountsnumber' => 'Set max. number of accounts', // TODO
),
),
'status' => array(
'disabled' => 'Form disabled', // TODO
'enabled' => 'Form enabled', // TODO
),
'title' => 'User registration form', // TODO
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Anzahl erlaubter Kategorien pro Benutzer',
'max-feeds' => 'Anzahl erlaubter Feeds pro Benutzer',
'registration' => array(
'help' => '0 heißt, dass es kein Account Limit gibt',
'number' => 'Maximale Anzahl von Accounts',
'select' => array(
'label' => 'Registrierungsformular',
'option' => array(
'noform' => 'Deaktiviert: Keine Registrierung möglich',
'nolimit' => 'Aktiviert: Registrierung möglich',
'setaccountsnumber' => 'Anzahl maximaler Benutzer-Acounts festlegen',
),
),
'status' => array(
'disabled' => 'Formular deaktiviert',
'enabled' => 'Formular aktiviert',
),
'title' => 'Benutzer-Registrierungsformular',
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Max number of categories per user', // IGNORE
'max-feeds' => 'Max number of feeds per user', // IGNORE
'registration' => array(
'help' => '0 means that there is no account limit', // IGNORE
'number' => 'Max number of accounts', // IGNORE
'select' => array(
'label' => 'Registration form', // IGNORE
'option' => array(
'noform' => 'Disabled: No registration form', // IGNORE
'nolimit' => 'Enabled: No limit of accounts', // IGNORE
'setaccountsnumber' => 'Set max. number of accounts', // IGNORE
),
),
'status' => array(
'disabled' => 'Form disabled', // IGNORE
'enabled' => 'Form enabled', // IGNORE
),
'title' => 'User registration form', // IGNORE
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Max number of categories per user',
'max-feeds' => 'Max number of feeds per user',
'registration' => array(
'help' => '0 means that there is no account limit',
'number' => 'Max number of accounts',
'select' => array(
'label' => 'Registration form',
'option' => array(
'noform' => 'Disabled: No registration form',
'nolimit' => 'Enabled: No limit of accounts',
'setaccountsnumber' => 'Set max. number of accounts',
),
),
'status' => array(
'disabled' => 'Form disabled',
'enabled' => 'Form enabled',
),
'title' => 'User registration form',
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Límite de categorías por usuario',
'max-feeds' => 'Límite de fuentes por usuario',
'registration' => array(
'help' => '0 significa que no hay límite en la cuenta',
'number' => 'Número máximo de cuentas',
'select' => array(
'label' => 'Registration form', // TODO
'option' => array(
'noform' => 'Disabled: No registration form', // TODO
'nolimit' => 'Enabled: No limit of accounts', // TODO
'setaccountsnumber' => 'Set max. number of accounts', // TODO
),
),
'status' => array(
'disabled' => 'Form disabled', // TODO
'enabled' => 'Form enabled', // TODO
),
'title' => 'User registration form', // TODO
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Limite de catégories par utilisateur',
'max-feeds' => 'Limite de flux par utilisateur',
'registration' => array(
'help' => 'Un chiffre de 0 signifie que lon peut créer un nombre infini de comptes',
'number' => 'Nombre max de comptes',
'select' => array(
'label' => 'Formulaire dinscription',
'option' => array(
'noform' => 'Désactivé : Pas de formulaire dinscription',
'nolimit' => 'Activé : Pas de limite au nombre dutilisateurs',
'setaccountsnumber' => 'Nombre dutilisateurs limités',
),
),
'status' => array(
'disabled' => 'Formulaire désactivé',
'enabled' => 'Formulaire activé',
),
'title' => 'Formulaire dinscription utilisateur',
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Max number of categories per user', // TODO
'max-feeds' => 'Max number of feeds per user', // TODO
'registration' => array(
'help' => '0 means that there is no account limit', // TODO
'number' => 'Max number of accounts', // TODO
'select' => array(
'label' => 'Registration form', // TODO
'option' => array(
'noform' => 'Disabled: No registration form', // TODO
'nolimit' => 'Enabled: No limit of accounts', // TODO
'setaccountsnumber' => 'Set max. number of accounts', // TODO
),
),
'status' => array(
'disabled' => 'Form disabled', // TODO
'enabled' => 'Form enabled', // TODO
),
'title' => 'User registration form', // TODO
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Limite categorie per utente',
'max-feeds' => 'Limite feeds per utente',
'registration' => array(
'help' => '0 significa che non esiste limite sui profili',
'number' => 'Numero massimo di profili',
'select' => array(
'label' => 'Registration form', // TODO
'option' => array(
'noform' => 'Disabled: No registration form', // TODO
'nolimit' => 'Enabled: No limit of accounts', // TODO
'setaccountsnumber' => 'Set max. number of accounts', // TODO
),
),
'status' => array(
'disabled' => 'Form disabled', // TODO
'enabled' => 'Form enabled', // TODO
),
'title' => 'User registration form', // TODO
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => '1ユーザーごとのカテゴリの最大値',
'max-feeds' => '1ユーザーごとのフィードの最大値',
'registration' => array(
'help' => '0 はアカウントの上限がないことを意味しています',
'number' => 'アカウントの最大値',
'select' => array(
'label' => 'Registration form', // TODO
'option' => array(
'noform' => 'Disabled: No registration form', // TODO
'nolimit' => 'Enabled: No limit of accounts', // TODO
'setaccountsnumber' => 'Set max. number of accounts', // TODO
),
),
'status' => array(
'disabled' => 'Form disabled', // TODO
'enabled' => 'Form enabled', // TODO
),
'title' => 'User registration form', // TODO
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => '사용자별 카테고리 개수 제한',
'max-feeds' => '사용자별 피드 개수 제한',
'registration' => array(
'help' => '0: 제한 없음',
'number' => '계정 최대 개수',
'select' => array(
'label' => 'Registration form', // TODO
'option' => array(
'noform' => 'Disabled: No registration form', // TODO
'nolimit' => 'Enabled: No limit of accounts', // TODO
'setaccountsnumber' => 'Set max. number of accounts', // TODO
),
),
'status' => array(
'disabled' => 'Form disabled', // TODO
'enabled' => 'Form enabled', // TODO
),
'title' => 'User registration form', // TODO
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Categorielimiet per gebruiker',
'max-feeds' => 'Feedlimiet per gebruiker',
'registration' => array(
'help' => '0 betekent geen account limiet',
'number' => 'Maximum aantal accounts',
'select' => array(
'label' => 'Registration form', // TODO
'option' => array(
'noform' => 'Disabled: No registration form', // TODO
'nolimit' => 'Enabled: No limit of accounts', // TODO
'setaccountsnumber' => 'Set max. number of accounts', // TODO
),
),
'status' => array(
'disabled' => 'Form disabled', // TODO
'enabled' => 'Form enabled', // TODO
),
'title' => 'User registration form', // TODO
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Limita de categoria per utilizaire',
'max-feeds' => 'Limita de fluxes per utilizaire',
'registration' => array(
'help' => '0 vòl dire qui a pas cap de limita de compte',
'number' => 'Nombre max de comptes',
'select' => array(
'label' => 'Registration form', // TODO
'option' => array(
'noform' => 'Disabled: No registration form', // TODO
'nolimit' => 'Enabled: No limit of accounts', // TODO
'setaccountsnumber' => 'Set max. number of accounts', // TODO
),
),
'status' => array(
'disabled' => 'Form disabled', // TODO
'enabled' => 'Form enabled', // TODO
),
'title' => 'User registration form', // TODO
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Maksymalna liczba kategorii na użytkownika',
'max-feeds' => 'Maksymalna liczba kanałów na użytkownika',
'registration' => array(
'help' => '0 oznacza brak limitu liczby kont',
'number' => 'Maksymalna liczba kont',
'select' => array(
'label' => 'Registration form', // TODO
'option' => array(
'noform' => 'Disabled: No registration form', // TODO
'nolimit' => 'Enabled: No limit of accounts', // TODO
'setaccountsnumber' => 'Set max. number of accounts', // TODO
),
),
'status' => array(
'disabled' => 'Form disabled', // TODO
'enabled' => 'Form enabled', // TODO
),
'title' => 'User registration form', // TODO
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Limite de categorias por usuário',
'max-feeds' => 'Limite de Feeds por usuário',
'registration' => array(
'help' => '0 significa que não há limite para a conta',
'number' => 'Máximo número de contas',
'select' => array(
'label' => 'Registration form', // TODO
'option' => array(
'noform' => 'Disabled: No registration form', // TODO
'nolimit' => 'Enabled: No limit of accounts', // TODO
'setaccountsnumber' => 'Set max. number of accounts', // TODO
),
),
'status' => array(
'disabled' => 'Form disabled', // TODO
'enabled' => 'Form enabled', // TODO
),
'title' => 'User registration form', // TODO
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Максимальное количество категорий на пользователя',
'max-feeds' => 'Максимальное количество лент на пользователя',
'registration' => array(
'help' => '0 означает неограниченное количество пользователей',
'number' => 'Максимальное количество пользователей',
'select' => array(
'label' => 'Registration form', // TODO
'option' => array(
'noform' => 'Disabled: No registration form', // TODO
'nolimit' => 'Enabled: No limit of accounts', // TODO
'setaccountsnumber' => 'Set max. number of accounts', // TODO
),
),
'status' => array(
'disabled' => 'Form disabled', // TODO
'enabled' => 'Form enabled', // TODO
),
'title' => 'User registration form', // TODO
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Limit počtu kategórií pre používateľa',
'max-feeds' => 'Limit počtu kanálov pre používateľov',
'registration' => array(
'help' => '0 znamená žiadny limit počtu účtov',
'number' => 'Maximálny počt účtov',
'select' => array(
'label' => 'Registration form', // TODO
'option' => array(
'noform' => 'Disabled: No registration form', // TODO
'nolimit' => 'Enabled: No limit of accounts', // TODO
'setaccountsnumber' => 'Set max. number of accounts', // TODO
),
),
'status' => array(
'disabled' => 'Form disabled', // TODO
'enabled' => 'Form enabled', // TODO
),
'title' => 'User registration form', // TODO
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => 'Kullanıcı başına kategori limiti',
'max-feeds' => 'Kullanıcı başına akış limiti',
'registration' => array(
'help' => '0 sınır yok anlamındadır',
'number' => 'En fazla hesap sayısı',
'select' => array(
'label' => 'Registration form', // TODO
'option' => array(
'noform' => 'Disabled: No registration form', // TODO
'nolimit' => 'Enabled: No limit of accounts', // TODO
'setaccountsnumber' => 'Set max. number of accounts', // TODO
),
),
'status' => array(
'disabled' => 'Form disabled', // TODO
'enabled' => 'Form enabled', // TODO
),
'title' => 'User registration form', // TODO
),
),
'update' => array(

View File

@@ -168,8 +168,20 @@ return array(
'max-categories' => '各用户分类数限制',
'max-feeds' => '各用户订阅源数限制',
'registration' => array(
'help' => '0 表示无用户数限制',
'number' => '最大用户数',
'select' => array(
'label' => 'Registration form', // TODO
'option' => array(
'noform' => 'Disabled: No registration form', // TODO
'nolimit' => 'Enabled: No limit of accounts', // TODO
'setaccountsnumber' => 'Set max. number of accounts', // TODO
),
),
'status' => array(
'disabled' => 'Form disabled', // TODO
'enabled' => 'Form enabled', // TODO
),
'title' => 'User registration form', // TODO
),
),
'update' => array(

View File

@@ -29,40 +29,6 @@
</div>
</div>
<div class="form-group">
<label class="group-name" for="max-registrations"><?= _t('admin.system.registration.number') ?></label>
<div class="group-controls">
<input type="number" id="max-registrations" name="max-registrations" value="<?= FreshRSS_Context::$system_conf->limits['max_registrations'] ?>" min="0"
data-leave-validation="<?= FreshRSS_Context::$system_conf->limits['max_registrations'] ?>"/>
<p class="help"><?= _i('help') ?> <?= _t('admin.system.registration.help') ?></p>
</div>
</div>
<div class="form-group">
<div class="group-controls">
<?php
$number = count(listUsers());
echo ($number > 1 ? _t('admin.user.numbers', $number) : _t('admin.user.number', $number));
?>
</div>
</div>
<div class="form-group">
<div class="group-controls">
<label class="checkbox" for="force-email-validation">
<input
type="checkbox"
name="force-email-validation"
id="force-email-validation"
value="1"
<?= FreshRSS_Context::$system_conf->force_email_validation ? 'checked="checked"' : '' ?>
data-leave-validation="<?= FreshRSS_Context::$system_conf->force_email_validation ?>"
/>
<?= _t('admin.system.force_email_validation') ?>
</label>
</div>
</div>
<div class="form-group">
<label class="group-name" for="max-feeds"><?= _t('admin.system.max-feeds') ?></label>
<div class="group-controls">
@@ -88,6 +54,51 @@
</div>
</div>
<legend><?= _t('admin.system.registration.title') ?></legend>
<div class="form-group">
<label class="group-name" for="max-registrations-select"><?= _t('admin.system.registration.select.label') ?></label>
<div class="group-controls">
<select class="select-input-changer" name="" data-name="max-registrations">
<option value="1" <?= FreshRSS_Context::$system_conf->limits['max_registrations'] == 1 ? 'selected = "selected"' : ''; ?> data-input-visible="false"><?= _t('admin.system.registration.select.option.noform') ?></option>
<option value="0" <?= FreshRSS_Context::$system_conf->limits['max_registrations'] == 0 ? 'selected = "selected"' : ''; ?> data-input-visible="false"><?= _t('admin.system.registration.select.option.nolimit') ?></option>
<option value="2" <?= FreshRSS_Context::$system_conf->limits['max_registrations'] > 1 ? 'selected = "selected"' : ''; ?> data-input-visible="true"><?= _t('admin.system.registration.select.option.setaccountsnumber') ?></option>
</select>
</div>
</div>
<div class="form-group" id="max-registrations-block">
<label class="group-name" for="max-registrations"><?= _t('admin.system.registration.number') ?></label>
<div class="group-controls">
<?php $number = count(listUsers()); ?>
<input type="number" id="max-registrations-input" name="" value="<?= FreshRSS_Context::$system_conf->limits['max_registrations'] > 1 ? FreshRSS_Context::$system_conf->limits['max_registrations'] : $number + 1; ?>" min="2"
data-leave-validation="<?= FreshRSS_Context::$system_conf->limits['max_registrations'] ?>" data-number="<?= $number ?>"/>
<span id="max-registrations-status-disabled">(= <?= _t('admin.system.registration.status.disabled') ?>)</span><span id="max-registrations-status-enabled">(= <?= _t('admin.system.registration.status.enabled') ?>)</span>
</div>
</div>
<div class="form-group">
<div class="group-controls">
<?= ($number > 1 ? _t('admin.user.numbers', $number) : _t('admin.user.number', $number)); ?>
</div>
</div>
<div class="form-group">
<div class="group-controls">
<label class="checkbox" for="force-email-validation">
<input
type="checkbox"
name="force-email-validation"
id="force-email-validation"
value="1"
<?= FreshRSS_Context::$system_conf->force_email_validation ? 'checked="checked"' : '' ?>
data-leave-validation="<?= FreshRSS_Context::$system_conf->force_email_validation ?>"
/>
<?= _t('admin.system.force_email_validation') ?>
</label>
</div>
</div>
<div class="form-group form-actions">
<div class="group-controls">
<button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
@@ -96,3 +107,5 @@
</div>
</form>
</main>
<script src="../scripts/config.js?<?= @filemtime(PUBLIC_PATH . '/scripts/config.js') ?>"></script>

56
p/scripts/config.js Normal file
View File

@@ -0,0 +1,56 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0
'use strict';
function init_selectInputChanger() {
const select = document.getElementsByClassName('select-input-changer');
for (let i = 0; i < select.length; i++) {
select[i].addEventListener('change', updateSelectInput);
select[i].dispatchEvent(new Event('change', {
bubbles: true,
cancelable: true,
}));
}
}
function updateSelectInput(ev) {
const elem = ev.target;
const formGroup = document.getElementById(elem.dataset.name + '-block');
const input = document.getElementById(elem.dataset.name + '-input');
if (elem.selectedOptions[0].dataset.inputVisible == 'false') {
formGroup.style.display = 'none';
input.name = '';
elem.name = elem.dataset.name;
} else {
formGroup.style.display = '';
input.name = elem.dataset.name;
elem.name = '';
}
}
function init_maxNumbersOfAccountsStatus() {
const input = document.getElementById('max-registrations-input');
if (input) {
input.addEventListener('change', onchange_maxNumbersOfAccounts);
input.dispatchEvent(new Event('change', {
bubbles: true,
cancelable: true,
}));
}
}
function onchange_maxNumbersOfAccounts(ev) {
const elem = ev.target;
if (elem.value > elem.dataset.number) {
document.getElementById('max-registrations-status-disabled').style.display = 'none';
document.getElementById('max-registrations-status-enabled').style.display = '';
} else {
document.getElementById('max-registrations-status-disabled').style.display = '';
document.getElementById('max-registrations-status-enabled').style.display = 'none';
}
}
init_selectInputChanger();
init_maxNumbersOfAccountsStatus();
// @license-end