From d2383338ded4fb980737062234584b29c284a4d5 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Mon, 21 Jan 2013 22:18:42 +0100 Subject: [PATCH] External JSON for the Apps --- settings/apps.php | 1 + settings/js/apps-custom.php | 24 ++++++++++++++++++++++++ settings/routes.php | 2 ++ settings/templates/apps.php | 10 +++------- 4 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 settings/js/apps-custom.php diff --git a/settings/apps.php b/settings/apps.php index 9de7bdc80a7..384e92bfbb7 100644 --- a/settings/apps.php +++ b/settings/apps.php @@ -42,6 +42,7 @@ function app_sort( $a, $b ) { } +$combinedApps = OC_App::listAllApps(); usort( $combinedApps, 'app_sort' ); $tmpl = new OC_Template( "settings", "apps", "user" ); diff --git a/settings/js/apps-custom.php b/settings/js/apps-custom.php new file mode 100644 index 00000000000..e0e7a2d6c79 --- /dev/null +++ b/settings/js/apps-custom.php @@ -0,0 +1,24 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +// Check if admin user +OC_Util::checkAdminUser(); + +// Set the content type to JSON +header('Content-type: application/json'); + +// Disallow caching +header("Cache-Control: no-cache, must-revalidate"); +header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); + +$combinedApps = OC_App::listAllApps(); + +foreach($combinedApps as $app) { + echo("appData_".$app['id']."=".json_encode($app)); + echo("\n"); +} \ No newline at end of file diff --git a/settings/routes.php b/settings/routes.php index bac1f61fc50..1c766837dd1 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -53,6 +53,8 @@ $this->create('settings_ajax_disableapp', '/settings/ajax/disableapp.php') ->actionInclude('settings/ajax/disableapp.php'); $this->create('settings_ajax_navigationdetect', '/settings/ajax/navigationdetect.php') ->actionInclude('settings/ajax/navigationdetect.php'); +$this->create('apps_custom', '/settings/js/apps-custom.js') + ->actionInclude('settings/js/apps-custom.php'); // admin $this->create('settings_ajax_getlog', '/settings/ajax/getlog.php') ->actionInclude('settings/ajax/getlog.php'); diff --git a/settings/templates/apps.php b/settings/templates/apps.php index 0490f63fb67..98b0e6c725c 100644 --- a/settings/templates/apps.php +++ b/settings/templates/apps.php @@ -3,9 +3,8 @@ * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file. */?> - + +
t('Add your App');?> t('More Apps');?> @@ -15,9 +14,6 @@
  • data-id="" data-type="" data-installed="1"> - 3rd party' ?>
  • @@ -32,4 +28,4 @@
    - + \ No newline at end of file