aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-08-11 01:48:43 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-08-11 01:48:43 -0700
commitf4e634ad526198cc5c79e74d77b19c8a1b518942 (patch)
tree03af04ec04e2953cd3760333fc0c42fce4a0f352 /mod
parenteb6b2677cb214b018f95e621e3fcdce7e49c2d95 (diff)
downloadvolse-hubzilla-f4e634ad526198cc5c79e74d77b19c8a1b518942.tar.gz
volse-hubzilla-f4e634ad526198cc5c79e74d77b19c8a1b518942.tar.bz2
volse-hubzilla-f4e634ad526198cc5c79e74d77b19c8a1b518942.zip
group drop
Diffstat (limited to 'mod')
-rw-r--r--mod/group.php40
-rw-r--r--mod/network.php3
2 files changed, 33 insertions, 10 deletions
diff --git a/mod/group.php b/mod/group.php
index 099ae7dd3..a3bd750f9 100644
--- a/mod/group.php
+++ b/mod/group.php
@@ -15,7 +15,7 @@ function group_init(&$a) {
function group_post(&$a) {
if(! local_user()) {
- notice("Access denied." . EOL);
+ notice( t('Permission denied.') . EOL);
return;
}
@@ -23,13 +23,13 @@ function group_post(&$a) {
$name = notags(trim($_POST['groupname']));
$r = group_add($_SESSION['uid'],$name);
if($r) {
- notice("Group created." . EOL );
+ notice( t('Group created.') . EOL );
$r = group_byname($_SESSION['uid'],$name);
if($r)
goaway($a->get_baseurl() . '/group/' . $r);
}
else
- notice("Could not create group." . EOL );
+ notice( t('Could not create group.') . EOL );
goaway($a->get_baseurl() . '/group');
return; // NOTREACHED
}
@@ -39,7 +39,7 @@ function group_post(&$a) {
intval($_SESSION['uid'])
);
if(! count($r)) {
- notice("Group not found." . EOL );
+ notice( t('Group not found.') . EOL );
goaway($a->get_baseurl() . '/contacts');
}
$group = $r[0];
@@ -51,7 +51,7 @@ function group_post(&$a) {
intval($group['id'])
);
if($r)
- notice("Group name changed." . EOL );
+ notice( t('Group name changed.') . EOL );
}
$members = $_POST['group_members_select'];
array_walk($members,'validate_members');
@@ -73,7 +73,7 @@ function group_post(&$a) {
}
}
if($result)
- notice("Membership list updated." . EOL);
+ notice( t('Membership list updated.') . EOL);
$a->page['aside'] = group_side();
}
@@ -82,7 +82,7 @@ function group_post(&$a) {
function group_content(&$a) {
if(! local_user()) {
- notice("Access denied." . EOL);
+ notice( t('Permission denied') . EOL);
return;
}
@@ -94,7 +94,22 @@ function group_content(&$a) {
}
-
+ if(($a->argc == 3) && ($a->argv[1] == 'drop')) {
+ if(intval($argv[2])) {
+ $r = q("SELECT `name` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($argv[2]),
+ intval($_SESSION['uid'])
+ );
+ if(count($r))
+ $result = group_rmv($_SESSION['uid'],$r[0]['name']);
+ if($result)
+ notice( t('Group removed.') . EOL);
+ else
+ notice( t('Unable to remove group.') . EOL);
+ }
+ goaway($a->get_baseurl() . '/group');
+ return; // NOTREACHED
+ }
if(($a->argc == 2) && (intval($a->argv[1]))) {
@@ -104,7 +119,7 @@ function group_content(&$a) {
intval($_SESSION['uid'])
);
if(! count($r)) {
- notice("Group not found." . EOL );
+ notice( t("Group not found.") . EOL );
goaway($a->get_baseurl() . '/contacts');
}
$group = $r[0];
@@ -115,10 +130,17 @@ function group_content(&$a) {
$preselected[] = $p['id'];
}
+ $drop_tpl = file_get_contents('view/group_drop.tpl');
+ $drop_txt = replace_macros($drop_tpl, array(
+ '$id' => $group['id'],
+ '$delete' => t('Delete')
+ ));
+
$tpl = file_get_contents('view/group_edit.tpl');
$o .= replace_macros($tpl, array(
'$gid' => $group['id'],
'$name' => $group['name'],
+ '$drop' => $drop_txt,
'$selector' => contact_select('group_members_select','group_members_select',$preselected,25)
));
diff --git a/mod/network.php b/mod/network.php
index 17a670b93..59f826fd9 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -73,7 +73,7 @@ function network_content(&$a, $update = false) {
$sql_extra = '';
if($group) {
- $r = q("SELECT `id` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ $r = q("SELECT `name`, `id` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($group),
intval($_SESSION['uid'])
);
@@ -87,6 +87,7 @@ function network_content(&$a, $update = false) {
$contacts[] = $_SESSION['cid'];
$contact_str = implode(',',$contacts);
$sql_extra = dbesc(" AND `contact`.`id` IN ( $contact_str ) ");
+ $o = '<h4>' . t('Group: ') . $r[0]['name'] . '</h4>' . $o;
}