|
|
|
|
@ -316,7 +316,7 @@ Contacts={ |
|
|
|
|
$('#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 ul[data-id="'+bookid+'"]').slideDown(300); |
|
|
|
|
Contacts.UI.Card.loadContact(jsondata.data, bookid); |
|
|
|
|
} else { |
|
|
|
|
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); |
|
|
|
|
@ -326,7 +326,8 @@ Contacts={ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Make sure proper DOM is loaded.
|
|
|
|
|
if(!$('#card')[0] && newid) { |
|
|
|
|
if(!$('#card').length && newid) { |
|
|
|
|
console.log('Loading card DOM'); |
|
|
|
|
$.getJSON(OC.filePath('contacts', 'ajax', 'loadcard.php'),{requesttoken:requesttoken},function(jsondata){ |
|
|
|
|
if(jsondata.status == 'success'){ |
|
|
|
|
$('#rightcontent').html(jsondata.data.page).ready(function() { |
|
|
|
|
@ -339,6 +340,7 @@ Contacts={ |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else if(!newid) { |
|
|
|
|
console.log('Loading intro'); |
|
|
|
|
// load intro page
|
|
|
|
|
$.getJSON(OC.filePath('contacts', 'ajax', 'loadintro.php'),{},function(jsondata){ |
|
|
|
|
if(jsondata.status == 'success'){ |
|
|
|
|
@ -370,6 +372,7 @@ Contacts={ |
|
|
|
|
return $('<li data-id="'+data.id+'" data-bookid="'+data.addressbookid+'" role="button"><a href="'+OC.linkTo('contacts', 'index.php')+'&id='+data.id+'" style="background: url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+data.id+') no-repeat scroll 0% 0% transparent;">'+data.displayname+'</a></li>'); |
|
|
|
|
}, |
|
|
|
|
add:function(n, fn, aid, isnew){ // add a new contact
|
|
|
|
|
console.log('Adding ' + fn); |
|
|
|
|
aid = aid?aid:$('#contacts h3.active').first().data('id'); |
|
|
|
|
var localAddcontact = function(n, fn, aid, isnew) { |
|
|
|
|
$.post(OC.filePath('contacts', 'ajax', 'addcontact.php'), { n: n, fn: fn, aid: aid, isnew: isnew }, |
|
|
|
|
@ -413,8 +416,8 @@ Contacts={ |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var card = $('#card')[0]; |
|
|
|
|
if(!card) { |
|
|
|
|
if(!$('#card').length) { |
|
|
|
|
console.log('Loading card DOM'); |
|
|
|
|
$.getJSON(OC.filePath('contacts', 'ajax', 'loadcard.php'),{'requesttoken': requesttoken},function(jsondata){ |
|
|
|
|
if(jsondata.status == 'success'){ |
|
|
|
|
$('#rightcontent').html(jsondata.data.page).ready(function() { |
|
|
|
|
@ -1604,10 +1607,10 @@ Contacts={ |
|
|
|
|
firstrun = true; |
|
|
|
|
|
|
|
|
|
if($('#contacts h3').length == 0) { |
|
|
|
|
$('#contacts').html('<h3 class="addressbook" data-id="'+b+'">'+book.displayname+'</h3><ul class="contacts" data-id="'+b+'"></ul>'); |
|
|
|
|
$('#contacts').html('<h3 class="addressbook" data-id="'+b+'">'+book.displayname+'</h3><ul class="contacts hidden" data-id="'+b+'"></ul>'); |
|
|
|
|
} else { |
|
|
|
|
if(!$('#contacts h3[data-id="'+b+'"]').length) { |
|
|
|
|
$('<h3 class="addressbook" data-id="'+b+'">'+book.displayname+'</h3><ul class="contacts" data-id="'+b+'"></ul>') |
|
|
|
|
$('<h3 class="addressbook" data-id="'+b+'">'+book.displayname+'</h3><ul class="contacts hidden" data-id="'+b+'"></ul>') |
|
|
|
|
.appendTo('#contacts'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|