diff options
Diffstat (limited to 'apps/files/lib/Controller/ViewController.php')
-rw-r--r-- | apps/files/lib/Controller/ViewController.php | 91 |
1 files changed, 51 insertions, 40 deletions
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 54602839eb0..11a42fb5291 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -159,58 +159,73 @@ class ViewController extends Controller { // FIXME: Make non static $storageInfo = $this->getStorageInfo(); + $user = $this->userSession->getUser()->getUID(); + + $sorting=$this->config->getUserValue($user,$this->appName,'quickaccess_sorting_strategy','date'); + $reverseListSetting=$this->config->getUserValue($user,$this->appName,'quickaccess_reverse_list','false'); + if($this->config->getUserValue($user,$this->appName,'show_Quick_Access',true)){ + $expanded='true'; + }else{ + $expanded='false'; + } \OCA\Files\App::getNavigationManager()->add( [ 'id' => 'favorites', 'appname' => 'files', 'script' => 'simplelist.php', + 'enableQuickaccess' => $expanded, + 'quickaccessSortingStrategy' => $sorting, + 'quickaccessSortingReverse' => $reverseListSetting, 'order' => 5, 'name' => $this->l10n->t('Favorites') ] ); - - - $user = $this->userSession->getUser()->getUID(); - $tagger=\OC::$server->getTagManager(); - $helper= new \OCA\Files\Activity\Helper($tagger); $favElements = $helper->getFavoriteFilePaths($this->userSession->getUser()->getUID()); - $favItems = $favElements['items']; - - $key='show_Quick_Access'; - - if($this->config->getUserValue($user,$this->appName,$key,true) && sizeof($favElements['folders'])>0){ - /*$nav->assign('showQuickAccess', 1); - \OCA\Files\App::getNavigationManager()->add( - [ - 'id' => 'Spacer', - 'classes' => 'app-navigation-caption', - 'order' => 6, - 'name' => $this->l10n->t('Quick-Access') - ] - );*/ - - $i=0; - foreach($favElements['folders'] as $elem){ - - \OCA\Files\App::getNavigationManager()->add( - [ - 'id' => substr( $elem, strrpos($elem,'/')+1, strlen($elem)), - 'href' => \OC::$WEBROOT.'/index.php/apps/files/?dir='.$elem, - 'order' => 7+$i, - 'classes' => 'app-navigation-subelement', - 'name' => substr( $elem, strrpos($elem,'/')+1, strlen($elem)), - 'icon' => 'files' - ] - ); - $i++; - } - } + $FavoritesFolderCount=sizeof($favElements['folders']); + if($FavoritesFolderCount>0){ + + $NavBarPositionPosition=6; + $currentCount=0; + foreach($favElements['folders'] as $elem){ + + $id=substr( $elem, strrpos($elem,'/')+1, strlen($elem)); + $link=\OC::$WEBROOT.'/index.php/apps/files/?dir='.$elem; + + $SortingValue=++$currentCount; + if($currentCount!=$FavoritesFolderCount){ + \OCA\Files\App::getNavigationManager()->add( + [ + 'id' => $id, + 'href' => $link, + 'order' => $NavBarPositionPosition, + 'folderPosition' => $SortingValue, + 'name' => $id, + 'icon' => 'files', + 'quickaccesselement' => 'true' + ] + ); + }else{ + \OCA\Files\App::getNavigationManager()->add( + [ + 'id' => $id, + 'href' => $link, + 'order' => $NavBarPositionPosition, + 'folderPosition' => $SortingValue, + 'name' => $id, + 'icon' => 'files', + 'quickaccesselement' => 'last' + ] + ); + } + $NavBarPositionPosition++; + } + } $navItems = \OCA\Files\App::getNavigationManager()->getAll(); @@ -218,10 +233,6 @@ class ViewController extends Controller { return $item1['order'] - $item2['order']; }); - - - - $nav->assign('navigationItems', $navItems); $nav->assign('usage', \OC_Helper::humanFileSize($storageInfo['used'])); |