]> source.dussan.org Git - nextcloud-server.git/commitdiff
External JSON for the Apps
authorLukas Reschke <lukas@statuscode.ch>
Mon, 21 Jan 2013 21:18:42 +0000 (22:18 +0100)
committerLukas Reschke <lukas@statuscode.ch>
Mon, 21 Jan 2013 21:18:42 +0000 (22:18 +0100)
settings/apps.php
settings/js/apps-custom.php [new file with mode: 0644]
settings/routes.php
settings/templates/apps.php

index 9de7bdc80a7d7e00246f66ce24314cb4b71ba83b..384e92bfbb7607b3718630570192138650803ec6 100644 (file)
@@ -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 (file)
index 0000000..e0e7a2d
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Copyright (c) 2013 Lukas Reschke <lukas@statuscode.ch>
+ * 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
index bac1f61fc50eba1b1a8aac8829f3496b3df08226..1c766837dd1f1b1ad569c2c904cf771046d31e67 100644 (file)
@@ -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');
index 0490f63fb67fd61f7c43335094c9f96c66de02b4..98b0e6c725c7825b2dd111a21749bd520db86aca 100644 (file)
@@ -3,9 +3,8 @@
  * This file is licensed under the Affero General Public License version 3 or later.
  * See the COPYING-README file.
  */?>
-<script type='text/javascript'>
-       var appid = '<?php echo $_['appid']; ?>';
-</script>
+ <script type="text/javascript" src="<?php echo OC_Helper::linkToRoute('apps_custom');?>"></script>
+
 <div id="controls">
        <a class="button" target="_blank" href="http://owncloud.org/dev/apps/getting-started/"><?php echo $l->t('Add your App');?></a>
        <a class="button" target="_blank" href="http://apps.owncloud.com"><?php echo $l->t('More Apps');?></a>
@@ -15,9 +14,6 @@
        <li <?php if($app['active']) echo 'class="active"'?> data-id="<?php echo $app['id'] ?>" <?php if ( isset( $app['ocs_id'] ) ) { echo "data-id-ocs=\"{$app['ocs_id']}\""; } ?>
                data-type="<?php echo $app['internal'] ? 'internal' : 'external' ?>" data-installed="1">
                <a class="app<?php if(!$app['internal']) echo ' externalapp' ?>" href="?appid=<?php echo $app['id'] ?>"><?php echo htmlentities($app['name']) ?></a>
-               <script>
-                       appData_<?php echo $app['id'] ?>=<?php OC_JSON::encodedPrint($app, false) ?>;
-               </script>
                <?php  if(!$app['internal']) echo '<small class="externalapp list">3rd party</small>' ?>
        </li>
        <?php endforeach;?>
@@ -32,4 +28,4 @@
        <p class="license hidden"><?php echo $l->t('<span class="licence"></span>-licensed by <span class="author"></span>');?></p>
        <input class="enable hidden" type="submit" />
        </div>
-</div>
+</div>
\ No newline at end of file