Moved parsing to the controller and js to contacts.js.
This commit is contained in:
parent
2875901fc7
commit
b6b6d69158
|
@ -1,28 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
foreach($_['contacts'] as $category => $contacts):
|
foreach($_['books'] as $id => $addressbook) {
|
||||||
echo '<h3 class="addressbookname">'.$category.'</h3>';
|
echo '<h3 class="addressbook" data-id="'.$id.'">'.$addressbook['displayname'].'</h3>';
|
||||||
echo '<div>';
|
echo '<ul class="contacts hidden">';
|
||||||
echo '<ul class="contacts">';
|
foreach($addressbook['contacts'] as $contact) {
|
||||||
foreach($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>';
|
||||||
$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;
|
|
||||||
echo '</ul>';
|
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>
|
|
||||||
|
|
Loading…
Reference in New Issue