Return properly formatted jsondata.

This commit is contained in:
Thomas Tanghus 2012-08-02 19:03:45 +02:00
parent d07f4a5ea8
commit 7dda5527f1
2 changed files with 8 additions and 8 deletions

View File

@ -34,4 +34,4 @@ if(!OC_Contacts_Addressbook::setActive($bookid, 1)) {
bailOut('Error activating addressbook.');
}
$addressbook = OC_Contacts_App::getAddressbook($bookid);
OCP\JSON::success(array('addressbook' => $addressbook));
OCP\JSON::success(array('data' => array('addressbook' => $addressbook)));

View File

@ -79,26 +79,26 @@ OC.Contacts.Settings = OC.Contacts.Settings || {
if(jsondata.status == 'success'){
self.showActions(['new',]);
self.adractions.removeData('id');
active = Boolean(Number(jsondata.addressbook.active));
active = Boolean(Number(jsondata.data.addressbook.active));
if(id == 'new') {
self.adrsettings.find('table')
.append('<tr class="addressbook" data-id="'+jsondata.addressbook.id+'" data-uri="'+jsondata.addressbook.uri+'">'
.append('<tr class="addressbook" data-id="'+jsondata.data.addressbook.id+'" data-uri="'+jsondata.data.addressbook.uri+'">'
+ '<td class="active"><input type="checkbox" '+(active ? 'checked="checked"' : '')+' /></td>'
+ '<td class="name">'+jsondata.addressbook.displayname+'</td>'
+ '<td class="description">'+jsondata.addressbook.description+'</td>'
+ '<td class="name">'+jsondata.data.addressbook.displayname+'</td>'
+ '<td class="description">'+jsondata.data.addressbook.description+'</td>'
+ '<td class="action"><a class="svg action globe" title="'+t('contacts', 'Show CardDav link')+'"></a></td>'
+ '<td class="action"><a class="svg action cloud" title="'+t('contacts', 'Show read-only VCF link')+'"></a></td>'
+ '<td class="action"><a class="svg action download" title="'+t('contacts', 'Download')+'" '
+ 'href="'+totalurl+'/'+encodeURIComponent(oc_current_user)+'/'
+ encodeURIComponent(jsondata.addressbook.uri)+'?export"></a></td>'
+ encodeURIComponent(jsondata.data.addressbook.uri)+'?export"></a></td>'
+ '<td class="action"><a class="svg action edit" title="'+t('contacts', 'Edit')+'"></a></td>'
+ '<td class="action"><a class="svg action delete" title="'+t('contacts', 'Delete')+'"></a></td>'
+ '</tr>');
} else {
var row = self.adrsettings.find('tr[data-id="'+id+'"]');
row.find('td.active').find('input:checkbox').prop('checked', active);
row.find('td.name').text(jsondata.addressbook.displayname);
row.find('td.description').text(jsondata.addressbook.description);
row.find('td.name').text(jsondata.data.addressbook.displayname);
row.find('td.description').text(jsondata.data.addressbook.description);
}
OC.Contacts.Contacts.update();
} else {