[frio] Add jotnet fields to compose page
- Move hardcoded descriptions to translation strings
This commit is contained in:
parent
d5efca1171
commit
4f4b538bcf
|
@ -4,9 +4,11 @@ namespace Friendica\Module\Item;
|
||||||
|
|
||||||
use Friendica\BaseModule;
|
use Friendica\BaseModule;
|
||||||
use Friendica\Content\Feature;
|
use Friendica\Content\Feature;
|
||||||
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\Hook;
|
use Friendica\Core\Hook;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\FileTag;
|
use Friendica\Model\FileTag;
|
||||||
use Friendica\Model\Group;
|
use Friendica\Model\Group;
|
||||||
|
@ -50,18 +52,20 @@ class Compose extends BaseModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = User::getById(local_user(), ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'default-location']);
|
$user = User::getById(local_user(), ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'hidewall', 'default-location']);
|
||||||
|
|
||||||
switch ($posttype) {
|
switch ($posttype) {
|
||||||
case Item::PT_PERSONAL_NOTE:
|
case Item::PT_PERSONAL_NOTE:
|
||||||
$compose_title = L10n::t('Compose new personal note');
|
$compose_title = L10n::t('Compose new personal note');
|
||||||
$type = 'note';
|
$type = 'note';
|
||||||
|
$doesFederate = false;
|
||||||
$contact_allow = $a->contact['id'];
|
$contact_allow = $a->contact['id'];
|
||||||
$group_allow = '';
|
$group_allow = '';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$compose_title = L10n::t('Compose new post');
|
$compose_title = L10n::t('Compose new post');
|
||||||
$type = 'post';
|
$type = 'post';
|
||||||
|
$doesFederate = true;
|
||||||
$contact_allow = implode(',', expand_acl($user['allow_cid']));
|
$contact_allow = implode(',', expand_acl($user['allow_cid']));
|
||||||
$group_allow = implode(',', expand_acl($user['allow_gid'])) ?: Group::FOLLOWERS;
|
$group_allow = implode(',', expand_acl($user['allow_gid'])) ?: Group::FOLLOWERS;
|
||||||
break;
|
break;
|
||||||
|
@ -111,6 +115,32 @@ class Compose extends BaseModule
|
||||||
|
|
||||||
$acl = array_merge($acl_groups, $acl_contacts);
|
$acl = array_merge($acl_groups, $acl_contacts);
|
||||||
|
|
||||||
|
$jotnets_fields = [];
|
||||||
|
$mail_enabled = false;
|
||||||
|
$pubmail_enabled = false;
|
||||||
|
if (function_exists('imap_open') && !Config::get('system', 'imap_disabled')) {
|
||||||
|
$mailacct = DBA::selectFirst('mailacct', ['pubmail'], ['`uid` = ? AND `server` != ""', local_user()]);
|
||||||
|
if (DBA::isResult($mailacct)) {
|
||||||
|
$mail_enabled = true;
|
||||||
|
$pubmail_enabled = !empty($mailacct['pubmail']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($user['hidewall'])) {
|
||||||
|
if ($mail_enabled) {
|
||||||
|
$jotnets_fields[] = [
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'field' => [
|
||||||
|
'pubmail_enable',
|
||||||
|
L10n::t('Post to Email'),
|
||||||
|
$pubmail_enabled
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
Hook::callAll('jot_networks', $jotnets_fields);
|
||||||
|
}
|
||||||
|
|
||||||
$jotplugins = '';
|
$jotplugins = '';
|
||||||
Hook::callAll('jot_tool', $jotplugins);
|
Hook::callAll('jot_tool', $jotplugins);
|
||||||
|
|
||||||
|
@ -159,6 +189,11 @@ class Compose extends BaseModule
|
||||||
'$wait' => L10n::t('Please wait'),
|
'$wait' => L10n::t('Please wait'),
|
||||||
'$placeholdertitle' => L10n::t('Set title'),
|
'$placeholdertitle' => L10n::t('Set title'),
|
||||||
'$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t('Categories (comma-separated list)') : ''),
|
'$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t('Categories (comma-separated list)') : ''),
|
||||||
|
'$public_title' => L10n::t('Public'),
|
||||||
|
'$public_desc' => L10n::t('This post will be sent to all your followers and can be seen in the community pages and by anyone with its link.'),
|
||||||
|
'$custom_title' => L10n::t('Custom'),
|
||||||
|
'$custom_desc' => L10n::t('This post will be sent only to the people in the first box, to the exception of the people mentioned in the second box. It won\'t be visible in the community pages nor with its link, and can\'t be sent to connectors (Twitter, Pump.io, etc...).'),
|
||||||
|
'$emailcc' => L10n::t('CC: email addresses'),
|
||||||
'$title' => $title,
|
'$title' => $title,
|
||||||
'$category' => $category,
|
'$category' => $category,
|
||||||
'$body' => $body,
|
'$body' => $body,
|
||||||
|
@ -169,6 +204,8 @@ class Compose extends BaseModule
|
||||||
'$contact_deny' => $contact_deny,
|
'$contact_deny' => $contact_deny,
|
||||||
'$group_deny' => $group_deny,
|
'$group_deny' => $group_deny,
|
||||||
'$jotplugins' => $jotplugins,
|
'$jotplugins' => $jotplugins,
|
||||||
|
'$doesFederate' => $doesFederate,
|
||||||
|
'$jotnets_fields'=> $jotnets_fields,
|
||||||
'$sourceapp' => L10n::t($a->sourcename),
|
'$sourceapp' => L10n::t($a->sourcename),
|
||||||
'$rand_num' => Crypto::randomDigits(12)
|
'$rand_num' => Crypto::randomDigits(12)
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -52,6 +52,14 @@
|
||||||
$contact_allow_input.prop('disabled', true);
|
$contact_allow_input.prop('disabled', true);
|
||||||
$group_deny_input.prop('disabled', true);
|
$group_deny_input.prop('disabled', true);
|
||||||
$contact_deny_input.prop('disabled', true);
|
$contact_deny_input.prop('disabled', true);
|
||||||
|
|
||||||
|
$('.profile-jot-net input[type=checkbox]').each(function() {
|
||||||
|
// Restores checkbox state if it had been saved
|
||||||
|
if ($(this).attr('data-checked') !== undefined) {
|
||||||
|
$(this).prop('checked', $(this).attr('data-checked') === 'true');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('.profile-jot-net input').attr('disabled', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#visibility-custom-panel').on('show.bs.collapse', function() {
|
$('#visibility-custom-panel').on('show.bs.collapse', function() {
|
||||||
|
@ -60,6 +68,14 @@
|
||||||
$contact_allow_input.prop('disabled', false);
|
$contact_allow_input.prop('disabled', false);
|
||||||
$group_deny_input.prop('disabled', false);
|
$group_deny_input.prop('disabled', false);
|
||||||
$contact_deny_input.prop('disabled', false);
|
$contact_deny_input.prop('disabled', false);
|
||||||
|
|
||||||
|
$('.profile-jot-net input[type=checkbox]').each(function() {
|
||||||
|
// Saves current checkbox state
|
||||||
|
$(this)
|
||||||
|
.attr('data-checked', $(this).prop('checked'))
|
||||||
|
.prop('checked', false);
|
||||||
|
});
|
||||||
|
$('.profile-jot-net input').attr('disabled', 'disabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
if (document.querySelector('input[name="visibility"]:checked').value === 'custom') {
|
if (document.querySelector('input[name="visibility"]:checked').value === 'custom') {
|
||||||
|
|
|
@ -83,29 +83,58 @@
|
||||||
<h3>Visibility</h3>
|
<h3>Visibility</h3>
|
||||||
<div class="panel-group" id="visibility-accordion" role="tablist" aria-multiselectable="true">
|
<div class="panel-group" id="visibility-accordion" role="tablist" aria-multiselectable="true">
|
||||||
<div class="panel panel-success">
|
<div class="panel panel-success">
|
||||||
<div class="panel-heading" role="tab" id="visibility-public-heading" class="" role="button" data-toggle="collapse" data-parent="#visibility-accordion" href="#visibility-public-panel" aria-expanded="true" aria-controls="visibility-public-panel">
|
<div class="panel-heading" id="visibility-public-heading" role="button" data-toggle="collapse" data-parent="#visibility-accordion" href="#visibility-public-panel" aria-expanded="true" aria-controls="visibility-public-panel" tabindex="14">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="visibility" id="visibility-public" value="public" {{if $visibility == 'public'}}checked{{/if}} style="display:none">
|
<input type="radio" name="visibility" id="visibility-public" value="public" {{if $visibility == 'public'}}checked{{/if}} style="display:none">
|
||||||
<i class="fa fa-globe"></i> Public
|
<i class="fa fa-globe"></i> {{$public_title}}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div id="visibility-public-panel" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="visibility-public-heading">
|
<div id="visibility-public-panel" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="visibility-public-heading">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<p>This post will be sent to all your followers and can be seen in the community pages and by anyone with its link.</p>
|
<p>{{$public_desc}}</p>
|
||||||
|
{{if $doesFederate}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="profile-jot-email" id="profile-jot-email-label">{{$emailcc}}</label>
|
||||||
|
<input type="text" name="emailcc" id="profile-jot-email" class="form-control" title="{{$emtitle}}" />
|
||||||
|
</div>
|
||||||
|
<div id="profile-jot-email-end"></div>
|
||||||
|
|
||||||
|
{{if $jotnets_fields}}
|
||||||
|
{{if $jotnets_fields|count < 3}}
|
||||||
|
<div class="profile-jot-net">
|
||||||
|
{{else}}
|
||||||
|
<details class="profile-jot-net">
|
||||||
|
<summary>{{$jotnets_summary}}</summary>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{foreach $jotnets_fields as $jotnets_field}}
|
||||||
|
{{if $jotnets_field.type == 'checkbox'}}
|
||||||
|
{{include file="field_checkbox.tpl" field=$jotnets_field.field}}
|
||||||
|
{{elseif $jotnets_field.type == 'select'}}
|
||||||
|
{{include file="field_select.tpl" field=$jotnets_field.field}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
|
{{if $jotnets_fields|count >= 3}}
|
||||||
|
</details>
|
||||||
|
{{else}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel panel-info">
|
<div class="panel panel-info">
|
||||||
<div class="panel-heading" role="tab" id="visibility-custom-heading" class="collapsed" role="button" data-toggle="collapse" data-parent="#visibility-accordion" href="#visibility-custom-panel" aria-expanded="true" aria-controls="visibility-custom-panel">
|
<div class="panel-heading collapsed" id="visibility-custom-heading" role="button" data-toggle="collapse" data-parent="#visibility-accordion" href="#visibility-custom-panel" aria-expanded="true" aria-controls="visibility-custom-panel" tabindex="15">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="visibility" id="visibility-custom" value="custom" {{if $visibility == 'custom'}}checked{{/if}} style="display:none">
|
<input type="radio" name="visibility" id="visibility-custom" value="custom" {{if $visibility == 'custom'}}checked{{/if}} style="display:none">
|
||||||
<i class="fa fa-lock"></i> Custom
|
<i class="fa fa-lock"></i> {{$custom_title}}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div id="visibility-custom-panel" class="panel-collapse collapse" role="tabpanel" aria-labelledby="visibility-custom-heading">
|
<div id="visibility-custom-panel" class="panel-collapse collapse" role="tabpanel" aria-labelledby="visibility-custom-heading">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<p>This post will be sent only to the people in the first box, to the exception of the people mentioned in the second box.
|
<p>{{$custom_desc}}</p>
|
||||||
It won't be visible in the community pages nor with its link.</p>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="acl_allow">Deliver to:</label>
|
<label for="acl_allow">Deliver to:</label>
|
||||||
|
|
Loading…
Reference in a new issue