summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-08-01 23:59:44 +0200
committerThomas Tanghus <thomas@tanghus.net>2012-08-02 00:02:07 +0200
commita8faae4f421ab8b85c2bd88b9617efb191c3ff62 (patch)
tree5e6deffb8a37acdf3b2a9fe3c2c265fdf7e8b3e3
parent47e4793c30b9efdf419115b77343d456cf17594b (diff)
downloadnextcloud-server-a8faae4f421ab8b85c2bd88b9617efb191c3ff62.tar.gz
nextcloud-server-a8faae4f421ab8b85c2bd88b9617efb191c3ff62.zip
Addressbooks settings rewrite and cleanup.
-rw-r--r--apps/contacts/ajax/activation.php32
-rw-r--r--apps/contacts/ajax/addressbook/add.php (renamed from apps/contacts/ajax/addaddressbook.php)6
-rw-r--r--apps/contacts/ajax/addressbook/delete.php (renamed from apps/contacts/ajax/deletebook.php)5
-rw-r--r--apps/contacts/ajax/addressbook/update.php (renamed from apps/contacts/ajax/updateaddressbook.php)23
-rw-r--r--apps/contacts/ajax/chooseaddressbook.php15
-rw-r--r--apps/contacts/ajax/createaddressbook.php36
-rw-r--r--apps/contacts/ajax/editaddressbook.php16
-rw-r--r--apps/contacts/css/contacts.css7
-rw-r--r--apps/contacts/js/contacts.js144
-rw-r--r--apps/contacts/lib/app.php5
-rw-r--r--apps/contacts/templates/index.php1
-rw-r--r--apps/contacts/templates/part.chooseaddressbook.php24
-rw-r--r--apps/contacts/templates/part.chooseaddressbook.rowfields.php18
-rw-r--r--apps/contacts/templates/part.contact.php3
-rw-r--r--apps/contacts/templates/part.edit_address_dialog.php1
-rw-r--r--apps/contacts/templates/part.no_contacts.php1
-rw-r--r--apps/contacts/templates/settings.php44
17 files changed, 98 insertions, 283 deletions
diff --git a/apps/contacts/ajax/activation.php b/apps/contacts/ajax/activation.php
deleted file mode 100644
index 69173c54c44..00000000000
--- a/apps/contacts/ajax/activation.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-/**
- * Copyright (c) 2011 Thomas Tanghus <thomas@tanghus.net>
- * Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('contacts');
-OCP\JSON::callCheck();
-
-$bookid = $_POST['bookid'];
-$book = OC_Contacts_App::getAddressbook($bookid);// is owner access check
-
-if(!OC_Contacts_Addressbook::setActive($bookid, $_POST['active'])) {
- OCP\Util::writeLog('contacts',
- 'ajax/activation.php: Error activating addressbook: '. $bookid,
- OCP\Util::ERROR);
- OCP\JSON::error(array(
- 'data' => array(
- 'message' => OC_Contacts_App::$l10n->t('Error (de)activating addressbook.'))));
- exit();
-}
-
-OCP\JSON::success(array(
- 'active' => OC_Contacts_Addressbook::isActive($bookid),
- 'bookid' => $bookid,
- 'book' => $book,
-));
diff --git a/apps/contacts/ajax/addaddressbook.php b/apps/contacts/ajax/addressbook/add.php
index 40773704bb4..617c2fd1822 100644
--- a/apps/contacts/ajax/addaddressbook.php
+++ b/apps/contacts/ajax/addressbook/add.php
@@ -6,13 +6,13 @@
* later.
* See the COPYING-README file.
*/
-
+
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
OCP\JSON::callCheck();
-require_once 'loghandler.php';
+require_once __DIR__.'/../loghandler.php';
debug('name: '.$_POST['name']);
@@ -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('data' => $addressbook));
+OCP\JSON::success(array('addressbook' => $addressbook));
diff --git a/apps/contacts/ajax/deletebook.php b/apps/contacts/ajax/addressbook/delete.php
index 1b86ecf223e..f59c605f4e4 100644
--- a/apps/contacts/ajax/deletebook.php
+++ b/apps/contacts/ajax/addressbook/delete.php
@@ -24,9 +24,12 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
OCP\JSON::callCheck();
+require_once __DIR__.'/../loghandler.php';
-//$id = $_GET['id'];
$id = $_POST['id'];
+if(!$id) {
+ bailOut(OC_Contacts_App::$l10n->t('id is not set.'));
+}
OC_Contacts_App::getAddressbook( $id ); // is owner access check
OC_Contacts_Addressbook::delete($id);
diff --git a/apps/contacts/ajax/updateaddressbook.php b/apps/contacts/ajax/addressbook/update.php
index a14b2158431..0fc66c3a3bf 100644
--- a/apps/contacts/ajax/updateaddressbook.php
+++ b/apps/contacts/ajax/addressbook/update.php
@@ -6,33 +6,34 @@
* See the COPYING-README file.
*/
-
+
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
-require_once 'loghandler.php';
-
-$bookid = $_POST['id'];
-OC_Contacts_App::getAddressbook($bookid); // is owner access check
+require_once __DIR__.'/../loghandler.php';
+$id = $_POST['id'];
$name = trim(strip_tags($_POST['name']));
+$description = trim(strip_tags($_POST['description']));
+if(!$id) {
+ bailOut(OC_Contacts_App::$l10n->t('id is not set.'));
+}
+
if(!$name) {
bailOut(OC_Contacts_App::$l10n->t('Cannot update addressbook with an empty name.'));
}
-if(!OC_Contacts_Addressbook::edit($bookid, $name, null)) {
+if(!OC_Contacts_Addressbook::edit($id, $name, $description)) {
bailOut(OC_Contacts_App::$l10n->t('Error updating addressbook.'));
}
-if(!OC_Contacts_Addressbook::setActive($bookid, $_POST['active'])) {
+if(!OC_Contacts_Addressbook::setActive($id, $_POST['active'])) {
bailOut(OC_Contacts_App::$l10n->t('Error (de)activating addressbook.'));
}
-$addressbook = OC_Contacts_App::getAddressbook($bookid);
-$tmpl = new OCP\Template('contacts', 'part.chooseaddressbook.rowfields');
-$tmpl->assign('addressbook', $addressbook);
+OC_Contacts_App::getAddressbook($id); // is owner access check
+$addressbook = OC_Contacts_App::getAddressbook($id);
OCP\JSON::success(array(
- 'page' => $tmpl->fetchPage(),
'addressbook' => $addressbook,
));
diff --git a/apps/contacts/ajax/chooseaddressbook.php b/apps/contacts/ajax/chooseaddressbook.php
deleted file mode 100644
index 1ce8dd46eef..00000000000
--- a/apps/contacts/ajax/chooseaddressbook.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-/**
- * Copyright (c) 2011 Thomas Tanghus <thomas@tanghus.net>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('contacts');
-
-$tmpl = new OCP\Template("contacts", "part.chooseaddressbook");
-$page = $tmpl->fetchPage();
-OCP\JSON::success(array('data' => array('page'=>$page)));
diff --git a/apps/contacts/ajax/createaddressbook.php b/apps/contacts/ajax/createaddressbook.php
deleted file mode 100644
index 8dbd63f6425..00000000000
--- a/apps/contacts/ajax/createaddressbook.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * Copyright (c) 2011-2012 Thomas Tanghus <thomas@tanghus.net>
- * Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-
-// Check if we are a user
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('contacts');
-OCP\JSON::callCheck();
-require_once 'loghandler.php';
-
-$userid = OCP\USER::getUser();
-$name = trim(strip_tags($_POST['name']));
-if(!$name) {
- bailOut('Cannot add addressbook with an empty name.');
-}
-$bookid = OC_Contacts_Addressbook::add($userid, $name, null);
-if(!$bookid) {
- bailOut('Error adding addressbook: '.$name);
-}
-
-if(!OC_Contacts_Addressbook::setActive($bookid, 1)) {
- bailOut('Error activating addressbook.');
-}
-$addressbook = OC_Contacts_App::getAddressbook($bookid);
-$tmpl = new OCP\Template('contacts', 'part.chooseaddressbook.rowfields');
-$tmpl->assign('addressbook', $addressbook);
-OCP\JSON::success(array(
- 'page' => $tmpl->fetchPage(),
- 'addressbook' => $addressbook,
-));
diff --git a/apps/contacts/ajax/editaddressbook.php b/apps/contacts/ajax/editaddressbook.php
deleted file mode 100644
index 4bc77302e5b..00000000000
--- a/apps/contacts/ajax/editaddressbook.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-/**
- * Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('contacts');
-$addressbook = OC_Contacts_App::getAddressbook($_GET['bookid']);
-$tmpl = new OCP\Template("contacts", "part.editaddressbook");
-$tmpl->assign('new', false);
-$tmpl->assign('addressbook', $addressbook);
-$tmpl->printPage();
diff --git a/apps/contacts/css/contacts.css b/apps/contacts/css/contacts.css
index 5350fdd5d34..1a7935aa79a 100644
--- a/apps/contacts/css/contacts.css
+++ b/apps/contacts/css/contacts.css
@@ -134,3 +134,10 @@ input[type="checkbox"] { width: 20px; height: 20px; vertical-align: bottom; }
.help-section dl { width: 100%; float: left; clear: right; margin: 0; padding: 0; cursor: normal; }
.help-section dt { display: table-cell; clear: left; float: left; width: 35%; margin: 0; padding: 0.2em; text-align: right; text-overflow: ellipsis; vertical-align: text-bottom; font-weight: bold: }
.help-section dd { display: table-cell; clear: right; float: left; margin: 0; padding: 0.2em; white-space: nowrap; vertical-align: text-bottom; }
+.contacts-settings dl { width: 100%; }
+.addressbooks-settings table { width: 100%; }
+.addressbooks-settings .actions { width: 100%; white-space: nowrap; }
+.addressbooks-settings .actions * { float: left; }
+.addressbooks-settings .actions input.name { width: 5em; }
+.addressbooks-settings .actions input.name { width: 7em; }
+
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index fa99878174e..c53fc5af63f 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -22,7 +22,7 @@ Contacts={
* cancel: If set cancel all ongoing timer events and hide the notification.
*/
notify:function(params) {
- self = this;
+ var self = this;
if(!self.notifier) {
self.notifier = $('#notification');
}
@@ -40,6 +40,10 @@ Contacts={
self.notifier.fadeIn();
self.notifier.on('click', function() { $(this).fadeOut();});
var timer = setTimeout(function() {
+ if(!self || !self.notifier) {
+ var self = Contacts.UI;
+ self.notifier = $('#notification');
+ }
self.notifier.fadeOut();
if(params.timeouthandler && $.isFunction(params.timeouthandler)) {
params.timeouthandler(self.notifier.data(dataid));
@@ -53,6 +57,10 @@ Contacts={
}
if(params.clickhandler && $.isFunction(params.clickhandler)) {
self.notifier.on('click', function() {
+ if(!self || !self.notifier) {
+ var self = Contacts.UI;
+ self.notifier = $(this);
+ }
clearTimeout(timer);
self.notifier.off('click');
params.clickhandler(self.notifier.data(dataid));
@@ -1382,123 +1390,6 @@ Contacts={
return false;
},
},
- Addressbooks:{
- overview:function(){
- if($('#chooseaddressbook_dialog').dialog('isOpen') == true){
- $('#chooseaddressbook_dialog').dialog('moveToTop');
- }else{
- $('body').append('<div id="addressbook_dialog"></div>');
- $.getJSON(OC.filePath('contacts', 'ajax', 'chooseaddressbook.php'), function(jsondata){
- if(jsondata.status == 'success'){
- $('#addressbook_dialog').html(jsondata.data.page).find('#chooseaddressbook_dialog').dialog({
- minWidth : 600,
- close : function(event, ui) {
- $(this).dialog('destroy').remove();
- $('#addressbook_dialog').remove();
- }
- }).css('overflow','visible');
- } else {
- alert(jsondata.data.message);
- $('#addressbook_dialog').remove();
- }
- });
- }
- return false;
- },
- activation:function(checkbox, bookid){
- var active = checkbox.checked;
- $.post(OC.filePath('contacts', 'ajax', 'activation.php'), {bookid: bookid, active: (active?1:0)}, function(jsondata) {
- if (jsondata.status == 'success'){
- if(!active) {
- $('#contacts h3[data-id="'+bookid+'"],#contacts ul[data-id="'+bookid+'"]').remove();
- } else {
- Contacts.UI.Contacts.update();
- }
- } else {
- OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
- checkbox.checked = !active;
- }
- });
- },
- addAddressbook:function(name, description, cb) {
- $.post(OC.filePath('contacts', 'ajax', 'addaddressbook.php'), { name: name, description: description, active: true },
- function(jsondata){
- if(jsondata.status == 'success'){
- if(cb) {
- cb(jsondata.data);
- }
- } else {
- OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
- return false;
- }
- });
-
- },
- newAddressbook:function(object){
- var tr = $(document.createElement('tr'))
- .load(OC.filePath('contacts', 'ajax', 'addbook.php'));
- $(object).closest('tr').after(tr).hide();
- },
- editAddressbook:function(object, bookid){
- var tr = $(document.createElement('tr'))
- .load(OC.filePath('contacts', 'ajax', 'editaddressbook.php') + "?bookid="+bookid);
- $(object).closest('tr').after(tr).hide();
- },
- deleteAddressbook:function(obj, bookid){
- var check = confirm("Do you really want to delete this address book?");
- if(check == false){
- return false;
- }else{
- $.post(OC.filePath('contacts', 'ajax', 'deletebook.php'), { id: bookid},
- function(jsondata) {
- if (jsondata.status == 'success'){
- $(obj).closest('tr').remove();
- $('#contacts h3[data-id="'+bookid+'"],#contacts ul[data-id="'+bookid+'"]').remove();
- Contacts.UI.Contacts.update();
- } else {
- OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
- }
- });
- }
- },
- doImport:function(file, aid){
- $.post(OC.filePath('contacts', '', 'import.php'), { id: aid, file: file, fstype: 'OC_FilesystemView' },
- function(jsondata){
- if(jsondata.status != 'success'){
- Contacts.UI.notify({message:jsondata.data.message});
- }
- });
- return false;
- },
- submit:function(button, bookid){
- var displayname = $("#displayname_"+bookid).val().trim();
- var active = $("#edit_active_"+bookid+":checked").length;
- var description = $("#description_"+bookid).val();
-
- if(displayname.length == 0) {
- OC.dialogs.alert(t('contacts', 'Displayname cannot be empty.'), t('contacts', 'Error'));
- return false;
- }
- var url;
- if (bookid == 'new'){
- url = OC.filePath('contacts', 'ajax', 'createaddressbook.php');
- }else{
- url = OC.filePath('contacts', 'ajax', 'updateaddressbook.php');
- }
- $.post(url, { id: bookid, name: displayname, active: active, description: description },
- function(jsondata){
- if(jsondata.status == 'success'){
- $(button).closest('tr').prev().html(jsondata.page).show().next().remove();
- Contacts.UI.Contacts.update();
- } else {
- OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
- }
- });
- },
- cancel:function(button, bookid){
- $(button).closest('tr').prev().show().next().remove();
- }
- },
Contacts:{
contacts:{},
deletionQueue:[],
@@ -1613,6 +1504,15 @@ Contacts={
//this.contacts[id] = contact;
return contact;
},
+ doImport:function(file, aid){
+ $.post(OC.filePath('contacts', '', 'import.php'), { id: aid, file: file, fstype: 'OC_FilesystemView' },
+ function(jsondata){
+ if(jsondata.status != 'success'){
+ Contacts.UI.notify({message:jsondata.data.message});
+ }
+ });
+ return false;
+ },
next:function(reverse) {
// TODO: Check if we're last-child/first-child and jump to next/prev address book.
var curlistitem = $('#contacts li[data-id="'+Contacts.UI.Card.id+'"]');
@@ -1747,7 +1647,11 @@ $(document).ready(function(){
//$('#chooseaddressbook').on('click keydown', Contacts.UI.Addressbooks.overview);
$('#bottomcontrols .settings').on('click keydown', function() {
- OC.appSettings({appid:'contacts'});
+ try {
+ OC.appSettings({appid:'contacts', loadJS:true, cache:false});
+ } catch(e) {
+ console.log('error:', e.message);
+ }
});
$('#bottomcontrols .import').click(function() {
$('#import_upload_start').trigger('click');
@@ -2045,7 +1949,7 @@ $(document).ready(function(){
$('#uploadprogressbar').progressbar('value',50);
var todo = uploadedfiles;
$.each(fileList, function(fileName, data) {
- Contacts.UI.Addressbooks.doImport(fileName, aid);
+ Contacts.UI.Contacts.doImport(fileName, aid);
delete fileList[fileName];
numfiles -= 1; uploadedfiles -= 1;
$('#uploadprogressbar').progressbar('value',50+(50/(todo-uploadedfiles)));
diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php
index 67dfe8f640f..3972d0e0a5e 100644
--- a/apps/contacts/lib/app.php
+++ b/apps/contacts/lib/app.php
@@ -22,16 +22,18 @@ class OC_Contacts_App {
public static $categories = null;
public static function getAddressbook($id) {
+ // TODO: Throw an exception instead of returning json.
$addressbook = OC_Contacts_Addressbook::find( $id );
if($addressbook === false || $addressbook['userid'] != OCP\USER::getUser()) {
if ($addressbook === false) {
OCP\Util::writeLog('contacts',
'Addressbook not found: '. $id,
OCP\Util::ERROR);
+ //throw new Exception('Addressbook not found: '. $id);
OCP\JSON::error(
array(
'data' => array(
- 'message' => self::$l10n->t('Addressbook not found.')
+ 'message' => self::$l10n->t('Addressbook not found: ' . $id)
)
)
);
@@ -40,6 +42,7 @@ class OC_Contacts_App {
OCP\Util::writeLog('contacts',
'Addressbook('.$id.') is not from '.OCP\USER::getUser(),
OCP\Util::ERROR);
+ //throw new Exception('This is not your addressbook.');
OCP\JSON::error(
array(
'data' => array(
diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php
index 7ff139e31c5..4c2a19e8d96 100644
--- a/apps/contacts/templates/index.php
+++ b/apps/contacts/templates/index.php
@@ -24,7 +24,6 @@
</div>
</div>
<div id="rightcontent" class="rightcontent" data-id="<?php echo $_['id']; ?>">
- <div id="appsettings" class="popup bottomleft hidden"></div>
<?php
if($_['has_contacts']) {
echo $this->inc('part.contact');
diff --git a/apps/contacts/templates/part.chooseaddressbook.php b/apps/contacts/templates/part.chooseaddressbook.php
deleted file mode 100644
index caed67736c5..00000000000
--- a/apps/contacts/templates/part.chooseaddressbook.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<div id="chooseaddressbook_dialog" title="<?php echo $l->t("Configure Address Books"); ?>">
-<table width="100%" style="border: 0;">
-<?php
-$option_addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser());
-for($i = 0; $i < count($option_addressbooks); $i++){
- echo "<tr>";
- $tmpl = new OCP\Template('contacts', 'part.chooseaddressbook.rowfields');
- $tmpl->assign('addressbook', $option_addressbooks[$i]);
- $tmpl->assign('active', OC_Contacts_Addressbook::isActive($option_addressbooks[$i]['id']));
- $tmpl->printpage();
- echo "</tr>";
-}
-?>
-<tr>
- <td colspan="5" style="padding: 0.5em;">
- <a class="button" href="#" onclick="Contacts.UI.Addressbooks.newAddressbook(this);"><?php echo $l->t('New Address Book') ?></a>
- </td>
-</tr>
-<tr>
- <td colspan="5">
- <p style="margin: 0 auto;width: 90%;"><input style="display:none;width: 90%;float: left;" type="text" id="carddav_url" onmouseover="$('#carddav_url').select();" title="<?php echo $l->t("CardDav Link"); ?>"><a class="action delete" id="carddav_url_close" style="height: 20px;vertical-align: middle;display: none;" title="close" onclick="$('#carddav_url').hide();$('#carddav_url_close').hide();"/></a></p>
- </td>
-</tr>
-</table>
diff --git a/apps/contacts/templates/part.chooseaddressbook.rowfields.php b/apps/contacts/templates/part.chooseaddressbook.rowfields.php
deleted file mode 100644
index 2988bb44c5f..00000000000
--- a/apps/contacts/templates/part.chooseaddressbook.rowfields.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<td width="20px">
- <input id="active_<?php echo $_['addressbook']["id"]; ?>" type="checkbox" onClick="Contacts.UI.Addressbooks.activation(this, <?php echo $_['addressbook']["id"]; ?>)" <?php echo (OC_Contacts_Addressbook::isActive($_['addressbook']["id"]) ? ' checked="checked"' : ''); ?>>
-</td>
-<td>
- <label for="active_<?php echo $_['addressbook']["id"]; ?>"><?php echo $_['addressbook']["displayname"]; ?></label>
-</td>
-<td width="20px">
- <a onclick="Contacts.UI.showCardDAVUrl('<?php echo OCP\USER::getUser(); ?>', '<?php echo rawurlencode(html_entity_decode($_['addressbook']['uri'], ENT_QUOTES, 'UTF-8')); ?>');" title="<?php echo $l->t("CardDav Link"); ?>" class="svg action globe"></a>
-</td>
-<td width="20px">
- <a href="<?php echo OCP\Util::linkTo('contacts', 'export.php'); ?>?bookid=<?php echo $_['addressbook']["id"]; ?>" title="<?php echo $l->t("Download"); ?>" class="svg action download"></a>
-</td>
-<td width="20px">
- <a title="<?php echo $l->t("Edit"); ?>" class="svg action edit" onclick="Contacts.UI.Addressbooks.editAddressbook(this, <?php echo $_['addressbook']["id"]; ?>);"></a>
-</td>
-<td width="20px">
- <a onclick="Contacts.UI.Addressbooks.deleteAddressbook(this, <?php echo $_['addressbook']["id"]; ?>);" title="<?php echo $l->t("Delete"); ?>" class="svg action delete"></a>
-</td>
diff --git a/apps/contacts/templates/part.contact.php b/apps/contacts/templates/part.contact.php
index 4233bffede3..3670ce0389b 100644
--- a/apps/contacts/templates/part.contact.php
+++ b/apps/contacts/templates/part.contact.php
@@ -1,3 +1,4 @@
+<div id="appsettings" class="popup bottomleft hidden"></div>
<?php
$id = isset($_['id']) ? $_['id'] : '';
?>
@@ -73,7 +74,7 @@ $id = isset($_['id']) ? $_['id'] : '';
<div id="phones">
<ul id="phonelist" class="propertylist">
<li class="template hidden" data-element="TEL">
- <input type="checkbox" class="contacts_property tip" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
+ <input type="checkbox" class="contacts_property tip" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
<input type="text" required="required" class="nonempty contacts_property" name="value" value="" placeholder="<?php echo $l->t('Enter phone number'); ?>" />
<select multiple="multiple" name="parameters[TYPE][]">
<?php echo OCP\html_select_options($_['phone_types'], array()) ?>
diff --git a/apps/contacts/templates/part.edit_address_dialog.php b/apps/contacts/templates/part.edit_address_dialog.php
index d5ea95ba465..81e24ba4d0e 100644
--- a/apps/contacts/templates/part.edit_address_dialog.php
+++ b/apps/contacts/templates/part.edit_address_dialog.php
@@ -57,6 +57,7 @@ $types = isset($_['types'])?$_['types']:array();
<input type="text" id="adr_country" name="value[ADR][6]" placeholder="<?php echo $l->t('Country'); ?>" value="<?php echo isset($adr[6])?$adr[6]:''; ?>">
</dd>
</dl>
+ <div style="width: 100%; text-align:center;">Powered by <a href="http://geonames.org/" target="_blank">geonames.org</a></div>
</fieldset>
</form>
</div>
diff --git a/apps/contacts/templates/part.no_contacts.php b/apps/contacts/templates/part.no_contacts.php
index 5faa481bc3c..be12092d45d 100644
--- a/apps/contacts/templates/part.no_contacts.php
+++ b/apps/contacts/templates/part.no_contacts.php
@@ -1,3 +1,4 @@
+<div id="appsettings" class="popup bottomleft hidden"></div>
<div id="firstrun">
<?php echo $l->t('You have no contacts in your addressbook.') ?>
<div id="selections">
diff --git a/apps/contacts/templates/settings.php b/apps/contacts/templates/settings.php
index c42de12fa74..85dbca36fac 100644
--- a/apps/contacts/templates/settings.php
+++ b/apps/contacts/templates/settings.php
@@ -6,13 +6,49 @@
<dd><code><?php echo OCP\Util::linkToRemote('carddav'); ?></code></dd>
<dt><?php echo $l->t('iOS/OS X'); ?></dt>
<dd><code><?php echo OCP\Util::linkToRemote('carddav'); ?>principals/<?php echo OCP\USER::getUser(); ?></code>/</dd>
- <dt><?php echo $l->t('Read only vCard directory link(s)'); ?></dt>
- <dd>
+ <dt class="hidden"><?php echo $l->t('Addressbooks'); ?></dt>
+ <dd class="addressbooks-settings hidden">
+ <table>
<?php foreach($_['addressbooks'] as $addressbook) { ?>
- <a href="<?php echo OCP\Util::linkToRemote('carddav').'addressbooks/'.OCP\USER::getUser().'/'.rawurlencode($addressbook['uri']) ?>?export"><?php echo $addressbook['displayname'] ?></a><br />
+ <tr class="addressbook" data-id="<?php echo $addressbook['id'] ?>" data-uri="<?php echo $addressbook['uri'] ?>">
+ <td class="active">
+ <input type="checkbox" <?php echo (($addressbook['active']) == '1' ? ' checked="checked"' : ''); ?> />
+ </td>
+ <td class="name"><?php echo $addressbook['displayname'] ?></td>
+ <td class="description"><?php echo $addressbook['description'] ?></td>
+ <td class="action">
+ <a class="svg action globe" title="<?php echo $l->t('Show CardDav link'); ?>"></a>
+ </td>
+ <td class="action">
+ <a class="svg action cloud" title="<?php echo $l->t('Show read-only VCF link'); ?>"></a>
+ </td>
+ <td class="action">
+ <a class="svg action download" title="<?php echo $l->t('Download'); ?>"
+ href="<?php echo OCP\Util::linkToRemote('carddav').'addressbooks/'.OCP\USER::getUser().'/'
+ .rawurlencode($addressbook['uri']) ?>?export"></a>
+ </td>
+ <td class="action">
+ <a class="svg action edit" title="<?php echo $l->t("Edit"); ?>"></a>
+ </td>
+ <td class="action">
+ <a class="svg action delete" title="<?php echo $l->t("Delete"); ?>"></a>
+ </td>
+ </tr>
<?php } ?>
+ </table>
+ <div class="actions" style="width: 100%;">
+ <input class="active hidden" type="checkbox" />
+ <button class="new"><?php echo $l->t('New Address Book') ?></button>
+ <input class="name hidden" type="text" autofocus="autofocus" placeholder="<?php echo $l->t('Name'); ?>" />
+ <input class="description hidden" type="text" placeholder="<?php echo $l->t('Description'); ?>" />
+ <input class="link hidden" style="width: 80%" type="text" autofocus="autofocus" />
+ <button class="save hidden"><?php echo $l->t('Save') ?></button>
+ <button class="cancel hidden"><?php echo $l->t('Cancel') ?></button>
+ </div>
</dd>
</dl>
- Powered by <a href="http://geonames.org/" target="_blank">geonames.org webservice</a>
+ <div style="width: 100%; clear: both;">
+ <button class="moreless"><?php echo $l->t('More...') ?></button>
+ </div>
</fieldset>
</form>