X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=mod%2Fgroup.php;h=05a358ba70adb5ea86981ef9c582a162ec6da0bf;hb=d1d2ee6b2f2a46f1c6495bfe9936146a2bfad403;hp=870025074c91b34b220c8d51ec1c5e8b5a39efee;hpb=c9f02d534e2016acf18d7fa18db193d056495841;p=friendica.git diff --git a/mod/group.php b/mod/group.php index 870025074c..05a358ba70 100644 --- a/mod/group.php +++ b/mod/group.php @@ -16,7 +16,7 @@ use Friendica\Model\Group; function group_init(App $a) { if (local_user()) { - $a->page['aside'] = Group::sidebarWidget('contacts', 'group', 'extended', (($a->argc > 1) ? intval($a->argv[1]) : 0)); + $a->page['aside'] = Group::sidebarWidget('contacts', 'group', 'extended', (($a->argc > 1) ? $a->argv[1] : 'everyone')); } } @@ -85,6 +85,10 @@ function group_content(App $a) { } // Switch to text mode interface if we have more than 'n' contacts or group members + + if ($a->argc == 1) { + goaway(System::baseUrl() . '/contacts'); + } $switchtotext = PConfig::get(local_user(), 'system', 'groupedit_image_limit'); if (is_null($switchtotext)) { @@ -94,7 +98,8 @@ function group_content(App $a) { $tpl = get_markup_template('group_edit.tpl'); $context = [ - '$submit' => L10n::t('Save Group'), + '$submit' => L10n::t('Save Group'), + '$submit_filter' => L10n::t('Filter'), ]; if (($a->argc == 2) && ($a->argv[1] === 'new')) { @@ -108,6 +113,29 @@ function group_content(App $a) { } + if (($a->argc == 2) && ($a->argv[1] === 'none')) { + require_once 'mod/contacts.php'; + + $id = -1; + $nogroup = True; + $group = [ + 'id' => $id, + 'name' => L10n::t('Contacts not in any group'), + ]; + + $members = []; + $preselected = []; + $entry = []; + + $context = $context + [ + '$title' => $group['name'], + '$gname' => ['groupname', L10n::t('Group Name: '), $group['name'], ''], + '$gid' => $id, + '$editable' => 0, + ]; + } + + if (($a->argc == 3) && ($a->argv[1] === 'drop')) { check_form_security_token_redirectOnErr('/group', 'group_drop', 't'); @@ -195,12 +223,13 @@ function group_content(App $a) { $context = $context + [ - '$title' => L10n::t('Group Editor'), + '$title' => $group['name'], '$gname' => ['groupname', L10n::t('Group Name: '), $group['name'], ''], '$gid' => $group['id'], '$drop' => $drop_txt, '$form_security_token' => get_form_security_token('group_edit'), - '$edit_name' => L10n::t('Edit Group Name') + '$edit_name' => L10n::t('Edit Group Name'), + '$editable' => 1, ]; } @@ -226,7 +255,7 @@ function group_content(App $a) { $entry['label'] = 'members'; $entry['photo_menu'] = ''; $entry['change_member'] = [ - 'title' => L10n::t("Remove Contact"), + 'title' => L10n::t("Remove contact from group"), 'gid' => $group['id'], 'cid' => $member['id'], 'sec_token' => $sec_token @@ -238,9 +267,14 @@ function group_content(App $a) { } } - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `self` ORDER BY `name` ASC", - intval(local_user()) - ); + if ($nogroup) { + $r = Contact::getUngroupedList(local_user()); + } else { + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `self` ORDER BY `name` ASC", + intval(local_user()) + ); + $context['$desc'] = L10n::t('Click on a contact to add or remove.'); + } if (DBM::is_result($r)) { // Format the data of the contacts who aren't in the contact group @@ -248,13 +282,17 @@ function group_content(App $a) { if (! in_array($member['id'], $preselected)) { $entry = _contact_detail_for_template($member); $entry['label'] = 'contacts'; - $entry['photo_menu'] = ''; - $entry['change_member'] = [ - 'title' => L10n::t("Add Contact"), - 'gid' => $group['id'], - 'cid' => $member['id'], - 'sec_token' => $sec_token - ]; + if (!$nogroup) + $entry['photo_menu'] = []; + + if (!$nogroup) { + $entry['change_member'] = [ + 'title' => L10n::t("Add contact to group"), + 'gid' => $group['id'], + 'cid' => $member['id'], + 'sec_token' => $sec_token + ]; + } $groupeditor['contacts'][] = $entry; } @@ -262,7 +300,6 @@ function group_content(App $a) { } $context['$groupeditor'] = $groupeditor; - $context['$desc'] = L10n::t('Click on a contact to add or remove.'); // If there are to many contacts we could provide an alternative view mode $total = count($groupeditor['members']) + count($groupeditor['contacts']);