summaryrefslogtreecommitdiffstats
path: root/apps/contacts/ajax/updateaddressbook.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/contacts/ajax/updateaddressbook.php')
-rw-r--r--apps/contacts/ajax/updateaddressbook.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/contacts/ajax/updateaddressbook.php b/apps/contacts/ajax/updateaddressbook.php
new file mode 100644
index 00000000000..ccf1cef03f7
--- /dev/null
+++ b/apps/contacts/ajax/updateaddressbook.php
@@ -0,0 +1,26 @@
+<?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.
+ */
+
+require_once('../../../lib/base.php');
+
+$l10n = new OC_L10N('contacts');
+
+// Check if we are a user
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('contacts');
+
+$bookid = $_POST['id'];
+OC_Contacts_Addressbook::edit($bookid, $_POST['name'], null);
+OC_Contacts_Addressbook::setActive($bookid, $_POST['active']);
+$addressbook = OC_Contacts_Addressbook::find($bookid);
+$tmpl = new OC_Template('contacts', 'part.chooseaddressbook.rowfields');
+$tmpl->assign('book', $book);
+OC_JSON::success(array(
+ 'page' => $tmpl->fetchPage(),
+ 'addressbook' => $addressbook,
+));