Add contact detail to contact drop confirm

fix #1629
This commit is contained in:
Fabrixxm 2015-06-23 10:09:27 +02:00
parent 24c91a4fed
commit 53e6dd6637
5 changed files with 74 additions and 60 deletions

View file

@ -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']),
);
}

View file

@ -2,7 +2,7 @@
<center>
<form action="{{$confirm_url}}" id="confirm-form" method="{{$method}}">
<span id="confirm-message">{{$message}}</span>
<h3 id="confirm-message">{{$message}}</h3>
{{foreach $extra_inputs as $input}}
<input type="hidden" name="{{$input.name}}" value="{{$input.value|escape:'html'}}" />
{{/foreach}}

View file

@ -0,0 +1,8 @@
<h1>{{"Drop contact"|t}}</h1>
{{include file="contact_template.tpl" no_contacts_checkbox=True}}
{{include file="confirm.tpl"}}
<div class="clear"></div>

View file

@ -7,26 +7,28 @@
<a href="{{$contact.url}}" title="{{$contact.img_hover}}" /><img src="{{$contact.thumb}}" {{$contact.sparkle}} alt="{{$contact.name}}" /></a>
{{if !$no_contacts_checkbox}}
<input type="checkbox" class="contact-select" name="contact_batch[]" value="{{$contact.id}}">
{{/if}}
{{if $contact.photo_menu}}
<span onclick="openClose('contact-photo-menu-{{$contact.id}}');" class="fakelink contact-photo-menu-button" id="contact-photo-menu-button-{{$contact.id}}">menu</span>
<div class="contact-photo-menu" id="contact-photo-menu-{{$contact.id}}">
<ul>
{{foreach $contact.photo_menu as $k=>$c}}
{{if $c.2}}
<li><a class="{{$k}}" target="redir" href="{{$c.1}}">{{$c.0}}</a></li>
{{else}}
<li><a class="{{$k}}" href="{{$c.1}}">{{$c.0}}</a></li>
{{/if}}
{{/foreach}}
</ul>
</div>
<div class="contact-photo-menu" id="contact-photo-menu-{{$contact.id}}">
<ul>
{{foreach $contact.photo_menu as $k=>$c}}
{{if $c.2}}
<li><a class="{{$k}}" target="redir" href="{{$c.1}}">{{$c.0}}</a></li>
{{else}}
<li><a class="{{$k}}" href="{{$c.1}}">{{$c.0}}</a></li>
{{/if}}
{{/foreach}}
</ul>
</div>
{{/if}}
</div>
</div>
<div class="contact-entry-photo-end" ></div>
<div class="contact-entry-name" id="contact-entry-name-{{$contact.id}}" >{{$contact.name}}</div>
<div class="contact-entry-name" id="contact-entry-name-{{$contact.id}}" >{{$contact.name}}</div>
<div class="contact-entry-end" ></div>
</div>

View file

@ -7,7 +7,9 @@
<a href="{{$contact.url}}" title="{{$contact.img_hover}}" /><img src="{{$contact.thumb}}" {{$contact.sparkle}} alt="{{$contact.name}}" /></a>
{{if !$no_contacts_checkbox}}
<input type="checkbox" class="contact-select" name="contact_batch[]" value="{{$contact.id}}">
{{/if}}
{{if $contact.photo_menu}}
<a href="#" rel="#contact-photo-menu-{{$contact.id}}" class="contact-photo-menu-button icon s16 menu" id="contact-photo-menu-button-{{$contact.id}}">menu</a>
<ul class="contact-photo-menu menu-popup" id="contact-photo-menu-{{$contact.id}}">