From 830efdccac71ebbd4ee5f9414abd0878f2ff9349 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Mon, 5 Dec 2011 03:38:06 +0100 Subject: Fixed adding, editing and deleting address books. One minor UI flaw remains. --- apps/contacts/ajax/createaddressbook.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 apps/contacts/ajax/createaddressbook.php (limited to 'apps/contacts/ajax/createaddressbook.php') diff --git a/apps/contacts/ajax/createaddressbook.php b/apps/contacts/ajax/createaddressbook.php new file mode 100644 index 00000000000..3dd38703c17 --- /dev/null +++ b/apps/contacts/ajax/createaddressbook.php @@ -0,0 +1,26 @@ + + * Copyright (c) 2011 Bart Visscher + * 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'); + +$userid = OC_User::getUser(); +$bookid = OC_Contacts_Addressbook::add($userid, $_POST['name'], null); +OC_Contacts_Addressbook::setActive($bookid, 1); +$book = OC_Contacts_Addressbook::find($bookid); +$tmpl = new OC_Template('contacts', 'part.chooseaddressbook.rowfields'); +$tmpl->assign('addressbook', $book); +OC_JSON::success(array( + 'page' => $tmpl->fetchPage(), + 'bookid' => $bookid, +)); -- cgit v1.2.3