mirror of
https://github.com/friendica/friendica
synced 2024-12-23 00:40:15 +00:00
group editor cleanup
This commit is contained in:
parent
323697d9dc
commit
c3273dfcdc
4 changed files with 85 additions and 12 deletions
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
function validate_members(&$item) {
|
||||||
|
$item = intval($item);
|
||||||
|
}
|
||||||
|
|
||||||
function group_init(&$a) {
|
function group_init(&$a) {
|
||||||
require_once('include/group.php');
|
require_once('include/group.php');
|
||||||
|
@ -31,7 +33,42 @@ function group_post(&$a) {
|
||||||
// goaway($a->get_baseurl() . '/group');
|
// goaway($a->get_baseurl() . '/group');
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
}
|
}
|
||||||
|
if(($a->argc == 2) && (intval($a->argv[1]))) {
|
||||||
|
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||||
|
intval($a->argv[1]),
|
||||||
|
intval($_SESSION['uid'])
|
||||||
|
);
|
||||||
|
if(! count($r)) {
|
||||||
|
notice("Group not found." . EOL );
|
||||||
|
goaway($a->get_baseurl() . '/contacts');
|
||||||
|
}
|
||||||
|
$group = $r[0];
|
||||||
|
$groupname = notags(trim($_POST['groupname']));
|
||||||
|
if((strlen($groupname)) && ($groupname != $group['name'])) {
|
||||||
|
$r = q("UPDATE `group` SET `name` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
||||||
|
dbesc($groupname),
|
||||||
|
intval($_SESSION['uid']),
|
||||||
|
intval($group['id'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$members = $_POST['group_members_select'];
|
||||||
|
array_walk($members,'validate_members');
|
||||||
|
$r = q("DELETE FROM `group_member` WHERE `gid` = %d AND `uid` = %d",
|
||||||
|
intval($a->argv[1]),
|
||||||
|
intval($_SESSION['uid'])
|
||||||
|
);
|
||||||
|
if(count($members)) {
|
||||||
|
foreach($members as $member) {
|
||||||
|
$r = q("INSERT INTO `group_member` ( `uid`, `gid`, `contact-id`)
|
||||||
|
VALUES ( %d, %d, %d )",
|
||||||
|
intval($_SESSION['uid']),
|
||||||
|
intval($group['id']),
|
||||||
|
intval($member)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function group_content(&$a) {
|
function group_content(&$a) {
|
||||||
|
|
|
@ -3,16 +3,21 @@
|
||||||
|
|
||||||
<div id="group-edit-wrapper" >
|
<div id="group-edit-wrapper" >
|
||||||
<form action="group/$gid" id="group-edit-form" method="post" >
|
<form action="group/$gid" id="group-edit-form" method="post" >
|
||||||
<div id="group-editname-wrapper" >
|
<div id="group-edit-name-wrapper" >
|
||||||
<label id="group-edit-name-label" for="group-edit-name" >Group Name: </label>
|
<label id="group-edit-name-label" for="group-edit-name" >Group Name: </label>
|
||||||
<input type="text" name="groupname" value="$name" />
|
<input type="text" id="group-edit-name" name="groupname" value="$name" />
|
||||||
</div>
|
</div>
|
||||||
<div id="group-edit-name-end"></div>
|
<div id="group-edit-name-end"></div>
|
||||||
<div id="group-edit-select-wrapper" >
|
<div id="group-edit-select-wrapper" >
|
||||||
<label id=group_members_select_label" for="group_members_select" >Members:</label>
|
<label id="group_members_select_label" for="group_members_select" >Members:</label>
|
||||||
$selector
|
$selector
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div id="group_members_select_end"></div>
|
||||||
|
<div id="group-edit-submit-wrapper" >
|
||||||
|
<input type="submit" name="submit" value="Submit" >
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="group-edit-select-end" ></div>
|
<div id="group-edit-select-end" ></div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -833,6 +833,41 @@ input#dfrn-url {
|
||||||
clear: both;
|
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 {
|
.group_members_select {
|
||||||
width: 200px;
|
float: left;
|
||||||
|
width: 230px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#group_members_select_end {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
#group-edit-name-end {
|
||||||
|
clear: both;
|
||||||
}
|
}
|
8
wip/todo
8
wip/todo
|
@ -7,19 +7,15 @@ profile photo to self contact page? - resolve profile photo inconsistency
|
||||||
use photo hash to notify of changes?
|
use photo hash to notify of changes?
|
||||||
|
|
||||||
|
|
||||||
no ACL block for visitors wall-wall !!
|
|
||||||
|
|
||||||
contact editor
|
contact editor
|
||||||
block photo
|
block photo
|
||||||
|
|
||||||
profile "you name it" field
|
profile "you name it" field
|
||||||
|
|
||||||
|
|
||||||
groups
|
group - delete, theme
|
||||||
|
|
||||||
permissions
|
pager - photos
|
||||||
|
|
||||||
pager - items and photos
|
|
||||||
|
|
||||||
photos/albums/ java uploader
|
photos/albums/ java uploader
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue