Add public visibility setting to privacy groups (collections). This doesn't yet make them visible, but allows them to be visible (like a Cc: instead of a Bcc:)
This commit is contained in:
parent
38d9cf4327
commit
4cda133e89
@ -1,7 +1,7 @@
|
|||||||
<?php /** @file */
|
<?php /** @file */
|
||||||
|
|
||||||
|
|
||||||
function group_add($uid,$name) {
|
function group_add($uid,$name,$public = 0) {
|
||||||
|
|
||||||
$ret = false;
|
$ret = false;
|
||||||
if(x($uid) && x($name)) {
|
if(x($uid) && x($name)) {
|
||||||
@ -37,10 +37,11 @@ function group_add($uid,$name) {
|
|||||||
} while($dups == true);
|
} while($dups == true);
|
||||||
|
|
||||||
|
|
||||||
$r = q("INSERT INTO `group` ( hash, uid, name )
|
$r = q("INSERT INTO `group` ( hash, uid, visible, name )
|
||||||
VALUES( '%s', %d, '%s' ) ",
|
VALUES( '%s', %d, %d, '%s' ) ",
|
||||||
dbesc($hash),
|
dbesc($hash),
|
||||||
intval($uid),
|
intval($uid),
|
||||||
|
intval($public),
|
||||||
dbesc($name)
|
dbesc($name)
|
||||||
);
|
);
|
||||||
$ret = $r;
|
$ret = $r;
|
||||||
|
@ -20,7 +20,8 @@ function group_post(&$a) {
|
|||||||
check_form_security_token_redirectOnErr('/group/new', 'group_edit');
|
check_form_security_token_redirectOnErr('/group/new', 'group_edit');
|
||||||
|
|
||||||
$name = notags(trim($_POST['groupname']));
|
$name = notags(trim($_POST['groupname']));
|
||||||
$r = group_add(local_user(),$name);
|
$public = intval($_POST['public']);
|
||||||
|
$r = group_add(local_user(),$name,$public);
|
||||||
if($r) {
|
if($r) {
|
||||||
info( t('Collection created.') . EOL );
|
info( t('Collection created.') . EOL );
|
||||||
$r = group_byname(local_user(),$name);
|
$r = group_byname(local_user(),$name);
|
||||||
@ -46,9 +47,12 @@ function group_post(&$a) {
|
|||||||
}
|
}
|
||||||
$group = $r[0];
|
$group = $r[0];
|
||||||
$groupname = notags(trim($_POST['groupname']));
|
$groupname = notags(trim($_POST['groupname']));
|
||||||
|
$public = intval($_POST['public']);
|
||||||
|
|
||||||
if((strlen($groupname)) && ($groupname != $group['name'])) {
|
if((strlen($groupname)) && ($groupname != $group['name'])) {
|
||||||
$r = q("UPDATE `group` SET `name` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
$r = q("UPDATE `group` SET `name` = '%s', visible = %d WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
||||||
dbesc($groupname),
|
dbesc($groupname),
|
||||||
|
intval($public),
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
intval($group['id'])
|
intval($group['id'])
|
||||||
);
|
);
|
||||||
@ -85,9 +89,10 @@ function group_content(&$a) {
|
|||||||
if((argc() == 2) && (argv(1) === 'new')) {
|
if((argc() == 2) && (argv(1) === 'new')) {
|
||||||
|
|
||||||
return replace_macros($tpl, $context + array(
|
return replace_macros($tpl, $context + array(
|
||||||
'$title' => t('Create a collection of connections.'),
|
'$title' => t('Create a collection of channels.'),
|
||||||
'$gname' => array('groupname',t('Collection Name: '), '', ''),
|
'$gname' => array('groupname',t('Collection Name: '), '', ''),
|
||||||
'$gid' => 'new',
|
'$gid' => 'new',
|
||||||
|
'$public' => array('public',t('Members are visible to other channels'), false, ''),
|
||||||
'$form_security_token' => get_form_security_token("group_edit"),
|
'$form_security_token' => get_form_security_token("group_edit"),
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -184,6 +189,7 @@ function group_content(&$a) {
|
|||||||
'$gname' => array('groupname',t('Collection Name: '),$group['name'], ''),
|
'$gname' => array('groupname',t('Collection Name: '),$group['name'], ''),
|
||||||
'$gid' => $group['id'],
|
'$gid' => $group['id'],
|
||||||
'$drop' => $drop_txt,
|
'$drop' => $drop_txt,
|
||||||
|
'$public' => array('public',t('Members are visible to other channels'), $group['visible'], ''),
|
||||||
'$form_security_token' => get_form_security_token('group_edit'),
|
'$form_security_token' => get_form_security_token('group_edit'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
66
view/css/mod_group.css
Normal file
66
view/css/mod_group.css
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
#group-new-submit-wrapper {
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#group-edit-form label {
|
||||||
|
float: left;
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#group-edit-form input {
|
||||||
|
float: left;
|
||||||
|
width: 175px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#group-edit-form .field {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
#group-edit-submit-wrapper input {
|
||||||
|
clear: both;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#group-edit-select-end {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
#group-edit-name-label {
|
||||||
|
float: left;
|
||||||
|
width: 175px;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#group-edit-name {
|
||||||
|
float: left;
|
||||||
|
width: 225px;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#group-edit-name-wrapper {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#group_members_select_label {
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
width: 175px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.group_members_select {
|
||||||
|
float: left;
|
||||||
|
width: 230px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#group_members_select_end {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
#group-edit-name-end {
|
||||||
|
clear: both;
|
||||||
|
}
|
@ -1871,49 +1871,6 @@ tr.mceLast {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#group-new-submit-wrapper {
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#group-edit-name-label {
|
|
||||||
float: left;
|
|
||||||
width: 175px;
|
|
||||||
margin-top: 20px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#group-edit-name {
|
|
||||||
float: left;
|
|
||||||
width: 225px;
|
|
||||||
margin-top: 20px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#group-edit-name-wrapper {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#group_members_select_label {
|
|
||||||
display: block;
|
|
||||||
float: left;
|
|
||||||
width: 175px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.group_members_select {
|
|
||||||
float: left;
|
|
||||||
width: 230px;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#group_members_select_end {
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
#group-edit-name-end {
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
#prvmail-to-label, #prvmail-subject-label, #prvmail-message-label {
|
#prvmail-to-label, #prvmail-subject-label, #prvmail-message-label {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
||||||
|
|
||||||
{{include file="field_input.tpl" field=$gname}}
|
{{include file="field_input.tpl" field=$gname}}
|
||||||
|
{{include file="field_checkbox.tpl" field=$public}}
|
||||||
{{if $drop}}{{$drop}}{{/if}}
|
{{if $drop}}{{$drop}}{{/if}}
|
||||||
<div id="group-edit-submit-wrapper" >
|
<div id="group-edit-submit-wrapper" >
|
||||||
<input type="submit" name="submit" value="{{$submit}}" >
|
<input type="submit" name="submit" value="{{$submit}}" >
|
||||||
|
Reference in New Issue
Block a user