diff options
-rw-r--r-- | settings/Controller/AppSettingsController.php | 22 | ||||
-rw-r--r-- | settings/js/apps.js | 17 |
2 files changed, 32 insertions, 7 deletions
diff --git a/settings/Controller/AppSettingsController.php b/settings/Controller/AppSettingsController.php index 6a5b5210c0f..89cf5b6b7da 100644 --- a/settings/Controller/AppSettingsController.php +++ b/settings/Controller/AppSettingsController.php @@ -49,6 +49,7 @@ use OCP\L10N\IFactory; class AppSettingsController extends Controller { const CAT_ENABLED = 0; const CAT_DISABLED = 1; + const CAT_ALL_INSTALLED = 2; /** @var \OCP\IL10N */ private $l10n; @@ -103,7 +104,7 @@ class AppSettingsController extends Controller { */ public function viewApps($category = '') { if ($category === '') { - $category = 'enabled'; + $category = 'installed'; } $params = []; @@ -128,6 +129,7 @@ class AppSettingsController extends Controller { $currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2); $formattedCategories = [ + ['id' => self::CAT_ALL_INSTALLED, 'ident' => 'installed', 'displayName' => (string)$this->l10n->t('All installed')], ['id' => self::CAT_ENABLED, 'ident' => 'enabled', 'displayName' => (string)$this->l10n->t('Enabled')], ['id' => self::CAT_DISABLED, 'ident' => 'disabled', 'displayName' => (string)$this->l10n->t('Not enabled')], ]; @@ -270,6 +272,24 @@ class AppSettingsController extends Controller { switch ($category) { // installed apps + case 'installed': + $apps = $appClass->listAllApps(); + + foreach($apps as $key => $app) { + $newVersion = \OC\Installer::isUpdateAvailable($app['id'], $this->appFetcher); + $apps[$key]['update'] = $newVersion; + } + + usort($apps, function ($a, $b) { + $a = (string)$a['name']; + $b = (string)$b['name']; + if ($a === $b) { + return 0; + } + return ($a < $b) ? -1 : 1; + }); + break; + // enabled apps case 'enabled': $apps = $appClass->listAllApps(); $apps = array_filter($apps, function ($app) { diff --git a/settings/js/apps.js b/settings/js/apps.js index 3d94a128d3f..bde069e1b27 100644 --- a/settings/js/apps.js +++ b/settings/js/apps.js @@ -41,7 +41,8 @@ OC.Settings.Apps = OC.Settings.Apps || { var categories = [ {displayName: t('settings', 'Enabled'), ident: 'enabled', id: '0'}, - {displayName: t('settings', 'Not enabled'), ident: 'disabled', id: '1'} + {displayName: t('settings', 'Not enabled'), ident: 'disabled', id: '1'}, + {displayName: t('settings', 'All installed'), ident: 'installed', id: '2'} ]; var source = $("#categories-template").html(); @@ -95,7 +96,7 @@ OC.Settings.Apps = OC.Settings.Apps || { return _.extend({level: 0}, app); }); var source - if (categoryId === 'enabled' || categoryId === 'disabled') { + if (categoryId === 'enabled' || categoryId === 'disabled' || categoryId === 'installed') { source = $("#app-template-installed").html(); $('#apps-list').addClass('installed'); } else { @@ -106,11 +107,15 @@ OC.Settings.Apps = OC.Settings.Apps || { if (appList.length) { appList.sort(function(a,b) { - var levelDiff = b.level - a.level; - if (levelDiff === 0) { - return OC.Util.naturalSortCompare(a.name, b.name); + if (a.active !== b.active) { + return (a.active ? -1 : 1) + } else { + var levelDiff = b.level - a.level; + if (levelDiff === 0) { + return OC.Util.naturalSortCompare(a.name, b.name); + } + return levelDiff; } - return levelDiff; }); var firstExperimental = false; |