Merge branch 'master' of git.kde.org:owncloud

This commit is contained in:
Frank Karlitschek 2011-08-06 23:31:57 +02:00
commit 60cb7c1c4d
4 changed files with 28 additions and 3 deletions

View file

@ -13,6 +13,6 @@ OC_App::addNavigationEntry( array(
'order' => 10,
'href' => OC_Helper::linkTo( 'contacts', 'index.php' ),
'icon' => OC_Helper::imagePath( 'contacts', 'icon.png' ),
'name' => 'Addressbook' ));
'name' => 'Contacts' ));
?>

View file

@ -20,7 +20,7 @@
*
*/
function contactsort($a,$b){
function contacts_namesort($a,$b){
return strcmp($a['name'],$b['name']);
}
@ -33,12 +33,20 @@ if( !OC_User::isLoggedIn()){
exit();
}
// Check if the user has an addressbook
$addressbooks = OC_Contacts_Addressbook::allAddressbooks(OC_User::getUser());
if( count($addressbooks) == 0){
OC_Contacts_Addressbook::addAddressbook(OC_User::getUser(),'default','Default Address Book');
}
// Load the files we need
OC_App::setActiveNavigationEntry( 'contacts_index' );
// Load a specific user?
$id = isset( $_GET['id'] ) ? $_GET['id'] : null;
// sort addressbooks (use contactsort)
usort($addressbooks,'contacts_namesort');
// Addressbooks to load
$openaddressbooks = explode(';',OC_Preferences::getValue(OC_User::getUser(),'contacts','openaddressbooks',null));
@ -51,7 +59,7 @@ foreach( $openaddressbooks as $addressbook ){
}
usort($contacts,'contactsort');
usort($contacts,'contacts_namesort');
$details = array();
if( !is_null($id) || count($contacts)){
@ -62,6 +70,7 @@ if( !is_null($id) || count($contacts)){
// Process the template
$tmpl = new OC_Template( 'contacts', 'index', 'user' );
$tmpl->assign('addressbooks', $addressbooks);
$tmpl->assign('contacts', $contacts);
$tmpl->assign('details', $details );
$tmpl->assign('id',$id);

View file

@ -11,4 +11,9 @@ $(document).ready(function(){
});
return false;
});
$('.contacts_addressbooksexpander').click(function(){
$('.contacts_addressbooksdetails').toggle();
return false;
});
});

View file

@ -3,6 +3,17 @@ OC_Util::addScript('contacts','interface');
OC_Util::addStyle('contacts','styles');
?>
<div class="contacts_addressbooks">
<div class="contacts_addressbooksexpander">
Addressbooks
</div>
<div class="contacts_addressbooksdetails" style="display:none;">
<?php foreach($_['addressbooks'] as $addressbook): ?>
<?php echo $addressbook['displayname']; ?>: <?php echo $addressbook['description']; ?><br>
<?php endforeach; ?>
<br>To use this addressbook, use .../apps/contacts/carddav.php/addressbooks/USERNAME/addressbookname.php
</div>
</div>
<div class="contacts_contacts leftcontent">
<ul>
<?php echo $this->inc("_contacts"); ?>