diff --git a/3rdparty b/3rdparty index 4b46a9176e392..b0f180458ab55 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit 4b46a9176e392932702be12060a8c5899e092174 +Subproject commit b0f180458ab55af9d6a1550f2b62dee3fdc6e1ef diff --git a/apps/files/js/navigation.js b/apps/files/js/navigation.js index d4fa06cb45ef5..cb336b4ba3adc 100644 --- a/apps/files/js/navigation.js +++ b/apps/files/js/navigation.js @@ -39,18 +39,6 @@ */ $currentContent: null, - /** - * Strategy by which the quickaccesslist is sorted - * - * Possible Strategies: - * customorder - * datemodified - * date - * alphabet - * - */ - $sortingStrategy: 'alphabet', - /** * Key for the quick-acces-list */ @@ -66,13 +54,7 @@ this._activeItem = null; this.$currentContent = null; this._setupEvents(); - - var scope=this; - $.get(OC.generateUrl("/apps/files/api/v1/quickaccess/get/SortingStrategy"), function (data, status) { - scope.$sortingStrategy=data; - scope.setInitialQuickaccessSettings(); - }); - + this.setInitialQuickaccessSettings(); }, /** @@ -210,56 +192,8 @@ * Sort initially as setup of sidebar for QuickAccess */ setInitialQuickaccessSettings: function () { - - var quickAccesKey = this.$quickAccessListKey; - var list = document.getElementById(quickAccesKey).getElementsByTagName('li'); - - var sort = true; - var reverse = false; - if (this.$sortingStrategy === 'datemodified') { - sort = false; - reverse = false; - - var scope = this; - $.get(OC.generateUrl("/apps/files/api/v1/quickaccess/get/FavoriteFolders/"), function (data, status) { - for (var i = 0; i < data.favoriteFolders.length; i++) { - for (var j = 0; j < list.length; j++) { - if (scope.getCompareValue(list, j, 'alphabet').toLowerCase() === data.favoriteFolders[i].name.toLowerCase()) { - list[j].setAttribute("mtime", data.favoriteFolders[i].mtime); - } - } - } - scope.QuickSort(list, 0, list.length - 1); - scope.reverse(list); - }); - - } else if (this.$sortingStrategy === 'alphabet') { - sort = true; - } else if (this.$sortingStrategy === 'date') { - sort = true; - } else if (this.$sortingStrategy === 'customorder') { - var scope = this; - $.get(OC.generateUrl("/apps/files/api/v1/quickaccess/get/CustomSortingOrder"), function (data, status) { - var ordering = JSON.parse(data); - for (var i = 0; i < ordering.length; i++) { - for (var j = 0; j < list.length; j++) { - if (scope.getCompareValue(list, j, 'alphabet').toLowerCase() === ordering[i].name.toLowerCase()) { - list[j].setAttribute("folderPosition", ordering[i].id); - } - } - } - scope.QuickSort(list, 0, list.length - 1); - }); - sort = false; - } - - if (sort) { - this.QuickSort(list, 0, list.length - 1); - } - if (reverse) { - this.reverse(list); - } - + var list = document.getElementById( this.$quickAccessListKey).getElementsByTagName('li'); + this.QuickSort(list, 0, list.length - 1); }, /** @@ -308,21 +242,7 @@ * This method allows easy access to the element which is sorted by. */ getCompareValue: function (nodes, int, strategy) { - - if ((typeof strategy === 'undefined')) { - strategy = this.$sortingStrategy; - } - - if (strategy === 'alphabet') { return nodes[int].getElementsByTagName('a')[0].innerHTML.toLowerCase(); - } else if (strategy === 'date') { - return nodes[int].getAttribute('folderPosition').toLowerCase(); - } else if (strategy === 'datemodified') { - return nodes[int].getAttribute('mtime'); - } else if (strategy === 'customorder') { - return nodes[int].getAttribute('folderPosition'); - } - return nodes[int].getElementsByTagName('a')[0].innerHTML.toLowerCase(); }, /** @@ -332,16 +252,6 @@ swap: function (list, j, i) { list[i].before(list[j]); list[j].before(list[i]); - }, - - /** - * Reverse QuickAccess-List - */ - reverse: function (list) { - var len = list.length - 1; - for (var i = 0; i < len / 2; i++) { - this.swap(list, i, len - i); - } } }; diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php index aae1bec2e7894..20d900e7a08b6 100644 --- a/apps/files/lib/Controller/ApiController.php +++ b/apps/files/lib/Controller/ApiController.php @@ -199,30 +199,6 @@ public function getRecentFiles() { return new DataResponse(['files' => $files]); } - /** - * Returns a list of favorites modifed folder. - * - * @NoAdminRequired - * - * @return DataResponse - */ - public function getFavoritesFolder() { - $nodes = $this->userFolder->searchByTag('_$!!$_', $this->userSession->getUser()->getUID()); - - $favorites = []; - $i = 0; - foreach ($nodes as &$node) { - - $favorites[$i]['id'] = $node->getId(); - $favorites[$i]['name'] = $node->getName(); - $favorites[$i]['path'] = $node->getInternalPath(); - $favorites[$i]['mtime'] = $node->getMTime(); - $i++; - } - - return new DataResponse(['favoriteFolders' => $favorites]); - } - /** * Return a list of share types for outgoing shares * @@ -284,6 +260,7 @@ public function updateFileSorting($mode, $direction) { * @NoAdminRequired * * @param bool $show + * @return Response */ public function showHiddenFiles($show) { $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', (int)$show); @@ -316,108 +293,6 @@ public function getShowQuickAccess() { return $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', 0); } - /** - * quickaccess-sorting-strategy - * - * @NoAdminRequired - * - * @param string $strategy - * @return Response - */ - public function setSortingStrategy($strategy) { - $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_sorting_strategy', (String)$strategy); - return new Response(); - } - - /** - * Get reverse-state for quickaccess-list - * - * @NoAdminRequired - * - * @return String - */ - public function getSortingStrategy() { - return $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_sorting_strategy', 'alphabet'); - } - - /** - * Toggle for reverse quickaccess-list - * - * @NoAdminRequired - * - * @param bool $reverse - * @return Response - */ - public function setReverseQuickaccess($reverse) { - $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_reverse_list', (int)$reverse); - return new Response(); - } - - /** - * Get reverse-state for quickaccess-list - * - * @NoAdminRequired - * - * @return bool - */ - public function getReverseQuickaccess() { - if ($this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_reverse_list', false)) { - return true; - } - return false; - } - - /** - * Set state for show sorting menu - * - * @NoAdminRequired - * - * @param bool $show - * @return Response - */ - public function setShowQuickaccessSettings($show) { - $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_show_settings', (int)$show); - return new Response(); - } - - /** - * Get state for show sorting menu - * - * @NoAdminRequired - * - * @return bool - */ - public function getShowQuickaccessSettings() { - if ($this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_show_settings', false)) { - return true; - } - return false; - } - - /** - * Set sorting-order for custom sorting - * - * @NoAdminRequired - * - * @param String $order - * @return Response - */ - public function setSortingOrder($order) { - $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_custom_sorting_order', (String)$order); - return new Response(); - } - - /** - * Get sorting-order for custom sorting - * - * @NoAdminRequired - * - * @return String - */ - public function getSortingOrder() { - return $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'quickaccess_custom_sorting_order', ""); - } - /** * Get sorting-order for custom sorting *