diff options
Diffstat (limited to 'include/acl_selectors.php')
-rw-r--r-- | include/acl_selectors.php | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 4cc01d15b..ce0a32798 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -6,6 +6,9 @@ /** * @package acl_selectors */ + +require_once("include/PermissionDescription.php"); + function group_select($selname,$selclass,$preselected = false,$size = 4) { $a = get_app(); @@ -215,20 +218,34 @@ function fixacl(&$item) { * * @param array $default Optional access control list for the initial state of the dialog. * @param boolean $show_jotnets Whether plugins for federated networks should be included in the permissions dialog -* @param string $showall_caption An optional caption to describe the scope of an unrestricted post. e.g. "Public" +* @param PermissionDescription $emptyACL_description - An optional description for the permission implied by selecting an empty ACL. Preferably an instance of PermissionDescription. * @param string $dialog_description Optional message to include at the top of the dialog. E.g. "Warning: Post permissions cannot be changed once sent". * @param string $context_help Allows the dialog to present a help icon. E.g. "acl_dialog_post" * @param boolean $readonly Not implemented yet. When implemented, the dialog will use acl_readonly.tpl instead, so that permissions may be viewed for posts that can no longer have their permissions changed. * * @return string html modal dialog built from acl_selector.tpl */ -function populate_acl($defaults = null,$show_jotnets = true, $showall_caption = '', $dialog_description = '', $context_help = '', $readonly = false) { +function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_description = '', $dialog_description = '', $context_help = '', $readonly = false) { $allow_cid = $allow_gid = $deny_cid = $deny_gid = false; + $showall_origin = ''; + $showall_icon = 'fa-globe'; - if(! $showall_caption) + + if(! $emptyACL_description) { $showall_caption = t('Visible to your default audience'); + } else if (is_a($emptyACL_description, 'PermissionDescription')) { + $showall_caption = $emptyACL_description->get_permission_description(); + $showall_origin = $emptyACL_description->get_permission_origin_description(); + $showall_icon = $emptyACL_description->get_permission_icon(); + + } else { + // For backwards compatibility we still accept a string... for now! + $showall_caption = $emptyACL_description; + } + + if(is_array($defaults)) { $allow_cid = ((strlen($defaults['allow_cid'])) ? explode('><', $defaults['allow_cid']) : array() ); @@ -252,6 +269,8 @@ function populate_acl($defaults = null,$show_jotnets = true, $showall_caption = $tpl = get_markup_template("acl_selector.tpl"); $o = replace_macros($tpl, array( '$showall' => $showall_caption, + '$showallOrigin' => $showall_origin, + '$showallIcon' => $showall_icon, '$showlimited' => t("Limit access:"), '$showlimitedDesc' => t('Select "Show" to allow viewing. "Don\'t show" lets you override and limit the scope of "Show".'), '$show' => t("Show"), @@ -278,7 +297,7 @@ function populate_acl($defaults = null,$show_jotnets = true, $showall_caption = * populate_acl() call for wall posts or network posts. * * This string is needed in 3 different files, and our .po translation system currently -* cannot be used as a string table (because the value is always the key is english) so +* cannot be used as a string table (because the value is always the key in english) so * I've centralized the value here (making this function name the "key") until we have a * better way. * |