1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-11-29 11:24:11 +01:00

Fix being able to link directly to contact, that I broke in other commit.

This commit is contained in:
Thomas Tanghus 2012-06-21 22:02:17 +02:00
parent b3b67ab2cb
commit a48debb3c9
3 changed files with 8 additions and 5 deletions

View File

@ -256,12 +256,14 @@ Contacts={
}
} else {
newid = id;
bookid = bookid?bookid:$('#contacts li[data-id="'+newid+'"]').data('bookid');
}
var localLoadContact = function(newid, bookid) {
if($('.contacts li').length > 0) {
firstitem.addClass('active');
$('#contacts li[data-id="'+newid+'"]').addClass('active');
$.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':newid},function(jsondata){
if(jsondata.status == 'success'){
$('#contacts h3[data-id="'+bookid+'"]').trigger('click');
Contacts.UI.Card.loadContact(jsondata.data, bookid);
} else {
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
@ -1503,7 +1505,7 @@ Contacts={
},
Contacts:{
// Reload the contacts list.
update:function(){
update:function(id){
$.getJSON(OC.filePath('contacts', 'ajax', 'contacts.php'),{},function(jsondata){
if(jsondata.status == 'success'){
$('#contacts').html(jsondata.data.page).ready(function() {
@ -1518,7 +1520,7 @@ Contacts={
})}, 100);
setTimeout(Contacts.UI.Contacts.lazyupdate, 500);*/
});
Contacts.UI.Card.update();
Contacts.UI.Card.update(id);
}
else{
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
@ -1707,5 +1709,5 @@ $(document).ready(function(){
$('#contacts_propertymenu_dropdown a').keydown(propertyMenuItem);
Contacts.UI.loadHandlers();
Contacts.UI.Contacts.update();
Contacts.UI.Contacts.update(id);
});

View File

@ -1,6 +1,7 @@
<script type='text/javascript'>
var totalurl = '<?php echo OCP\Util::linkToRemote('carddav'); ?>addressbooks';
var categories = <?php echo json_encode($_['categories']); ?>;
var id = <?php echo $_['id']; ?>;
var lang = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?>';
</script>
<div id="leftcontent">

View File

@ -3,7 +3,7 @@ foreach($_['books'] as $id => $addressbook) {
echo '<h3 class="addressbook" data-id="'.$id.'">'.$addressbook['displayname'].'</h3>';
echo '<ul class="contacts hidden" data-id="'.$id.'">';
foreach($addressbook['contacts'] as $contact) {
echo '<li role="button" data-bookid="'.$contact['addressbookid'].'" data-id="'.$contact['id'].'"><a href="index.php?id='.$contact['id'].'" style="background: url('.link_to('contacts','thumbnail.php').'?id='.$contact['id'].') no-repeat scroll 0 0 transparent;">'.$contact['displayname'].'</a></li>';
echo '<li role="button" data-bookid="'.$contact['addressbookid'].'" data-id="'.$contact['id'].'"><a href="'.link_to('contacts','index.php').'&id='.$contact['id'].'" style="background: url('.link_to('contacts','thumbnail.php').'?id='.$contact['id'].') no-repeat scroll 0 0 transparent;">'.$contact['displayname'].'</a></li>';
}
echo '</ul>';
}