From 0aa879dc45c801853ac7e8ffdeeefe0fcb464f0c Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Mon, 1 Apr 2013 03:44:46 +0200 Subject: [PATCH] Contacts: Load a server-side generated js script with preferences. --- appinfo/routes.php | 3 +++ js/config.php | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 js/config.php diff --git a/appinfo/routes.php b/appinfo/routes.php index b677a24c..80cbc7b8 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -20,6 +20,9 @@ $this->create('contacts_index', '/') // } // ); +$this->create('contacts_jsconfig', 'ajax/config.js') + ->actionInclude('contacts/js/config.php'); + /* TODO: - Check what it requires to be a RESTful API. I think maybe {user} shouldn't be in the URI but be authenticated in headers or elsewhere. diff --git a/js/config.php b/js/config.php new file mode 100644 index 00000000..f693e29a --- /dev/null +++ b/js/config.php @@ -0,0 +1,25 @@ + + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see . + * + */ + +OCP\JSON::setContentTypeHeader('text/javascript'); +OCP\JSON::checkLoggedIn(); +OCP\JSON::checkAppEnabled('contacts');