mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-16 20:05:14 +02:00
[frio] Improve Group Editing (#5349)
* Improve group-editing and edit-navigation. Use icons next to groups and header for navigation to editing groups and adding new groups. Also use icon from group-sidebar for editing groups. * Unify look&feel of contact search bars. * Remove nogroup page and replace with /group/none. * Make sure proper items are selected in aside. * Use icon instead of link for 'View Contacs' on profile page. * Fix none-working /group/none. * Fix highlighting for everyone in group aside.
This commit is contained in:
parent
09b7e217c7
commit
32ef5623ab
16 changed files with 180 additions and 177 deletions
|
@ -87,7 +87,7 @@ function contacts_init(App $a)
|
|||
$findpeople_widget = Widget::findPeople();
|
||||
}
|
||||
|
||||
$groups_widget = Group::sidebarWidget('contacts', 'group', 'full', 0, $contact_id);
|
||||
$groups_widget = Group::sidebarWidget('contacts', 'group', 'full', 'everyone', $contact_id);
|
||||
|
||||
$a->page['aside'] .= replace_macros(get_markup_template("contacts-widget-sidebar.tpl"), [
|
||||
'$vcard_widget' => $vcard_widget,
|
||||
|
|
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,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')) {
|
||||
|
@ -112,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');
|
||||
|
||||
|
@ -199,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,
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -242,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
|
||||
|
@ -252,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 to group"),
|
||||
'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;
|
||||
}
|
||||
|
@ -266,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']);
|
||||
|
|
|
@ -8,18 +8,13 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Core\System;
|
||||
|
||||
function nogroup_init(App $a)
|
||||
{
|
||||
if (! local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! x($a->page, 'aside')) {
|
||||
$a->page['aside'] = '';
|
||||
}
|
||||
|
||||
$a->page['aside'] .= Group::sidebarWidget('contacts', 'group', 'extended');
|
||||
}
|
||||
|
||||
function nogroup_content(App $a)
|
||||
|
@ -29,41 +24,5 @@ function nogroup_content(App $a)
|
|||
return '';
|
||||
}
|
||||
|
||||
$r = Contact::getUngroupedList(local_user());
|
||||
if (DBM::is_result($r)) {
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
}
|
||||
$r = Contact::getUngroupedList(local_user(), $a->pager['start'], $a->pager['itemspage']);
|
||||
if (DBM::is_result($r)) {
|
||||
foreach ($r as $rr) {
|
||||
$contact_details = Contact::getDetailsByURL($rr['url'], local_user(), $rr);
|
||||
|
||||
$contacts[] = [
|
||||
'img_hover' => L10n::t('Visit %s\'s profile [%s]', $contact_details['name'], $rr['url']),
|
||||
'edit_hover' => L10n::t('Edit contact'),
|
||||
'photo_menu' => Contact::photoMenu($rr),
|
||||
'id' => $rr['id'],
|
||||
'thumb' => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
|
||||
'name' => $contact_details['name'],
|
||||
'username' => $contact_details['name'],
|
||||
'details' => $contact_details['location'],
|
||||
'tags' => $contact_details['keywords'],
|
||||
'about' => $contact_details['about'],
|
||||
'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
|
||||
'url' => $rr['url'],
|
||||
'network' => ContactSelector::networkToName($rr['network'], $rr['url']),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$tpl = get_markup_template("nogroup-template.tpl");
|
||||
$o = replace_macros(
|
||||
$tpl,
|
||||
[
|
||||
'$header' => L10n::t('Contacts who are not members of a group'),
|
||||
'$contacts' => $contacts,
|
||||
'$paginate' => paginate($a)]
|
||||
);
|
||||
|
||||
return $o;
|
||||
goaway(System::baseUrl() . '/group/none');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue