show inherited state in Connection Default Permissions

This commit is contained in:
Mario Vavti 2015-07-15 14:03:34 +02:00
parent 5487b22dd7
commit 0c77a127f2
3 changed files with 15 additions and 7 deletions

View file

@ -644,13 +644,17 @@ function connedit_content(&$a) {
foreach($global_perms as $k => $v) {
$thisperm = (($contact['abook_my_perms'] & $v[1]) ? "1" : '');
$checkinherited = ((($channel[$v[0]]) && ($channel[$v[0]] != PERMS_SPECIFIC)) ? "1" : '');
// For auto permissions (when $self is true) we don't want to look at existing
// permissions because they are enabled for the channel owner
if((! $self) && ($existing[$k]))
$thisperm = "1";
$perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC || $self) ? '' : '1'), $v[4]);
$perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC) ? '' : '1'), $v[4], $checkinherited);
}
$o .= replace_macros($tpl,array(
@ -661,7 +665,7 @@ function connedit_content(&$a) {
'$addr_text' => t('This connection\'s address is'),
'$notself' => (($self) ? '' : '1'),
'$self' => (($self) ? '1' : ''),
'$autolbl' => t('Apply the permissions indicated on this page to all new connections.'),
'$autolbl' => t('The permissions indicated on this page will be applied to all new connections.'),
'$buttons' => (($self) ? '' : $buttons),
'$lbl_slider' => t('Slide to adjust your degree of friendship'),
'$lbl_rating' => t('Rating'),
@ -693,6 +697,7 @@ function connedit_content(&$a) {
'$perms' => $perms,
'$permlbl' => t('Individual Permissions'),
'$permnote' => t('Some permissions may be inherited from your channel\'s <a href="settings"><strong>privacy settings</strong></a>, which have higher priority than individual settings. You can <strong>not</strong> change those settings here.'),
'$permnote_self' => t('Some permissions may be inherited from your channel\'s <a href="settings"><strong>privacy settings</strong></a>, which have higher priority than individual settings. You can change those settings here but they wont have any impact unless the inherited setting changes.'),
'$lastupdtext' => t('Last update:'),
'$last_update' => relative_date($contact['abook_connected']),
'$profile_select' => contact_profile_assign($contact['abook_profile']),

View file

@ -176,7 +176,8 @@
<div id="perms-tool-collapse" class="panel-collapse collapse{{if $self}} in{{/if}}" role="tabpanel" aria-labelledby="perms-tool">
<div class="section-content-tools-wrapper">
<div class="section-content-warning-wrapper">
{{$permnote}}
{{if $notself}}{{$permnote}}{{/if}}
{{if $self}}{{$permnote_self}}{{/if}}
</div>
<table id="perms-tool-table" class=form-group>
@ -194,7 +195,9 @@
{{if $self}}
<div>
<div>{{$autolbl}}</div>
<div class="section-content-info-wrapper">
{{$autolbl}}
</div>
{{include file="field_checkbox.tpl" field=$autoperms}}
</div>
{{/if}}

View file

@ -1,6 +1,6 @@
<tr class="highlight">
<td>
<label class="mainlabel" for='id_{{$field.0}}'>{{$field.1}}</label><br>
<label class="mainlabel" for='me_id_{{$field.0}}'>{{$field.1}}</label><br>
<span class='field_abook_help'>{{$field.6}}</span>
</td>
{{if $notself}}
@ -9,9 +9,9 @@
</td>
{{/if}}
<td class="abook-me">
<input type="checkbox" name='{{$field.0}}' class='abook-edit-me' id='me_id_{{$field.0}}' value="{{$field.4}}" {{if $field.3}}checked="checked"{{/if}}{{if $field.5 && $notself}} disabled="disabled"{{/if}}/>
<input type="checkbox" name='{{$field.0}}' class='abook-edit-me' id='me_id_{{$field.0}}' value="{{$field.4}}" {{if $field.3}}checked="checked"{{/if}}{{if $notself && $field.5}} disabled="disabled"{{/if}}/>
</td>
<td>
{{if $field.5}}<span class="permission-inherited">{{$inherited}}</span>{{/if}}
{{if $field.5}}<span class="permission-inherited">{{$inherited}}{{if $self}}{{if $field.7}} <i class="icon-check"></i>{{else}} <i class="icon-check-empty"></i>{{/if}}{{/if}}</span>{{/if}}
</td>
</tr>