issue #239, provide 'Public' text on ACL selector when appropriate to do so.

This commit is contained in:
redmatrix 2015-12-31 15:10:36 -08:00
parent caf3a69d99
commit 1964fa05e1
3 changed files with 16 additions and 14 deletions

View File

@ -210,10 +210,13 @@ function fixacl(&$item) {
$item = str_replace(array('<','>'),array('',''),$item); $item = str_replace(array('<','>'),array('',''),$item);
} }
function populate_acl($defaults = null,$show_jotnets = true) { function populate_acl($defaults = null,$show_jotnets = true, $showall = '') {
$allow_cid = $allow_gid = $deny_cid = $deny_gid = false; $allow_cid = $allow_gid = $deny_cid = $deny_gid = false;
if(! $showall)
$showall = t('Visible to your default audience');
if(is_array($defaults)) { if(is_array($defaults)) {
$allow_cid = ((strlen($defaults['allow_cid'])) $allow_cid = ((strlen($defaults['allow_cid']))
? explode('><', $defaults['allow_cid']) : array() ); ? explode('><', $defaults['allow_cid']) : array() );
@ -231,13 +234,12 @@ function populate_acl($defaults = null,$show_jotnets = true) {
$jotnets = ''; $jotnets = '';
if($show_jotnets) { if($show_jotnets) {
logger('jot_networks');
call_hooks('jot_networks', $jotnets); call_hooks('jot_networks', $jotnets);
} }
$tpl = get_markup_template("acl_selector.tpl"); $tpl = get_markup_template("acl_selector.tpl");
$o = replace_macros($tpl, array( $o = replace_macros($tpl, array(
'$showall'=> t("Visible to your default audience"), '$showall' => $showall,
'$show' => t("Show"), '$show' => t("Show"),
'$hide' => t("Don't show"), '$hide' => t("Don't show"),
'$allowcid' => json_encode($allow_cid), '$allowcid' => json_encode($allow_cid),

View File

@ -128,7 +128,7 @@ function channel_content(&$a, $update = 0, $load = false) {
'default_location' => (($is_owner) ? $a->profile['channel_location'] : ''), 'default_location' => (($is_owner) ? $a->profile['channel_location'] : ''),
'nickname' => $a->profile['channel_address'], 'nickname' => $a->profile['channel_address'],
'lockstate' => (((strlen($a->profile['channel_allow_cid'])) || (strlen($a->profile['channel_allow_gid'])) || (strlen($a->profile['channel_deny_cid'])) || (strlen($a->profile['channel_deny_gid']))) ? 'lock' : 'unlock'), 'lockstate' => (((strlen($a->profile['channel_allow_cid'])) || (strlen($a->profile['channel_allow_gid'])) || (strlen($a->profile['channel_deny_cid'])) || (strlen($a->profile['channel_deny_gid']))) ? 'lock' : 'unlock'),
'acl' => (($is_owner) ? populate_acl($channel_acl) : ''), 'acl' => (($is_owner) ? populate_acl($channel_acl,true,(($a->profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')) : ''),
'showacl' => (($is_owner) ? 'yes' : ''), 'showacl' => (($is_owner) ? 'yes' : ''),
'bang' => '', 'bang' => '',
'visitor' => (($is_owner || $observer) ? true : false), 'visitor' => (($is_owner || $observer) ? true : false),

View File

@ -166,7 +166,7 @@ function network_content(&$a, $update = 0, $load = false) {
'default_location' => $channel['channel_location'], 'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'], 'nickname' => $channel['channel_address'],
'lockstate' => (($private_editing || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), 'lockstate' => (($private_editing || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
'acl' => populate_acl((($private_editing) ? $def_acl : $channel_acl)), 'acl' => populate_acl((($private_editing) ? $def_acl : $channel_acl), true, (($channel['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')),
'bang' => (($private_editing) ? '!' : ''), 'bang' => (($private_editing) ? '!' : ''),
'visitor' => true, 'visitor' => true,
'profile_uid' => local_channel() 'profile_uid' => local_channel()