From: rabuzarus <> Date: Tue, 23 Feb 2016 18:19:45 +0000 (+0100) Subject: contactedit-actions-button: move repair back to tabbar X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0db83b958659582ef2a7a20226cc7eea06bd9397;p=friendica.git contactedit-actions-button: move repair back to tabbar --- 0db83b958659582ef2a7a20226cc7eea06bd9397 diff --cc doc/Accesskeys.md index 57de221c83,c49e79c0ab..4f16ba2536 --- a/doc/Accesskeys.md +++ b/doc/Accesskeys.md @@@ -37,6 -37,10 +37,7 @@@ Genera * o: Profile * t: Contacts * d: Common friends -* b: Toggle Blocked status -* i: Toggle Ignored status -* v: Toggle Archive status -* r: Repair ++* r: Advanced /message -------- diff --cc mod/contacts.php index f9c5fd4f0e,7f758b43c5..991b59885c --- a/mod/contacts.php +++ b/mod/contacts.php @@@ -859,6 -839,35 +859,13 @@@ function contacts_tab($a, $contact_id, 'id' => 'common-loc-tab', 'accesskey' => 'd'); - $tabs[] = array('label' => t('Repair'), ++ $tabs[] = array('label' => t('Advanced'), + 'url' => 'crepair/' . $contact_id, + 'sel' => (($active_tab == 5)?'active':''), + 'title' => t('Advanced Contact Settings'), - 'id' => 'repair-tab', ++ 'id' => 'advanced-tab', + 'accesskey' => 'r'); + - - $tabs[] = array('label' => (($contact['blocked']) ? t('Unblock') : t('Block') ), - 'url' => 'contacts/' . $contact_id . '/block', - 'sel' => '', - 'title' => t('Toggle Blocked status'), - 'id' => 'toggle-block-tab', - 'accesskey' => 'b'); - - $tabs[] = array('label' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ), - 'url' => 'contacts/' . $contact_id . '/ignore', - 'sel' => '', - 'title' => t('Toggle Ignored status'), - 'id' => 'toggle-ignore-tab', - 'accesskey' => 'i'); - - $tabs[] = array('label' => (($contact['archive']) ? t('Unarchive') : t('Archive') ), - 'url' => 'contacts/' . $contact_id . '/archive', - 'sel' => '', - 'title' => t('Toggle Archive status'), - 'id' => 'toggle-archive-tab', - 'accesskey' => 'v'); - $tab_tpl = get_markup_template('common_tabs.tpl'); $tab_str = replace_macros($tab_tpl, array('$tabs' => $tabs)); @@@ -945,80 -954,3 +952,72 @@@ function _contact_detail_for_template($ ); } + +/** + * @brief Gives a array with actions which can performed to a given contact + * + * This includes actions like e.g. 'block', 'hide', 'archive', 'delete' and others + * + * @param array $contact Data about the Contact + * @return array with contact related actions + */ +function contact_actions($contact) { + + $poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2)); + $contact_action = array(); + + // Provide friend suggestion only for Friendica contacts + if($contact['network'] === NETWORK_DFRN) { + $contact_actions['suggest'] = array( + 'label' => t('Suggest friends'), + 'url' => app::get_baseurl(true) . '/fsuggest/' . $contact['id'], + 'title' => '', + 'sel' => '', + 'id' => 'suggest', + ); + } + + if($poll_enabled) { + $contact_actions['update'] = array( + 'label' => t('Update now'), + 'url' => app::get_baseurl(true) . '/contacts/' . $contact['id'] . '/update', + 'title' => '', + 'sel' => '', + 'id' => 'update', + ); + } + - $contact_actions['repair'] = array( - 'label' => t('Repair'), - 'url' => app::get_baseurl(true) . '/crepair/' . $contact['id'], - 'title' => t('Advanced Contact Settings'), - 'sel' => '', - 'id' => 'repair', - ); - + $contact_actions['block'] = array( + 'label' => (intval($contact['blocked']) ? t('Unblock') : t('Block') ), + 'url' => app::get_baseurl(true) . '/contacts/' . $contact['id'] . '/block', + 'title' => t('Toggle Blocked status'), + 'sel' => (intval($contact['blocked']) ? 'active' : ''), + 'id' => 'toggle-block', + ); + + $contact_actions['ignore'] = array( + 'label' => (intval($contact['readonly']) ? t('Unignore') : t('Ignore') ), + 'url' => app::get_baseurl(true) . '/contacts/' . $contact['id'] . '/ignore', + 'title' => t('Toggle Ignored status'), + 'sel' => (intval($contact['readonly']) ? 'active' : ''), + 'id' => 'toggle-ignore', + ); + + $contact_actions['archive'] = array( + 'label' => (intval($contact['archive']) ? t('Unarchive') : t('Archive') ), + 'url' => app::get_baseurl(true) . '/contacts/' . $contact['id'] . '/archive', + 'title' => t('Toggle Archive status'), + 'sel' => (intval($contact['archive']) ? 'active' : ''), + 'id' => 'toggle-archive', + ); + + $contact_actions['delete'] = array( + 'label' => t('Delete'), + 'url' => app::get_baseurl(true) . '/contacts/' . $contact['id'] . '/drop', + 'title' => t('Delete contact'), + 'sel' => '', + 'id' => 'delete', + ); + + return $contact_actions; +} diff --cc view/templates/contact_edit.tpl index 91ef451278,15863b6a27..93999a860c --- a/view/templates/contact_edit.tpl +++ b/view/templates/contact_edit.tpl @@@ -9,51 -7,53 +9,50 @@@