aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files/js/navigation.js12
-rw-r--r--apps/files/lib/Controller/ViewController.php63
-rw-r--r--apps/files/templates/appnavigation.php18
3 files changed, 42 insertions, 51 deletions
diff --git a/apps/files/js/navigation.js b/apps/files/js/navigation.js
index f7757751b8f..db39cac987e 100644
--- a/apps/files/js/navigation.js
+++ b/apps/files/js/navigation.js
@@ -151,11 +151,7 @@
$.get(OC.generateUrl("/apps/files/api/v1/showquickaccess"), {show: document.getElementById('enableQuickAccess').checked}, function(data, status){
});
- if(!$("#favorites-toggle" ).hasClass('open')){
- $("#favorites-toggle" ).addClass('open');
- }else{
- $("#favorites-toggle" ).removeClass('open');
- }
+ $("#favorites-toggle" ).toggleClass('open');
}
@@ -179,11 +175,7 @@
if(itemId==='enableQuickAccess' ){
$.get(OC.generateUrl("/apps/files/api/v1/showquickaccess"), {show: document.getElementById('enableQuickAccess').checked}, function(data, status){
});
- if(!$("#favorites-toggle" ).hasClass('open')){
- $("#favorites-toggle" ).addClass('open');
- }else{
- $("#favorites-toggle" ).removeClass('open');
- }
+ $("#favorites-toggle" ).toggleClass('open');
document.getElementById('menu-favorites').classList.toggle('open');
}
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php
index b427178ec57..787216e36a7 100644
--- a/apps/files/lib/Controller/ViewController.php
+++ b/apps/files/lib/Controller/ViewController.php
@@ -162,19 +162,18 @@ class ViewController extends Controller {
$user = $this->userSession->getUser()->getUID();
//Load QuickAccess-Defaults
- $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';
+ $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)) {
+ $quickAccessExpandedState = 'true';
+ } else {
+ $quickAccessExpandedState = 'false';
}
//Get Favorite-Folder
- $tagger=\OC::$server->getTagManager();
-
- $helper= new \OCA\Files\Activity\Helper($tagger);
+ $tagger = \OC::$server->getTagManager();
+ $helper = new \OCA\Files\Activity\Helper($tagger);
try {
$favElements = $helper->getFavoriteFilePaths($this->userSession->getUser()->getUID());
@@ -182,11 +181,11 @@ class ViewController extends Controller {
$favElements['folders'] = null;
}
- $FavoritesFolderCount=sizeof($favElements['folders']);
+ $favoritesFolderCount = sizeof($favElements['folders']);
- $collapsClasses='';
- if($FavoritesFolderCount>0){
- $collapsClasses='collapsible';
+ $collapseClasses = '';
+ if ($favoritesFolderCount > 0) {
+ $collapseClasses = 'collapsible';
}
\OCA\Files\App::getNavigationManager()->add(
@@ -194,61 +193,61 @@ class ViewController extends Controller {
'id' => 'favorites',
'appname' => 'files',
'script' => 'simplelist.php',
- 'classes' => $collapsClasses,
- 'enableQuickaccess' => $expanded,
+ 'classes' => $collapseClasses,
+ 'enableQuickaccess' => $quickAccessExpandedState,
'quickaccessSortingStrategy' => $sorting,
'quickaccessSortingReverse' => $reverseListSetting,
'order' => 5,
'name' => $this->l10n->t('Favorites'),
//If there are zero elements, add ul end tag directly.
- 'favoritescount' => $FavoritesFolderCount
+ 'favoritescount' => $favoritesFolderCount
]
);
//Add Favorite-folder as menuentries, if there are any
- if($FavoritesFolderCount>0){
+ if ($favoritesFolderCount > 0) {
- $NavBarPositionPosition=6;
- $currentCount=0;
- foreach($favElements['folders'] as $elem){
+ $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;
+ $id = substr($elem, strrpos($elem, '/') + 1, strlen($elem));
+ $link = $this->urlGenerator->linkToRouteAbsolute('files.view.index', ['dir' => $elem]);
- $SortingValue=++$currentCount;
- if($currentCount!=$FavoritesFolderCount){
+ $sortingValue = ++$currentCount;
+ if ($currentCount != $favoritesFolderCount) {
\OCA\Files\App::getNavigationManager()->add(
[
'id' => $id,
'href' => $link,
- 'order' => $NavBarPositionPosition,
- 'folderPosition' => $SortingValue,
+ 'order' => $navBarPositionPosition,
+ 'folderPosition' => $sortingValue,
'name' => $id,
'icon' => 'files',
'quickaccesselement' => 'true'
]
);
- }else{
+ } else {
\OCA\Files\App::getNavigationManager()->add(
[
'id' => $id,
'href' => $link,
- 'order' => $NavBarPositionPosition,
- 'folderPosition' => $SortingValue,
+ 'order' => $navBarPositionPosition,
+ 'folderPosition' => $sortingValue,
'name' => $id,
'icon' => 'files',
'quickaccesselement' => 'last'
]
);
}
- $NavBarPositionPosition++;
+ $navBarPositionPosition++;
}
}
$navItems = \OCA\Files\App::getNavigationManager()->getAll();
- usort($navItems, function($item1, $item2) {
+ usort($navItems, function ($item1, $item2) {
return $item1['order'] - $item2['order'];
});
@@ -289,7 +288,7 @@ class ViewController extends Controller {
$params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
$params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
$params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc');
- $showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
+ $showHidden = (bool)$this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
$params['showHiddenFiles'] = $showHidden ? 1 : 0;
$params['fileNotFound'] = $fileNotFound ? 1 : 0;
$params['appNavigation'] = $nav;
diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php
index f88bf7866f4..7bf92995de6 100644
--- a/apps/files/templates/appnavigation.php
+++ b/apps/files/templates/appnavigation.php
@@ -7,17 +7,17 @@
?>
<li data-id="<?php p(isset($item['href']) ? $item['href'] : $item['id']) ?>"
- class="nav-<?php p($item['id']) ?> <?php p($item['classes']) ?> <?php p($pinned===1?'first-pinned':'') ?> <?php if($item['enableQuickaccess']=='true'){ ?> open<?php } ?>"
- <?php if(isset($item['folderPosition'])){ ?> folderPos="<?php p($item['folderPosition']);?>"<?php } ?>
- <?php if($item['id']=='favorites'){?>id="favorites-toggle"<?php } ?>>
+ class="nav-<?php p($item['id']) ?> <?php p($item['classes']) ?> <?php p($pinned===1?'first-pinned':'') ?> <?php if ($item['enableQuickaccess'] === 'true') { ?> open<?php } ?>"
+ <?php if (isset($item['folderPosition'])){ ?> folderPos="<?php p($item['folderPosition']);?>"<?php } ?>
+ <?php if ($item['id'] === 'favorites'){?>id="favorites-toggle"<?php } ?>>
- <?php if($item['id']=='favorites'){?>
- <button id="button-collapseQuickAccess" class="collapse" <?php if($item['favoritescount']==0){ ?> style="display: none"<?php } ?>></button><?php } ?>
+ <?php if ($item['id'] === 'favorites'){?>
+ <button id="button-collapseQuickAccess" class="collapse" <?php if ($item['favoritescount'] === 0){ ?> style="display: none"<?php } ?>></button><?php } ?>
<a href="<?php p(isset($item['href']) ? $item['href'] : '#') ?>"
class="nav-icon-<?php p($item['icon'] !== '' ? $item['icon'] : $item['id']) ?> svg"><?php p($item['name']);?></a>
- <?php if($item['id']=='favorites'){?>
- <div id="quickaccessbutton" class="app-navigation-entry-utils" <?php if($item['favoritescount']==0){ ?> style="display: none"<?php } ?>>
+ <?php if ($item['id'] === 'favorites') {?>
+ <div id="quickaccessbutton" class="app-navigation-entry-utils" <?php if ($item['favoritescount'] === 0) { ?> style="display: none"<?php } ?>>
<ul>
<li class="app-navigation-entry-utils-menu-button svg">
<button id="button-<?php p($item['id']) ?>"></button>
@@ -53,10 +53,10 @@
</ul>
</div>
<ul id="quickaccess-list" >
- <?php /*This fixes the styleerrors if no favorites are set*/ if($item['favoritescount']==0){?></ul><?php } ?>
+ <?php /*This fixes the styleerrors if no favorites are set*/ if ($item['favoritescount'] === 0) {?></ul><?php } ?>
<?php } ?>
- <?php if($item['quickaccesselement']=='last'){?>
+ <?php if ($item['quickaccesselement'] === 'last') {?>
</ul>
<?php } ?>
</li>