Add connector collapsible panel in permission
- Replace HTML string by structured array in jot_networks hook - Add collapsed panel when there are more than two connectors
This commit is contained in:
parent
76414a5169
commit
898f7e7e38
|
@ -266,14 +266,12 @@ class ACL extends BaseObject
|
||||||
$default_permissions = self::getDefaultUserPermissions($user);
|
$default_permissions = self::getDefaultUserPermissions($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
$jotnets = '';
|
$jotnets_fields = [];
|
||||||
if ($show_jotnets) {
|
if ($show_jotnets) {
|
||||||
$imap_disabled = !function_exists('imap_open') || Config::get('system', 'imap_disabled');
|
|
||||||
|
|
||||||
$mail_enabled = false;
|
$mail_enabled = false;
|
||||||
$pubmail_enabled = false;
|
$pubmail_enabled = false;
|
||||||
|
|
||||||
if (!$imap_disabled) {
|
if (function_exists('imap_open') && !Config::get('system', 'imap_disabled')) {
|
||||||
$mailacct = DBA::selectFirst('mailacct', ['pubmail'], ['`uid` = ? AND `server` != ""', local_user()]);
|
$mailacct = DBA::selectFirst('mailacct', ['pubmail'], ['`uid` = ? AND `server` != ""', local_user()]);
|
||||||
if (DBA::isResult($mailacct)) {
|
if (DBA::isResult($mailacct)) {
|
||||||
$mail_enabled = true;
|
$mail_enabled = true;
|
||||||
|
@ -283,17 +281,20 @@ class ACL extends BaseObject
|
||||||
|
|
||||||
if (empty($default_permissions['hidewall'])) {
|
if (empty($default_permissions['hidewall'])) {
|
||||||
if ($mail_enabled) {
|
if ($mail_enabled) {
|
||||||
$selected = $pubmail_enabled ? ' checked="checked"' : '';
|
$jotnets_fields[] = [
|
||||||
$jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> ' . L10n::t("Post to Email") . '</div>';
|
'type' => 'checkbox',
|
||||||
|
'field' => [
|
||||||
|
'pubmail_enable',
|
||||||
|
L10n::t('Post to Email'),
|
||||||
|
$pubmail_enabled
|
||||||
|
]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
Hook::callAll('jot_networks', $jotnets);
|
Hook::callAll('jot_networks', $jotnets_fields);
|
||||||
} else {
|
|
||||||
$jotnets .= L10n::t('Connectors disabled, since "%s" is enabled.',
|
|
||||||
L10n::t('Hide your profile details from unknown viewers?'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tpl = Renderer::getMarkupTemplate('acl_selector.tpl');
|
$tpl = Renderer::getMarkupTemplate('acl_selector.tpl');
|
||||||
$o = Renderer::replaceMacros($tpl, [
|
$o = Renderer::replaceMacros($tpl, [
|
||||||
'$showall' => L10n::t('Visible to everybody'),
|
'$showall' => L10n::t('Visible to everybody'),
|
||||||
|
@ -306,7 +307,10 @@ class ACL extends BaseObject
|
||||||
'$networks' => $show_jotnets,
|
'$networks' => $show_jotnets,
|
||||||
'$emailcc' => L10n::t('CC: email addresses'),
|
'$emailcc' => L10n::t('CC: email addresses'),
|
||||||
'$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),
|
'$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),
|
||||||
'$jotnets' => $jotnets,
|
'$jotnets_enabled' => empty($default_permissions['hidewall']),
|
||||||
|
'$jotnets_summary' => L10n::t('Connectors'),
|
||||||
|
'$jotnets_fields' => $jotnets_fields,
|
||||||
|
'$jotnets_disabled_label' => L10n::t('Connectors disabled, since "%s" is enabled.', L10n::t('Hide your profile details from unknown viewers?')),
|
||||||
'$aclModalTitle' => L10n::t('Permissions'),
|
'$aclModalTitle' => L10n::t('Permissions'),
|
||||||
'$aclModalDismiss' => L10n::t('Close'),
|
'$aclModalDismiss' => L10n::t('Close'),
|
||||||
'$features' => [
|
'$features' => [
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
/* General style rules .*/
|
/* General style rules .*/
|
||||||
.pull-right { float: right }
|
.pull-right { float: right }
|
||||||
|
|
||||||
|
details > summary {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
/* General designing elements */
|
/* General designing elements */
|
||||||
.btn {
|
.btn {
|
||||||
outline: none;
|
outline: none;
|
||||||
|
|
|
@ -19,9 +19,30 @@
|
||||||
<hr style="clear:both"/>
|
<hr style="clear:both"/>
|
||||||
<div id="profile-jot-email-label">{{$emailcc}}</div><input type="text" name="emailcc" id="profile-jot-email" title="{{$emtitle}}" />
|
<div id="profile-jot-email-label">{{$emailcc}}</div><input type="text" name="emailcc" id="profile-jot-email" title="{{$emtitle}}" />
|
||||||
<div id="profile-jot-email-end"></div>
|
<div id="profile-jot-email-end"></div>
|
||||||
{{if $jotnets}}
|
|
||||||
{{$jotnets nofilter}}
|
{{if $jotnets_fields}}
|
||||||
{{/if}}{{/if}}
|
{{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}}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
|
@ -26,9 +26,29 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="profile-jot-email-end"></div>
|
<div id="profile-jot-email-end"></div>
|
||||||
|
|
||||||
{{if $jotnets}}
|
{{if $jotnets_fields}}
|
||||||
{{$jotnets nofilter}}
|
{{if $jotnets_fields|count < 3}}
|
||||||
{{/if}}{{/if}}
|
<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}}
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user