]> git.mxchange.org Git - friendica.git/commitdiff
Merge develop into 0602_contact_profile
authorrabuzarus <>
Tue, 9 Feb 2016 12:44:30 +0000 (13:44 +0100)
committerrabuzarus <>
Tue, 9 Feb 2016 12:44:30 +0000 (13:44 +0100)
Conflicts:
mod/contacts.php

1  2 
mod/contacts.php

index f5289cf03a0253ac721481edd4d321867951727d,0b421433e0bdd1d52ef32d212f94786c270d1393..f9c5fd4f0efc7259d57476c5f7cf33fe1bd796a6
@@@ -822,19 -799,7 +806,18 @@@ function contacts_content(&$a) 
  
        return $o;
  }
- }
  
 +/**
 + * @brief List of pages for the Contact TabBar
 + * 
 + * Available Pages are 'Status', 'Profile', 'Contacts' and 'Common Friends'
 + * 
 + * @param app $a
 + * @param int $contact_id The ID of the contact
 + * @param int $active_tab 1 if tab should be marked as active
 + * 
 + * @return array with with contact TabBar data
 + */
  function contacts_tab($a, $contact_id, $active_tab) {
        // tabs
        $tabs = array(
@@@ -963,82 -952,5 +943,82 @@@ function _contact_detail_for_template($
                'url' => $url,
                'network' => network_to_name($rr['network'], $rr['url']),
        );
- }
  }
 +
 +/**
 + * @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;
 +}