Merge pull request #14041 from annando/feature-admin

Simplified admin frontend for features
This commit is contained in:
Hypolite Petovan 2024-03-26 07:30:24 -04:00 committed by GitHub
commit 250b3b813c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 80 additions and 78 deletions

View File

@ -37,15 +37,21 @@ class Features extends BaseAdmin
foreach (Feature::get(false) as $fdata) { foreach (Feature::get(false) as $fdata) {
foreach (array_slice($fdata, 1) as $f) { foreach (array_slice($fdata, 1) as $f) {
$feature = $f[0]; $feature = $f[0];
$feature_state = 'feature_' . $feature; switch ($_POST['featureselect_' . $feature]) {
$featurelock = 'featurelock_' . $feature; case 0:
DI::config()->set('feature', $feature, false);
DI::config()->delete('feature_lock', $feature);
break;
DI::config()->set('feature', $feature, !empty($_POST[$feature_state])); case 1:
DI::config()->set('feature', $feature, true);
DI::config()->delete('feature_lock', $feature);
break;
if (!empty($_POST[$featurelock])) { case 2:
DI::config()->set('feature_lock', $feature, true); DI::config()->delete('feature', $feature);
} else { DI::config()->set('feature_lock', $feature, true);
DI::config()->delete('feature_lock', $feature); break;
} }
} }
} }
@ -57,17 +63,15 @@ class Features extends BaseAdmin
{ {
parent::content(); parent::content();
$features = []; $features = [];
$selection = [DI::l10n()->t('No'), DI::l10n()->t('Yes'), DI::l10n()->t('Locked')];
foreach (Feature::get(false) as $fname => $fdata) { foreach (Feature::get(false) as $fname => $fdata) {
$features[$fname] = []; $features[$fname] = [];
$features[$fname][0] = $fdata[0]; $features[$fname][0] = $fdata[0];
foreach (array_slice($fdata, 1) as $f) { foreach (array_slice($fdata, 1) as $f) {
$set = DI::config()->get('feature', $f[0], $f[3]); $set = DI::config()->get('feature', $f[0], $f[3]);
$features[$fname][1][] = [ $selected = $f[4] ? 2 : (int)$set;
['feature_' . $f[0], $f[1], $set, $f[2]], $features[$fname][1][] = ['featureselect_' . $f[0], $f[1], $selected, $f[2], $selection];
['featurelock_' . $f[0], DI::l10n()->t('Lock feature %s', $f[1]), $f[4], '']
];
} }
} }

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 2024.06-dev\n" "Project-Id-Version: 2024.06-dev\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-25 07:19+0000\n" "POT-Creation-Date: 2024-03-25 21:48+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -1654,191 +1654,191 @@ msgstr ""
msgid "Favourite Posts" msgid "Favourite Posts"
msgstr "" msgstr ""
#: src/Content/Feature.php:106 #: src/Content/Feature.php:107
msgid "General Features" msgid "General Features"
msgstr "" msgstr ""
#: src/Content/Feature.php:108 #: src/Content/Feature.php:109
msgid "Photo Location" msgid "Photo Location"
msgstr "" msgstr ""
#: src/Content/Feature.php:108 #: src/Content/Feature.php:109
msgid "" msgid ""
"Photo metadata is normally stripped. This extracts the location (if present) " "Photo metadata is normally stripped. This extracts the location (if present) "
"prior to stripping metadata and links it to a map." "prior to stripping metadata and links it to a map."
msgstr "" msgstr ""
#: src/Content/Feature.php:109 #: src/Content/Feature.php:110
msgid "Display the community in the navigation" msgid "Display the community in the navigation"
msgstr "" msgstr ""
#: src/Content/Feature.php:109 #: src/Content/Feature.php:110
msgid "" msgid ""
"If enabled, the community can be accessed via the navigation menu. " "If enabled, the community can be accessed via the navigation menu. "
"Independant from this setting, the community timelines can always be " "Independant from this setting, the community timelines can always be "
"accessed via the channels." "accessed via the channels."
msgstr "" msgstr ""
#: src/Content/Feature.php:114 #: src/Content/Feature.php:115
msgid "Post Composition Features" msgid "Post Composition Features"
msgstr "" msgstr ""
#: src/Content/Feature.php:115 #: src/Content/Feature.php:116
msgid "Explicit Mentions" msgid "Explicit Mentions"
msgstr "" msgstr ""
#: src/Content/Feature.php:115 #: src/Content/Feature.php:116
msgid "" msgid ""
"Add explicit mentions to comment box for manual control over who gets " "Add explicit mentions to comment box for manual control over who gets "
"mentioned in replies." "mentioned in replies."
msgstr "" msgstr ""
#: src/Content/Feature.php:116 #: src/Content/Feature.php:117
msgid "Add an abstract from ActivityPub content warnings" msgid "Add an abstract from ActivityPub content warnings"
msgstr "" msgstr ""
#: src/Content/Feature.php:116 #: src/Content/Feature.php:117
msgid "" msgid ""
"Add an abstract when commenting on ActivityPub posts with a content warning. " "Add an abstract when commenting on ActivityPub posts with a content warning. "
"Abstracts are displayed as content warning on systems like Mastodon or " "Abstracts are displayed as content warning on systems like Mastodon or "
"Pleroma." "Pleroma."
msgstr "" msgstr ""
#: src/Content/Feature.php:121 #: src/Content/Feature.php:122
msgid "Post/Comment Tools" msgid "Post/Comment Tools"
msgstr "" msgstr ""
#: src/Content/Feature.php:122 #: src/Content/Feature.php:123
msgid "Post Categories" msgid "Post Categories"
msgstr "" msgstr ""
#: src/Content/Feature.php:122 #: src/Content/Feature.php:123
msgid "Add categories to your posts" msgid "Add categories to your posts"
msgstr "" msgstr ""
#: src/Content/Feature.php:127 #: src/Content/Feature.php:128
msgid "Network Widgets" msgid "Network Widgets"
msgstr "" msgstr ""
#: src/Content/Feature.php:128 src/Content/Widget.php:216 #: src/Content/Feature.php:129 src/Content/Widget.php:216
#: src/Model/Circle.php:601 src/Module/Contact.php:400 #: src/Model/Circle.php:601 src/Module/Contact.php:400
#: src/Module/Welcome.php:76 #: src/Module/Welcome.php:76
msgid "Circles" msgid "Circles"
msgstr "" msgstr ""
#: src/Content/Feature.php:128 #: src/Content/Feature.php:129
msgid "" msgid ""
"Display posts that have been created by accounts of the selected circle." "Display posts that have been created by accounts of the selected circle."
msgstr "" msgstr ""
#: src/Content/Feature.php:129 src/Content/GroupManager.php:147 #: src/Content/Feature.php:130 src/Content/GroupManager.php:147
#: src/Content/Nav.php:278 src/Content/Text/HTML.php:881 #: src/Content/Nav.php:278 src/Content/Text/HTML.php:881
#: src/Content/Widget.php:538 src/Model/User.php:1385 #: src/Content/Widget.php:538 src/Model/User.php:1385
msgid "Groups" msgid "Groups"
msgstr "" msgstr ""
#: src/Content/Feature.php:129 #: src/Content/Feature.php:130
msgid "Display posts that have been distributed by the selected group." msgid "Display posts that have been distributed by the selected group."
msgstr "" msgstr ""
#: src/Content/Feature.php:130 src/Content/Widget.php:507 #: src/Content/Feature.php:131 src/Content/Widget.php:507
msgid "Archives" msgid "Archives"
msgstr "" msgstr ""
#: src/Content/Feature.php:130 #: src/Content/Feature.php:131
msgid "Display an archive where posts can be selected by month and year." msgid "Display an archive where posts can be selected by month and year."
msgstr "" msgstr ""
#: src/Content/Feature.php:131 src/Content/Widget.php:289 #: src/Content/Feature.php:132 src/Content/Widget.php:289
msgid "Protocols" msgid "Protocols"
msgstr "" msgstr ""
#: src/Content/Feature.php:131 #: src/Content/Feature.php:132
msgid "Display posts with the selected protocols." msgid "Display posts with the selected protocols."
msgstr "" msgstr ""
#: src/Content/Feature.php:132 src/Content/Widget.php:544 #: src/Content/Feature.php:133 src/Content/Widget.php:544
#: src/Module/Settings/Account.php:442 #: src/Module/Settings/Account.php:442
msgid "Account Types" msgid "Account Types"
msgstr "" msgstr ""
#: src/Content/Feature.php:132 #: src/Content/Feature.php:133
msgid "Display posts done by accounts with the selected account type." msgid "Display posts done by accounts with the selected account type."
msgstr "" msgstr ""
#: src/Content/Feature.php:133 src/Content/Widget.php:593 #: src/Content/Feature.php:134 src/Content/Widget.php:593
#: src/Module/Admin/Site.php:474 src/Module/BaseSettings.php:125 #: src/Module/Admin/Site.php:474 src/Module/BaseSettings.php:125
#: src/Module/Settings/Channels.php:219 src/Module/Settings/Display.php:318 #: src/Module/Settings/Channels.php:219 src/Module/Settings/Display.php:318
msgid "Channels" msgid "Channels"
msgstr "" msgstr ""
#: src/Content/Feature.php:133 #: src/Content/Feature.php:134
msgid "Display posts in the system channels and user defined channels." msgid "Display posts in the system channels and user defined channels."
msgstr "" msgstr ""
#: src/Content/Feature.php:134 src/Content/Widget/SavedSearches.php:60 #: src/Content/Feature.php:135 src/Content/Widget/SavedSearches.php:60
msgid "Saved Searches" msgid "Saved Searches"
msgstr "" msgstr ""
#: src/Content/Feature.php:134 #: src/Content/Feature.php:135
msgid "Display posts that contain subscribed hashtags." msgid "Display posts that contain subscribed hashtags."
msgstr "" msgstr ""
#: src/Content/Feature.php:135 src/Content/Widget.php:319 #: src/Content/Feature.php:136 src/Content/Widget.php:319
msgid "Saved Folders" msgid "Saved Folders"
msgstr "" msgstr ""
#: src/Content/Feature.php:135 #: src/Content/Feature.php:136
msgid "Display a list of folders in which posts are stored." msgid "Display a list of folders in which posts are stored."
msgstr "" msgstr ""
#: src/Content/Feature.php:136 src/Module/Conversation/Timeline.php:196 #: src/Content/Feature.php:137 src/Module/Conversation/Timeline.php:196
msgid "Own Contacts" msgid "Own Contacts"
msgstr "" msgstr ""
#: src/Content/Feature.php:136 #: src/Content/Feature.php:137
msgid "" msgid ""
"Include or exclude posts from subscribed accounts. This widget is not " "Include or exclude posts from subscribed accounts. This widget is not "
"visible on all channels." "visible on all channels."
msgstr "" msgstr ""
#: src/Content/Feature.php:137 #: src/Content/Feature.php:138
msgid "Trending Tags" msgid "Trending Tags"
msgstr "" msgstr ""
#: src/Content/Feature.php:137 #: src/Content/Feature.php:138
msgid "Display a list of the most popular tags in recent public posts." msgid "Display a list of the most popular tags in recent public posts."
msgstr "" msgstr ""
#: src/Content/Feature.php:142 #: src/Content/Feature.php:143
msgid "Advanced Profile Settings" msgid "Advanced Profile Settings"
msgstr "" msgstr ""
#: src/Content/Feature.php:143 #: src/Content/Feature.php:144
msgid "Tag Cloud" msgid "Tag Cloud"
msgstr "" msgstr ""
#: src/Content/Feature.php:143 #: src/Content/Feature.php:144
msgid "Provide a personal tag cloud on your profile page" msgid "Provide a personal tag cloud on your profile page"
msgstr "" msgstr ""
#: src/Content/Feature.php:144 #: src/Content/Feature.php:145
msgid "Display Membership Date" msgid "Display Membership Date"
msgstr "" msgstr ""
#: src/Content/Feature.php:144 #: src/Content/Feature.php:145
msgid "Display membership date in profile" msgid "Display membership date in profile"
msgstr "" msgstr ""
#: src/Content/Feature.php:149 #: src/Content/Feature.php:150
msgid "Advanced Calendar Settings" msgid "Advanced Calendar Settings"
msgstr "" msgstr ""
#: src/Content/Feature.php:150 #: src/Content/Feature.php:151
msgid "Allow anonymous access to your calendar" msgid "Allow anonymous access to your calendar"
msgstr "" msgstr ""
#: src/Content/Feature.php:150 #: src/Content/Feature.php:151
msgid "" msgid ""
"Allows anonymous visitors to consult your calendar and your public events. " "Allows anonymous visitors to consult your calendar and your public events. "
"Contact birthday events are private to you." "Contact birthday events are private to you."
@ -4038,7 +4038,7 @@ msgstr ""
msgid "Addon %s failed to install." msgid "Addon %s failed to install."
msgstr "" msgstr ""
#: src/Module/Admin/Addons/Index.php:69 src/Module/Admin/Features.php:80 #: src/Module/Admin/Addons/Index.php:69 src/Module/Admin/Features.php:83
#: src/Module/Admin/Logs/Settings.php:87 src/Module/Admin/Site.php:460 #: src/Module/Admin/Logs/Settings.php:87 src/Module/Admin/Site.php:460
#: src/Module/Admin/Themes/Index.php:113 src/Module/Admin/Tos.php:86 #: src/Module/Admin/Themes/Index.php:113 src/Module/Admin/Tos.php:86
#: src/Module/Settings/Account.php:551 src/Module/Settings/Addons.php:78 #: src/Module/Settings/Account.php:551 src/Module/Settings/Addons.php:78
@ -4120,12 +4120,25 @@ msgstr ""
msgid "Attempt to execute this update step automatically" msgid "Attempt to execute this update step automatically"
msgstr "" msgstr ""
#: src/Module/Admin/Features.php:69 #: src/Module/Admin/Features.php:67
#, php-format #: src/Module/Notifications/Introductions.php:144
msgid "Lock feature %s" #: src/Module/OAuth/Acknowledge.php:55 src/Module/Register.php:132
#: src/Module/Settings/TwoFactor/Trusted.php:129
msgid "No"
msgstr "" msgstr ""
#: src/Module/Admin/Features.php:78 #: src/Module/Admin/Features.php:67 src/Module/Contact/Revoke.php:108
#: src/Module/Notifications/Introductions.php:144
#: src/Module/OAuth/Acknowledge.php:54 src/Module/Register.php:131
#: src/Module/Settings/TwoFactor/Trusted.php:129
msgid "Yes"
msgstr ""
#: src/Module/Admin/Features.php:67
msgid "Locked"
msgstr ""
#: src/Module/Admin/Features.php:81
msgid "Manage Additional Features" msgid "Manage Additional Features"
msgstr "" msgstr ""
@ -7058,13 +7071,6 @@ msgid ""
"and they will have to manually follow you back again." "and they will have to manually follow you back again."
msgstr "" msgstr ""
#: src/Module/Contact/Revoke.php:108
#: src/Module/Notifications/Introductions.php:144
#: src/Module/OAuth/Acknowledge.php:54 src/Module/Register.php:131
#: src/Module/Settings/TwoFactor/Trusted.php:129
msgid "Yes"
msgstr ""
#: src/Module/Contact/Suggestions.php:62 #: src/Module/Contact/Suggestions.php:62
msgid "" msgid ""
"No suggestions available. If this is a new site, please try again in 24 " "No suggestions available. If this is a new site, please try again in 24 "
@ -8833,12 +8839,6 @@ msgstr ""
msgid "Claims to be known to you: " msgid "Claims to be known to you: "
msgstr "" msgstr ""
#: src/Module/Notifications/Introductions.php:144
#: src/Module/OAuth/Acknowledge.php:55 src/Module/Register.php:132
#: src/Module/Settings/TwoFactor/Trusted.php:129
msgid "No"
msgstr ""
#: src/Module/Notifications/Introductions.php:152 #: src/Module/Notifications/Introductions.php:152
msgid "Shall your connection be bidirectional or not?" msgid "Shall your connection be bidirectional or not?"
msgstr "" msgstr ""

View File

@ -10,8 +10,7 @@
<div class="settings-content-block"> <div class="settings-content-block">
{{foreach $f.1 as $fcat}} {{foreach $f.1 as $fcat}}
<div class="settings-block"> <div class="settings-block">
{{include file="field_checkbox.tpl" field=$fcat.0}} {{include file="field_select.tpl" field=$fcat}}
{{include file="field_checkbox.tpl" field=$fcat.1}}
</div> </div>
{{/foreach}} {{/foreach}}

View File

@ -17,8 +17,7 @@
<div class="panel-body"> <div class="panel-body">
{{foreach $f.1 as $fcat}} {{foreach $f.1 as $fcat}}
<div class="settings-block"> <div class="settings-block">
{{include file="field_checkbox.tpl" field=$fcat.0}} {{include file="field_select.tpl" field=$fcat}}
{{include file="field_checkbox.tpl" field=$fcat.1}}
</div> </div>
{{/foreach}} {{/foreach}}
</div> </div>