Merge pull request #8243 from MrPetovan/task/8238-cleanup-yesno
Cleanup after yesno field removal
This commit is contained in:
commit
79d766b552
|
@ -73,7 +73,6 @@ Optional. Depends on which 'type' this option is:
|
|||
- 'select': array `[ value => label ]` of choices
|
||||
- 'intcheckbox': value of input element
|
||||
- 'select_raw': prebuild html string of `<option >` tags
|
||||
- 'yesno': array `[ 'label no', 'label yes']`
|
||||
|
||||
Each label should be translatable
|
||||
|
||||
|
|
|
@ -640,7 +640,7 @@ function dfrn_request_content(App $a)
|
|||
'$header' => DI::l10n()->t('Friend/Connection Request'),
|
||||
'$desc' => DI::l10n()->t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@gnusocial.de'),
|
||||
'$pls_answer' => DI::l10n()->t('Please answer the following:'),
|
||||
'$does_know_you' => ['knowyou', DI::l10n()->t('Does %s know you?', $a->profile['name']), false, '', [DI::l10n()->t('No'), DI::l10n()->t('Yes')]],
|
||||
'$does_know_you' => ['knowyou', DI::l10n()->t('Does %s know you?', $a->profile['name'])],
|
||||
'$add_note' => DI::l10n()->t('Add a personal note:'),
|
||||
'$page_desc' => $page_desc,
|
||||
'$friendica' => DI::l10n()->t('Friendica'),
|
||||
|
|
|
@ -165,7 +165,7 @@ function follow_content(App $a)
|
|||
'$header' => DI::l10n()->t('Connect/Follow'),
|
||||
'$desc' => '',
|
||||
'$pls_answer' => DI::l10n()->t('Please answer the following:'),
|
||||
'$does_know_you' => ['knowyou', DI::l10n()->t('Does %s know you?', $ret['name']), false, '', [DI::l10n()->t('No'), DI::l10n()->t('Yes')]],
|
||||
'$does_know_you' => ['knowyou', DI::l10n()->t('Does %s know you?', $ret['name'])],
|
||||
'$add_note' => DI::l10n()->t('Add a personal note:'),
|
||||
'$page_desc' => '',
|
||||
'$friendica' => '',
|
||||
|
|
|
@ -1081,40 +1081,40 @@ function settings_content(App $a)
|
|||
$profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
|
||||
} else {
|
||||
$profile_in_dir = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['profile_in_directory', DI::l10n()->t('Publish your default profile in your local site directory?'), $profile['publish'], DI::l10n()->t('Your profile will be published in this node\'s <a href="%s">local directory</a>. Your profile details may be publicly visible depending on the system settings.', DI::baseUrl().'/directory'), [DI::l10n()->t('No'), DI::l10n()->t('Yes')]]
|
||||
'$field' => ['profile_in_directory', DI::l10n()->t('Publish your default profile in your local site directory?'), $profile['publish'], DI::l10n()->t('Your profile will be published in this node\'s <a href="%s">local directory</a>. Your profile details may be publicly visible depending on the system settings.', DI::baseUrl().'/directory')]
|
||||
]);
|
||||
}
|
||||
|
||||
if (strlen(DI::config()->get('system', 'directory'))) {
|
||||
$profile_in_net_dir = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['profile_in_netdirectory', DI::l10n()->t('Publish your default profile in the global social directory?'), $profile['net-publish'], DI::l10n()->t('Your profile will be published in the global friendica directories (e.g. <a href="%s">%s</a>). Your profile will be visible in public.', DI::config()->get('system', 'directory'), DI::config()->get('system', 'directory')) . " " . DI::l10n()->t("This setting also determines whether Friendica will inform search engines that your profile should be indexed or not. Third-party search engines may or may not respect this setting."), [DI::l10n()->t('No'), DI::l10n()->t('Yes')]]
|
||||
'$field' => ['profile_in_netdirectory', DI::l10n()->t('Publish your default profile in the global social directory?'), $profile['net-publish'], DI::l10n()->t('Your profile will be published in the global friendica directories (e.g. <a href="%s">%s</a>). Your profile will be visible in public.', DI::config()->get('system', 'directory'), DI::config()->get('system', 'directory')) . " " . DI::l10n()->t("This setting also determines whether Friendica will inform search engines that your profile should be indexed or not. Third-party search engines may or may not respect this setting.")]
|
||||
]);
|
||||
} else {
|
||||
$profile_in_net_dir = '';
|
||||
}
|
||||
|
||||
$hide_friends = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['hide-friends', DI::l10n()->t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], DI::l10n()->t('Your contact list won\'t be shown in your default profile page. You can decide to show your contact list separately for each additional profile you create'), [DI::l10n()->t('No'), DI::l10n()->t('Yes')]],
|
||||
'$field' => ['hide-friends', DI::l10n()->t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], DI::l10n()->t('Your contact list won\'t be shown in your default profile page. You can decide to show your contact list separately for each additional profile you create')],
|
||||
]);
|
||||
|
||||
$hide_wall = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['hidewall', DI::l10n()->t('Hide your profile details from anonymous viewers?'), $a->user['hidewall'], DI::l10n()->t('Anonymous visitors will only see your profile picture, your display name and the nickname you are using on your profile page. Your public posts and replies will still be accessible by other means.'), [DI::l10n()->t('No'), DI::l10n()->t('Yes')]],
|
||||
'$field' => ['hidewall', DI::l10n()->t('Hide your profile details from anonymous viewers?'), $a->user['hidewall'], DI::l10n()->t('Anonymous visitors will only see your profile picture, your display name and the nickname you are using on your profile page. Your public posts and replies will still be accessible by other means.')],
|
||||
]);
|
||||
|
||||
$blockwall = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['blockwall', DI::l10n()->t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), DI::l10n()->t('Your contacts may write posts on your profile wall. These posts will be distributed to your contacts'), [DI::l10n()->t('No'), DI::l10n()->t('Yes')]],
|
||||
'$field' => ['blockwall', DI::l10n()->t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), DI::l10n()->t('Your contacts may write posts on your profile wall. These posts will be distributed to your contacts')],
|
||||
]);
|
||||
|
||||
$blocktags = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['blocktags', DI::l10n()->t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), DI::l10n()->t('Your contacts can add additional tags to your posts.'), [DI::l10n()->t('No'), DI::l10n()->t('Yes')]],
|
||||
'$field' => ['blocktags', DI::l10n()->t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), DI::l10n()->t('Your contacts can add additional tags to your posts.')],
|
||||
]);
|
||||
|
||||
$suggestme = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['suggestme', DI::l10n()->t('Allow us to suggest you as a potential friend to new members?'), $suggestme, DI::l10n()->t('If you like, Friendica may suggest new members to add you as a contact.'), [DI::l10n()->t('No'), DI::l10n()->t('Yes')]],
|
||||
'$field' => ['suggestme', DI::l10n()->t('Allow us to suggest you as a potential friend to new members?'), $suggestme, DI::l10n()->t('If you like, Friendica may suggest new members to add you as a contact.')],
|
||||
]);
|
||||
|
||||
$unkmail = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['unkmail', DI::l10n()->t('Permit unknown people to send you private mail?'), $unkmail, DI::l10n()->t('Friendica network users may send you private messages even if they are not in your contact list.'), [DI::l10n()->t('No'), DI::l10n()->t('Yes')]],
|
||||
'$field' => ['unkmail', DI::l10n()->t('Permit unknown people to send you private mail?'), $unkmail, DI::l10n()->t('Friendica network users may send you private messages even if they are not in your contact list.')],
|
||||
]);
|
||||
|
||||
if (!$profile['publish'] && !$profile['net-publish']) {
|
||||
|
@ -1134,11 +1134,11 @@ function settings_content(App $a)
|
|||
'days' => ['expire', DI::l10n()->t("Automatically expire posts after this many days:"), $expire, DI::l10n()->t('If empty, posts will not expire. Expired posts will be deleted')],
|
||||
'advanced' => DI::l10n()->t('Advanced expiration settings'),
|
||||
'label' => DI::l10n()->t('Advanced Expiration'),
|
||||
'items' => ['expire_items', DI::l10n()->t("Expire posts:"), $expire_items, '', [DI::l10n()->t('No'), DI::l10n()->t('Yes')]],
|
||||
'notes' => ['expire_notes', DI::l10n()->t("Expire personal notes:"), $expire_notes, '', [DI::l10n()->t('No'), DI::l10n()->t('Yes')]],
|
||||
'starred' => ['expire_starred', DI::l10n()->t("Expire starred posts:"), $expire_starred, '', [DI::l10n()->t('No'), DI::l10n()->t('Yes')]],
|
||||
'photos' => ['expire_photos', DI::l10n()->t("Expire photos:"), $expire_photos, '', [DI::l10n()->t('No'), DI::l10n()->t('Yes')]],
|
||||
'network_only' => ['expire_network_only', DI::l10n()->t("Only expire posts by others:"), $expire_network_only, '', [DI::l10n()->t('No'), DI::l10n()->t('Yes')]],
|
||||
'items' => ['expire_items', DI::l10n()->t("Expire posts:"), $expire_items],
|
||||
'notes' => ['expire_notes', DI::l10n()->t("Expire personal notes:"), $expire_notes],
|
||||
'starred' => ['expire_starred', DI::l10n()->t("Expire starred posts:"), $expire_starred],
|
||||
'photos' => ['expire_photos', DI::l10n()->t("Expire photos:"), $expire_photos],
|
||||
'network_only' => ['expire_network_only', DI::l10n()->t("Only expire posts by others:"), $expire_network_only],
|
||||
];
|
||||
|
||||
$group_select = Group::displayGroupSelection(local_user(), $a->user['def_gid']);
|
||||
|
|
|
@ -63,7 +63,7 @@ interface IStorage
|
|||
* 'type', // define the field used in form, and the type of data.
|
||||
* // one of 'checkbox', 'combobox', 'custom', 'datetime',
|
||||
* // 'input', 'intcheckbox', 'password', 'radio', 'richtext'
|
||||
* // 'select', 'select_raw', 'textarea', 'yesno'
|
||||
* // 'select', 'select_raw', 'textarea'
|
||||
*
|
||||
* 'label', // Translatable label of the field
|
||||
* 'value', // Current value
|
||||
|
@ -72,7 +72,6 @@ interface IStorage
|
|||
* // select: array [ value => label ] of choices
|
||||
* // intcheckbox: value of input element
|
||||
* // select_raw: prebuild html string of < option > tags
|
||||
* // yesno: array [ 'label no', 'label yes']
|
||||
* ]
|
||||
*
|
||||
* See https://github.com/friendica/friendica/wiki/Quick-Template-Guide
|
||||
|
|
|
@ -556,6 +556,13 @@ class Site extends BaseAdmin
|
|||
if (!is_null($current_storage_backend) && $current_storage_backend != '') {
|
||||
foreach ($current_storage_backend->getOptions() as $name => $info) {
|
||||
$type = $info[0];
|
||||
// Backward compatibilty with yesno field description
|
||||
if ($type == 'yesno') {
|
||||
$type = 'checkbox';
|
||||
// Remove translated labels Yes No from field info
|
||||
unset($info[4]);
|
||||
}
|
||||
|
||||
$info[0] = $storage_form_prefix . '_' . $name;
|
||||
$info['type'] = $type;
|
||||
$info['field'] = 'field_' . $type . '.tpl';
|
||||
|
|
|
@ -97,7 +97,7 @@ class Introductions extends BaseNotifications
|
|||
default:
|
||||
if ($notification->getNetwork() === Protocol::DFRN) {
|
||||
$lbl_knowyou = DI::l10n()->t('Claims to be known to you: ');
|
||||
$knowyou = ($notification->getKnowYou() ? DI::l10n()->t('yes') : DI::l10n()->t('no'));
|
||||
$knowyou = ($notification->getKnowYou() ? DI::l10n()->t('Yes') : DI::l10n()->t('No'));
|
||||
} else {
|
||||
$lbl_knowyou = '';
|
||||
$knowyou = '';
|
||||
|
|
|
@ -215,12 +215,10 @@ class Index extends BaseSettings
|
|||
|
||||
$opt_tpl = Renderer::getMarkupTemplate('settings/profile/hide-friends.tpl');
|
||||
$hide_friends = Renderer::replaceMacros($opt_tpl, [
|
||||
'$yesno' => [
|
||||
'$hide_friends' => [
|
||||
'hide-friends', //Name
|
||||
DI::l10n()->t('Hide contacts and friends:'), //Label
|
||||
!!$profile['hide-friends'], //Value
|
||||
'', //Help string
|
||||
[DI::l10n()->t('No'), DI::l10n()->t('Yes')] //Off - On strings
|
||||
],
|
||||
'$desc' => DI::l10n()->t('Hide your contact/friend list from viewers of this profile?'),
|
||||
'$yes_str' => DI::l10n()->t('Yes'),
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<div id="profile-edit-hide-friends-wrapper">
|
||||
{{include file="field_checkbox.tpl" field=$yesno}}
|
||||
{{include file="field_checkbox.tpl" field=$hide_friends}}
|
||||
</div>
|
||||
|
|
|
@ -133,47 +133,34 @@
|
|||
{{include file="field_checkbox.tpl" field=$desktop_notifications}}
|
||||
<script>
|
||||
(function(){
|
||||
var elm = $("#id_{{$desktop_notifications.0}}_onoff");
|
||||
var ckbox = $("#id_{{$desktop_notifications.0}}");
|
||||
let $notificationField = $("#div_id_{{$desktop_notifications.0}}");
|
||||
let $notificationCheckbox = $("#id_{{$desktop_notifications.0}}");
|
||||
|
||||
if (getNotificationPermission() === 'granted') {
|
||||
ckbox.val(1);
|
||||
elm.find(".off").addClass("hidden");
|
||||
elm.find(".on").removeClass("hidden");
|
||||
}
|
||||
if (getNotificationPermission() === 'granted') {
|
||||
$notificationCheckbox.prop('checked', true);
|
||||
}
|
||||
if (getNotificationPermission() === null) {
|
||||
elm.parent(".field.yesno").hide();
|
||||
$notificationField.hide();
|
||||
}
|
||||
|
||||
$("#id_{{$desktop_notifications.0}}_onoff").on("click", function(e){
|
||||
$notificationCheckbox.on('change', function(e) {
|
||||
if (Notification.permission === 'granted') {
|
||||
localStorage.setItem('notification-permissions', $notificationCheckbox.prop('checked') ? 'granted' : 'denied');
|
||||
} else if (Notification.permission === 'denied') {
|
||||
localStorage.setItem('notification-permissions', 'denied');
|
||||
|
||||
if (Notification.permission === 'granted') {
|
||||
localStorage.setItem('notification-permissions', ckbox.val()==1 ? 'granted' : 'denied');
|
||||
} else if (Notification.permission === 'denied') {
|
||||
localStorage.setItem('notification-permissions', 'denied');
|
||||
|
||||
ckbox.val(0);
|
||||
elm.find(".on").addClass("hidden");
|
||||
elm.find(".off").removeClass("hidden");
|
||||
|
||||
} else if (Notification.permission === 'default') {
|
||||
Notification.requestPermission(function(choice) {
|
||||
if (choice === 'granted') {
|
||||
localStorage.setItem('notification-permissions', ckbox.val()==1 ? 'granted' : 'denied');
|
||||
|
||||
} else {
|
||||
localStorage.setItem('notification-permissions', 'denied');
|
||||
ckbox.val(0);
|
||||
elm.find(".on").addClass("hidden");
|
||||
elm.find(".off").removeClass("hidden");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//console.log(getNotificationPermission());
|
||||
|
||||
|
||||
})
|
||||
$notificationCheckbox.prop('checked', false);
|
||||
} else if (Notification.permission === 'default') {
|
||||
Notification.requestPermission(function(choice) {
|
||||
if (choice === 'granted') {
|
||||
localStorage.setItem('notification-permissions', $notificationCheckbox.prop('checked') ? 'granted' : 'denied');
|
||||
} else {
|
||||
localStorage.setItem('notification-permissions', 'denied');
|
||||
$notificationCheckbox.prop('checked', false);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
})();
|
||||
</script>
|
||||
|
||||
|
|
|
@ -195,44 +195,33 @@
|
|||
{{include file="field_checkbox.tpl" field=$desktop_notifications}}
|
||||
<script type="text/javascript">
|
||||
(function(){
|
||||
var elm = $("#id_{{$desktop_notifications.0}}_onoff");
|
||||
var ckbox = $("#id_{{$desktop_notifications.0}}");
|
||||
let $notificationField = $("#div_id_{{$desktop_notifications.0}}");
|
||||
let $notificationCheckbox = $("#id_{{$desktop_notifications.0}}");
|
||||
|
||||
if (getNotificationPermission() === 'granted') {
|
||||
ckbox.val(1);
|
||||
elm.find(".off").addClass("hidden");
|
||||
elm.find(".on").removeClass("hidden");
|
||||
$notificationCheckbox.prop('checked', true);
|
||||
}
|
||||
if (getNotificationPermission() === null) {
|
||||
elm.parent(".field.yesno").hide();
|
||||
$notificationField.hide();
|
||||
}
|
||||
|
||||
$("#id_{{$desktop_notifications.0}}_onoff").on("click", function(e){
|
||||
|
||||
$notificationCheckbox.on('change', function(e){
|
||||
if (Notification.permission === 'granted') {
|
||||
localStorage.setItem('notification-permissions', ckbox.val()==1 ? 'granted' : 'denied');
|
||||
localStorage.setItem('notification-permissions', $notificationCheckbox.prop('checked') ? 'granted' : 'denied');
|
||||
} else if (Notification.permission === 'denied') {
|
||||
localStorage.setItem('notification-permissions', 'denied');
|
||||
|
||||
ckbox.val(0);
|
||||
elm.find(".on").addClass("hidden");
|
||||
elm.find(".off").removeClass("hidden");
|
||||
|
||||
$notificationCheckbox.prop('checked', false);
|
||||
} else if (Notification.permission === 'default') {
|
||||
Notification.requestPermission(function(choice) {
|
||||
if (choice === 'granted') {
|
||||
localStorage.setItem('notification-permissions', ckbox.val()==1 ? 'granted' : 'denied');
|
||||
|
||||
localStorage.setItem('notification-permissions', $notificationCheckbox.prop('checked') ? 'granted' : 'denied');
|
||||
} else {
|
||||
localStorage.setItem('notification-permissions', 'denied');
|
||||
ckbox.val(0);
|
||||
elm.find(".on").addClass("hidden");
|
||||
elm.find(".off").removeClass("hidden");
|
||||
$notificationCheckbox.prop('checked', false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//console.log(getNotificationPermission());
|
||||
})
|
||||
})();
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue