diff options
Diffstat (limited to 'apps/contacts')
-rw-r--r-- | apps/contacts/appinfo/app.php | 2 | ||||
-rw-r--r-- | apps/contacts/index.php | 13 | ||||
-rw-r--r-- | apps/contacts/js/interface.js | 5 | ||||
-rw-r--r-- | apps/contacts/templates/index.php | 11 |
4 files changed, 28 insertions, 3 deletions
diff --git a/apps/contacts/appinfo/app.php b/apps/contacts/appinfo/app.php index f38a45f2790..7ff47265256 100644 --- a/apps/contacts/appinfo/app.php +++ b/apps/contacts/appinfo/app.php @@ -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' )); ?> diff --git a/apps/contacts/index.php b/apps/contacts/index.php index 2d5bcefd875..1e01b1c9fbd 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -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); diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js index 045562b496f..6af160b3927 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -11,4 +11,9 @@ $(document).ready(function(){ }); return false; }); + + $('.contacts_addressbooksexpander').click(function(){ + $('.contacts_addressbooksdetails').toggle(); + return false; + }); }); diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php index 0cd214bfb18..ca189cb4c8a 100644 --- a/apps/contacts/templates/index.php +++ b/apps/contacts/templates/index.php @@ -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"); ?> |