mirror of
https://github.com/friendica/friendica
synced 2024-12-23 06:00:15 +00:00
more group editor
This commit is contained in:
parent
c6267a2cd2
commit
323697d9dc
4 changed files with 39 additions and 8 deletions
|
@ -49,7 +49,9 @@ function group_content(&$a) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dbg(2);
|
|
||||||
|
|
||||||
|
|
||||||
if(($a->argc == 2) && (intval($a->argv[1]))) {
|
if(($a->argc == 2) && (intval($a->argv[1]))) {
|
||||||
require_once('view/acl_selectors.php');
|
require_once('view/acl_selectors.php');
|
||||||
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||||
|
@ -60,14 +62,21 @@ dbg(2);
|
||||||
notice("Group not found." . EOL );
|
notice("Group not found." . EOL );
|
||||||
goaway($a->get_baseurl() . '/contacts');
|
goaway($a->get_baseurl() . '/contacts');
|
||||||
}
|
}
|
||||||
$ret = group_get_members($r[0]['id']);
|
$group = $r[0];
|
||||||
|
$ret = group_get_members($group['id']);
|
||||||
$preselected = array();
|
$preselected = array();
|
||||||
if(count($ret)) {
|
if(count($ret)) {
|
||||||
foreach($ret as $p)
|
foreach($ret as $p)
|
||||||
$preselected[] = $p['id'];
|
$preselected[] = $p['id'];
|
||||||
}
|
}
|
||||||
$sel = contact_select('group_members_select','group_members_select',$preselected);
|
|
||||||
$o .= $sel;
|
$tpl = file_get_contents('view/group_edit.tpl');
|
||||||
|
$o .= replace_macros($tpl, array(
|
||||||
|
'$gid' => $group['id'],
|
||||||
|
'$name' => $group['name'],
|
||||||
|
'$selector' => contact_select('group_members_select','group_members_select',$preselected,25)
|
||||||
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
function group_select($selname,$selclass,$preselected = false) {
|
function group_select($selname,$selclass,$preselected = false,$size = 4) {
|
||||||
|
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
$o .= "<select name=\"{$selname}[]\" class=\"$selclass\" multiple=\"multiple\" size=\"4\" />\r\n";
|
$o .= "<select name=\"{$selname}[]\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" />\r\n";
|
||||||
|
|
||||||
$r = q("SELECT * FROM `group` WHERE `uid` = %d ORDER BY `name` ASC",
|
$r = q("SELECT * FROM `group` WHERE `uid` = %d ORDER BY `name` ASC",
|
||||||
$_SESSION['uid']
|
$_SESSION['uid']
|
||||||
|
@ -30,11 +30,11 @@ function group_select($selname,$selclass,$preselected = false) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function contact_select($selname,$selclass,$preselected = false) {
|
function contact_select($selname,$selclass,$preselected = false,$size = 4) {
|
||||||
|
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
$o .= "<select name=\"{$selname}[]\" class=\"$selclass\" multiple=\"multiple\" size=\"4\" />\r\n";
|
$o .= "<select name=\"{$selname}[]\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" />\r\n";
|
||||||
|
|
||||||
$r = q("SELECT `id`, `name` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 ORDER BY `name` ASC ",
|
$r = q("SELECT `id`, `name` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 ORDER BY `name` ASC ",
|
||||||
$_SESSION['uid']
|
$_SESSION['uid']
|
||||||
|
|
18
view/group_edit.tpl
Normal file
18
view/group_edit.tpl
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<h2>Group Editor</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="group-edit-wrapper" >
|
||||||
|
<form action="group/$gid" id="group-edit-form" method="post" >
|
||||||
|
<div id="group-editname-wrapper" >
|
||||||
|
<label id="group-edit-name-label" for="group-edit-name" >Group Name: </label>
|
||||||
|
<input type="text" name="groupname" value="$name" />
|
||||||
|
</div>
|
||||||
|
<div id="group-edit-name-end"></div>
|
||||||
|
<div id="group-edit-select-wrapper" >
|
||||||
|
<label id=group_members_select_label" for="group_members_select" >Members:</label>
|
||||||
|
$selector
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div id="group-edit-select-end" ></div>
|
||||||
|
</form>
|
||||||
|
</div>
|
|
@ -832,3 +832,7 @@ input#dfrn-url {
|
||||||
#acl-wrapper-end {
|
#acl-wrapper-end {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.group_members_select {
|
||||||
|
width: 200px;
|
||||||
|
}
|
Loading…
Reference in a new issue