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

Moved parsing to the controller and js to contacts.js.

This commit is contained in:
Thomas Tanghus 2012-06-17 20:22:01 +02:00
parent 22aa2e235a
commit 258c08efba

View File

@ -1,28 +1,10 @@
<?php
foreach($_['contacts'] as $category => $contacts):
echo '<h3 class="addressbookname">'.$category.'</h3>';
echo '<div>';
echo '<ul class="contacts">';
foreach($contacts as $contact):
$display = trim($contact['fullname']);
if(!$display) {
$vcard = OC_Contacts_App::getContactVCard($contact['id']);
if(!is_null($vcard)) {
$struct = OC_Contacts_VCard::structureContact($vcard);
$display = isset($struct['EMAIL'][0])?$struct['EMAIL'][0]['value']:'[UNKNOWN]';
}
}
echo '<li role="button" book-id="'.$contact['addressbookid'].'" data-id="'.$contact['id'].'"><a href="index.php?id='.$contact['id'].'">'.htmlspecialchars($display).'</a></li>';
endforeach;
foreach($_['books'] as $id => $addressbook) {
echo '<h3 class="addressbook" data-id="'.$id.'">'.$addressbook['displayname'].'</h3>';
echo '<ul class="contacts hidden">';
foreach($addressbook['contacts'] as $contact) {
echo '<li role="button" book-id="'.$contact['addressbookid'].'" data-id="'.$contact['id'].'"><a href="index.php?id='.$contact['id'].'">'.$contact['displayname'].'</a></li>';
}
echo '</ul>';
echo '</div>';
endforeach;
}
?>
<script language="Javascript">
$(document).ready(function() {
$('#leftcontent .addressbookname').click(function(event) {
$(this).next().toggle('slow');
return false;
}).next().hide();
});
</script>