From 3f492dd82681ca92e9e86acfcf1c15dfcfcf34cf Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Tue, 12 Apr 2016 10:19:52 +0200 Subject: [PATCH] load file sorting mode from the db --- apps/files/controller/viewcontroller.php | 1 + apps/files/js/app.js | 3 ++- apps/files/js/filelist.js | 6 +++++- apps/files/templates/index.php | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/files/controller/viewcontroller.php b/apps/files/controller/viewcontroller.php index 800cf008fa..b71c8e38a7 100644 --- a/apps/files/controller/viewcontroller.php +++ b/apps/files/controller/viewcontroller.php @@ -213,6 +213,7 @@ class ViewController extends Controller { $params['mailNotificationEnabled'] = $this->config->getAppValue('core', 'shareapi_allow_mail_notification', 'no'); $params['mailPublicNotificationEnabled'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no'); $params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes'); + $params['defaultFileSorting'] = $this->config->getAppValue('files', 'file_sorting', 'name'); $params['appNavigation'] = $nav; $params['appContents'] = $contentItems; $this->navigationManager->setActiveEntry('files_index'); diff --git a/apps/files/js/app.js b/apps/files/js/app.js index ff505d417f..8662cd7c85 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -72,7 +72,8 @@ fileActions: fileActions, allowLegacyActions: true, scrollTo: urlParams.scrollto, - filesClient: OC.Files.getClient() + filesClient: OC.Files.getClient(), + sorting: $('#defaultFileSorting').val() } ); this.files.initialize(); diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 71af4a21b9..322dfcaa66 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -239,7 +239,11 @@ this.fileSummary = this._createSummary(); - this.setSort('name', 'asc'); + if (options.sorting) { + this.setSort(options.sorting, 'asc'); + } else { + this.setSort('name', 'asc'); + } var breadcrumbOptions = { onClick: _.bind(this._onClickBreadCrumb, this), diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index e825c300d3..c108c6f061 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -18,4 +18,5 @@ +