diff --git a/mod/group.php b/mod/group.php
index c896362ca2..f6f8e41733 100755
--- a/mod/group.php
+++ b/mod/group.php
@@ -76,14 +76,17 @@ function group_content(&$a) {
if($switchtotext === false)
$switchtotext = 400;
+ $tpl = get_markup_template('group_edit.tpl');
+ $context = array('$submit' => t('Submit'));
+
if(($a->argc == 2) && ($a->argv[1] === 'new')) {
- $tpl = get_markup_template('group_new.tpl');
- $o .= replace_macros($tpl,array(
- '$desc' => t('Create a group of contacts/friends.'),
- '$name' => t('Group Name: '),
- '$submit' => t('Submit')
- ));
- return $o;
+
+ return replace_macros($tpl, $context + array(
+ '$title' => t('Create a group of contacts/friends.'),
+ '$gname' => array('groupname',t('Group Name: '),$group['name'], ''),
+ ));
+
+
}
if(($a->argc == 3) && ($a->argv[1] === 'drop')) {
@@ -156,66 +159,61 @@ function group_content(&$a) {
$celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
- $tpl = get_markup_template('group_edit.tpl');
- $o .= replace_macros($tpl, array(
- '$gid' => $group['id'],
- '$name' => $group['name'],
- '$drop' => $drop_txt,
- '$desc' => t('Click on a contact to add or remove.'),
+
+ $context = $context + array(
'$title' => t('Group Editor'),
- '$gname' => t('Group Name: '),
- '$submit' => t('Submit')
- ));
+ '$gname' => array('groupname',t('Group Name: '),$group['name'], ''),
+ '$gid' => $group['id'],
+ '$drop' => $drop_txt,
+ );
}
if(! isset($group))
return;
- $o .= '
';
- if($change)
- $o = '';
+ $groupeditor = array(
+ 'label_members' => t('Members'),
+ 'members' => array(),
+ 'label_contacts' => t('All Contacts'),
+ 'contacts' => arraY(),
+ );
+
- $o .= '
' . t('Members') . '
';
- $o .= '
';
$textmode = (($switchtotext && (count($members) > $switchtotext)) ? true : false);
foreach($members as $member) {
if($member['url']) {
$member['click'] = 'groupChangeMember(' . $group['id'] . ',' . $member['id'] . '); return true;';
- $o .= micropro($member,true,'mpgroup', $textmode);
+ $groupeditor['members'][] = micropro($member,true,'mpgroup', $textmode);
}
else
group_rmv_member(local_user(),$group['name'],$member['id']);
}
- $o .= '
';
- $o .= '
';
-
- $o .= '
' . t('All Contacts') . '
';
- $o .= '
';
+ $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 and `pending` = 0 and `self` = 0 ORDER BY `name` ASC",
+ intval(local_user())
+ );
- $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 and `pending` = 0 and `self` = 0 ORDER BY `name` ASC",
- intval(local_user())
- );
-
- if(count($r)) {
- $textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
- foreach($r as $member) {
- if(! in_array($member['id'],$preselected)) {
- $member['click'] = 'groupChangeMember(' . $group['id'] . ',' . $member['id'] . '); return true;';
- $o .= micropro($member,true,'mpall', $textmode);
- }
+ if(count($r)) {
+ $textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
+ foreach($r as $member) {
+ if(! in_array($member['id'],$preselected)) {
+ $member['click'] = 'groupChangeMember(' . $group['id'] . ',' . $member['id'] . '); return true;';
+ $groupeditor['contacts'][] = micropro($member,true,'mpall', $textmode);
}
}
+ }
- $o .= '
';
+ $context['$groupeditor'] = $groupeditor;
+ $context['$desc'] = t('Click on a contact to add or remove.');
if($change) {
- echo $o;
+ $tpl = get_markup_template('groupeditor.tpl');
+ echo replace_macros($tpl, $context);
killme();
}
- $o .= '
';
- return $o;
+
+ return replace_macros($tpl, $context);
}
diff --git a/view/group_edit.tpl b/view/group_edit.tpl
index 51782ab952..3689db7535 100755
--- a/view/group_edit.tpl
+++ b/view/group_edit.tpl
@@ -2,17 +2,21 @@
+
+
+{{ if $groupeditor }}
+
+ {{ inc groupeditor.tpl }}{{ endinc }}
+
+{{ endif }}
+{{ if $desc }}$desc
{{ endif }}
diff --git a/view/group_new.tpl b/view/group_new.tpl
deleted file mode 100755
index 735b51634d..0000000000
--- a/view/group_new.tpl
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-