settings page channel permissions front-end (needs back-end still)

This commit is contained in:
friendica 2012-11-01 19:47:10 -07:00
parent 1021a4d476
commit 3bf5677797
8 changed files with 106 additions and 5 deletions

View file

@ -125,7 +125,7 @@ function load_translation_table($lang) {
if(! function_exists('t')) {
function t($s) {
$a = get_app();
global $a;
if(x($a->strings,$s)) {
$t = $a->strings[$s];

View file

@ -20,6 +20,28 @@
);
function perms_text() {
$perms_text = array(
'view_stream' => t('Who can view your channel stream and posts'),
'view_profile' => t('Who can view your channel profile'),
'view_photos' => t('Who can view your photo albums'),
'view_contacts' => t('Who can view your address book'),
'send_stream' => t('Who can send you their channel stream and posts'),
'post_wall' => t('Who can post on your channel page'),
'post_comments' => t('Who can comment on your posts'),
'post_mail' => t('Who can send you private mail messages'),
'post_photos' => t('Who can post photos to your photo albums'),
'tag_deliver' => t('Who can forward to all your channel contacts via post tags'),
'chat' => t('Who can chat with you (when available)')
);
return $perms_text;
}
/**
* get_all_perms($uid,$observer)
*

View file

@ -33,7 +33,7 @@ function manage_content(&$a) {
$channels = null;
if(local_user()) {
$r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d ",
$r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d order by channel_name ",
intval(get_account_id())
);

View file

@ -17,7 +17,8 @@ function new_channel_init(&$a) {
$test = array();
// first name
$test[] = legal_webbie(substr($x,0,strpos($x,' ')));
if(strpos($x,' '))
$test[] = legal_webbie(substr($x,0,strpos($x,' ')));
if($test[0]) {
// first name plus first initial of last
$test[] = ((strpos($x,' ')) ? $test[0] . legal_webbie(trim(substr($x,strpos($x,' '),2))) : '');

View file

@ -660,6 +660,10 @@ function settings_content(&$a) {
if(argv(1) === 'channel') {
require_once('include/acl_selectors.php');
require_once('include/permissions.php');
$p = q("SELECT * FROM `profile` WHERE `is_default` = 1 AND `uid` = %d LIMIT 1",
intval(local_user())
@ -671,6 +675,40 @@ function settings_content(&$a) {
$channel = $a->get_channel();
global $global_perms;
$perms = perms_text();
$permiss = array();
$perm_cats = array(
array( t('Only those you allow'), PERMS_SPECIFIC),
array( t('Anybody in your address book'), PERMS_CONTACTS),
array( t('Anybody on this hub/website'), PERMS_SITE),
array( t('Anybody in the network'), PERMS_NETWORK),
array( t('Anybody'), PERMS_PUBLIC)
);
foreach($perms as $k => $perm) {
$permiss[$k] = array(
'key' => $k,
'label' => $perm,
'fields' => array()
);
$column = $global_perms[$k][0];
foreach($perm_cats as $cat) {
$permiss[$k]['fields'][] = array( $column, $cat[0], $cat[1], '', (($channel[$column] == $cat[1]) ? '1' : ''));
}
}
logger('permiss: ' . print_r($permiss,true));
$username = $channel['channel_name'];
$email = $a->account['account_email'];
$nickname = $channel['channel_address'];
@ -819,6 +857,10 @@ function settings_content(&$a) {
'network_only' => array('expire_network_only', t("Only expire posts by others:"), $expire_network_only, '', array(t('No'),t('Yes'))),
);
require_once('include/group.php');
$group_select = mini_group_select(local_user(),$a->user['def_gid']);
@ -845,6 +887,8 @@ function settings_content(&$a) {
'$h_prv' => t('Security and Privacy Settings'),
'$permiss_arr' => $permiss,
'$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), $maxreq ,t("\x28to prevent spam abuse\x29")),
'$permissions' => t('Default Post Permissions'),
'$permdesc' => t("\x28click to open/close\x29"),

View file

@ -1,10 +1,12 @@
#channels-selected {
color: #666666;
font-size: 1.2em;
margin-top: 20px;
margin-bottom: 10px;
}
#channels-desc {
color: #888888;
color: #666666;
font-size: 1.2em;
margin-top: 15px;
margin-bottom: 20px;

16
view/css/mod_settings.css Normal file
View file

@ -0,0 +1,16 @@
.settings-permission-label {
font-weight: bold;
margin-bottom: 10px;
}
#settings-permissions-wrapper .field {
margin-left: 15px;
padding-bottom: 0px;
margin-bottom: 0px;
}
#settings-permissions-wrapper .field label{
width: 200px;
}
#settings-permissions-wrapper .field input{
text-align: left;
width: 50px;
}

View file

@ -35,6 +35,23 @@ $nickname_block
<input type="hidden" name="visibility" value="$visibility" />
<div id="settings-permissions-wrapper">
{{ for $permiss_arr as $permit }}
<div id="settings-perms-$permit.key" class="settings-permission-label">$permit.label</div>
{{ for $permit.fields as $radio }}
{{inc field_radio.tpl with $field=$radio }}{{endinc}}
{{ endfor }}
{{ endfor }}
</div>
{{inc field_input.tpl with $field=$maxreq }}{{endinc}}
$profile_in_dir
@ -73,7 +90,6 @@ $unkmail
</div>
<div id="settings-default-perms" class="settings-default-perms" >
<a href="#profile-jot-acl-wrapper" id="settings-default-perms-menu" class='popupbox'>$permissions $permdesc</a>
<div id="settings-default-perms-menu-end"></div>