From 53e6dd6637552faa319e4270efff1a32acdb4962 Mon Sep 17 00:00:00 2001 From: Fabrixxm Date: Tue, 23 Jun 2015 10:09:27 +0200 Subject: [PATCH] Add contact detail to contact drop confirm fix #1629 --- mod/contacts.php | 96 ++++++++++--------- view/templates/confirm.tpl | 2 +- view/templates/contact_drop_confirm.tpl | 8 ++ view/templates/contact_template.tpl | 26 ++--- .../quattro/templates/contact_template.tpl | 2 + 5 files changed, 74 insertions(+), 60 deletions(-) create mode 100644 view/templates/contact_drop_confirm.tpl diff --git a/mod/contacts.php b/mod/contacts.php index 5d40ff9940..6ee9a4a92b 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -404,7 +404,9 @@ function contacts_content(&$a) { } $a->page['aside'] = ''; - return replace_macros(get_markup_template('confirm.tpl'), array( + + return replace_macros(get_markup_template('contact_drop_confirm.tpl'), array( + '$contact' => _contact_detail_for_template($orig_record[0]), '$method' => 'get', '$message' => t('Do you really want to delete this contact?'), '$extra_inputs' => $inputs, @@ -732,54 +734,9 @@ function contacts_content(&$a) { $contacts = array(); if(count($r)) { - foreach($r as $rr) { - - switch($rr['rel']) { - case CONTACT_IS_FRIEND: - $dir_icon = 'images/lrarrow.gif'; - $alt_text = t('Mutual Friendship'); - break; - case CONTACT_IS_FOLLOWER; - $dir_icon = 'images/larrow.gif'; - $alt_text = t('is a fan of yours'); - break; - case CONTACT_IS_SHARING; - $dir_icon = 'images/rarrow.gif'; - $alt_text = t('you are a fan of'); - break; - default: - break; - } - if(($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) { - $url = "redir/{$rr['id']}"; - $sparkle = ' class="sparkle" '; - } - else { - $url = $rr['url']; - $sparkle = ''; - } - - - $contacts[] = array( - 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']), - 'edit_hover' => t('Edit contact'), - 'photo_menu' => contact_photo_menu($rr), - 'id' => $rr['id'], - 'alt_text' => $alt_text, - 'dir_icon' => $dir_icon, - 'thumb' => proxy_url($rr['thumb']), - 'name' => $rr['name'], - 'username' => $rr['name'], - 'sparkle' => $sparkle, - 'itemurl' => $rr['url'], - 'url' => $url, - 'network' => network_to_name($rr['network']), - ); + $contacts[] = _contact_detail_for_template($rr); } - - - } $tpl = get_markup_template("contacts-template.tpl"); @@ -808,3 +765,48 @@ function contacts_content(&$a) { return $o; } + +function _contact_detail_for_template($rr){ + switch($rr['rel']) { + case CONTACT_IS_FRIEND: + $dir_icon = 'images/lrarrow.gif'; + $alt_text = t('Mutual Friendship'); + break; + case CONTACT_IS_FOLLOWER; + $dir_icon = 'images/larrow.gif'; + $alt_text = t('is a fan of yours'); + break; + case CONTACT_IS_SHARING; + $dir_icon = 'images/rarrow.gif'; + $alt_text = t('you are a fan of'); + break; + default: + break; + } + if(($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) { + $url = "redir/{$rr['id']}"; + $sparkle = ' class="sparkle" '; + } + else { + $url = $rr['url']; + $sparkle = ''; + } + + + return array( + 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']), + 'edit_hover' => t('Edit contact'), + 'photo_menu' => contact_photo_menu($rr), + 'id' => $rr['id'], + 'alt_text' => $alt_text, + 'dir_icon' => $dir_icon, + 'thumb' => proxy_url($rr['thumb']), + 'name' => $rr['name'], + 'username' => $rr['name'], + 'sparkle' => $sparkle, + 'itemurl' => $rr['url'], + 'url' => $url, + 'network' => network_to_name($rr['network']), + ); + +} \ No newline at end of file diff --git a/view/templates/confirm.tpl b/view/templates/confirm.tpl index bb9e159078..a365678184 100644 --- a/view/templates/confirm.tpl +++ b/view/templates/confirm.tpl @@ -2,7 +2,7 @@
- {{$message}} +

{{$message}}

{{foreach $extra_inputs as $input}} {{/foreach}} diff --git a/view/templates/contact_drop_confirm.tpl b/view/templates/contact_drop_confirm.tpl new file mode 100644 index 0000000000..9b9a359714 --- /dev/null +++ b/view/templates/contact_drop_confirm.tpl @@ -0,0 +1,8 @@ +

{{"Drop contact"|t}}

+ +{{include file="contact_template.tpl" no_contacts_checkbox=True}} + +{{include file="confirm.tpl"}} + + +
\ No newline at end of file diff --git a/view/templates/contact_template.tpl b/view/templates/contact_template.tpl index 196254960b..d4f65f70f9 100644 --- a/view/templates/contact_template.tpl +++ b/view/templates/contact_template.tpl @@ -7,26 +7,28 @@ {{$contact.name}} + {{if !$no_contacts_checkbox}} + {{/if}} {{if $contact.photo_menu}} menu -
-
    - {{foreach $contact.photo_menu as $k=>$c}} - {{if $c.2}} -
  • {{$c.0}}
  • - {{else}} -
  • {{$c.0}}
  • - {{/if}} - {{/foreach}} -
-
+
+
    + {{foreach $contact.photo_menu as $k=>$c}} + {{if $c.2}} +
  • {{$c.0}}
  • + {{else}} +
  • {{$c.0}}
  • + {{/if}} + {{/foreach}} +
+
{{/if}}
-
{{$contact.name}}
+
{{$contact.name}}
diff --git a/view/theme/quattro/templates/contact_template.tpl b/view/theme/quattro/templates/contact_template.tpl index a63ffb3c9a..0f0207b2bf 100644 --- a/view/theme/quattro/templates/contact_template.tpl +++ b/view/theme/quattro/templates/contact_template.tpl @@ -7,7 +7,9 @@ {{$contact.name}} + {{if !$no_contacts_checkbox}} + {{/if}} {{if $contact.photo_menu}} menu