diff options
-rw-r--r-- | js/settings.admin.js | 13 | ||||
-rw-r--r-- | lib/AppInfo/Application.php | 29 | ||||
-rw-r--r-- | lib/Provider/SearchProvider.php | 114 | ||||
-rw-r--r-- | lib/Service/ConfigService.php | 1 | ||||
-rw-r--r-- | templates/settings.admin.php | 8 |
5 files changed, 8 insertions, 157 deletions
diff --git a/js/settings.admin.js b/js/settings.admin.js index 1ea1344..f5da692 100644 --- a/js/settings.admin.js +++ b/js/settings.admin.js @@ -166,8 +166,6 @@ $(document) index_live : ($('#solr_index_live') .is(':checked')) ? 1 : 0, index_delay : $('#solr_index_delay').val(), - display_result : $('#solr_display_result') - .val(), replace_core_search : ($('#solr_replace_core_search') .is(':checked')) ? 1 : 0, force_index : force_index @@ -286,12 +284,7 @@ $(document) $('#solr_index_live_queuekey').val( response.index_live_queuekey); $('#solr_index_delay').val(response.index_delay); - - $( - '#solr_display_result option[value="' - + response.display_result + '"]') - .prop('selected', true); - + $('#solr_replace_core_search').prop('checked', (response.replace_core_search == 1)); if (response.index_files_tree == 1) { @@ -669,9 +662,7 @@ $(document) $('#solr_index_delay').on('input', function(e) { nextantSettings.savesuboptions_status(); }); - $('#solr_display_result').on('change', function() { - nextantSettings.savesuboptions_status(); - }); + $('#solr_replace_core_search') .mousedown( function() { diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index e1c11c5..76a6c51 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -205,30 +205,11 @@ class Application extends App if ($config->getAppValue('configured') !== '1') return; - switch ($config->getAppValue('display_result')) { - - case ConfigService::SEARCH_DISPLAY_NEXTANT: - - \OC::$server->getEventDispatcher()->addListener('OCA\Files::loadAdditionalScripts', function () { - \OCP\Util::addScript('nextant', 'navigate'); - \OCP\Util::addStyle('nextant', 'navigate'); - }); - - if ($config->getAppValue('index_files_sharelink') === '1') - \OC::$server->getEventDispatcher()->addListener('OCA\Files_Sharing::loadAdditionalScripts', function () { - \OCP\Util::addScript('nextant', 'navigate_sharelink'); - \OCP\Util::addStyle('nextant', 'navigate'); - }); - break; - - case ConfigService::SEARCH_DISPLAY_FILES: - \OC::$server->getSearch()->registerProvider('\OCA\Nextant\Provider\SearchProvider', array( - 'apps' => array( - 'files' - ) - )); - break; - } + if ($config->getAppValue('index_files_sharelink') === '1') + \OC::$server->getEventDispatcher()->addListener('OCA\Files_Sharing::loadAdditionalScripts', function () { + \OCP\Util::addScript('nextant', 'navigate_sharelink'); + \OCP\Util::addStyle('nextant', 'navigate'); + }); } public function registerSettingsAdmin() diff --git a/lib/Provider/SearchProvider.php b/lib/Provider/SearchProvider.php deleted file mode 100644 index e9a06e8..0000000 --- a/lib/Provider/SearchProvider.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php - -/** - * Nextcloud - nextant - * - * This file is licensed under the Affero General Public License version 3 or - * later. See the COPYING file. - * - * @author Maxence Lange <maxence@pontapreta.net> - * @copyright Maxence Lange 2016 - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -namespace OCA\Nextant\Provider; - -use OCP\Search\Provider; -use \OCA\Nextant\Service\FileService; - -class SearchProvider extends \OCP\Search\Provider -{ - - private $orig; - - private $app; - - private $miscService; - - private $solrService; - - private $userId; - - public function __construct() - { - $app = new \OCA\Nextant\AppInfo\Application(); - $container = $app->getContainer(); - - $this->app = $app; - $this->miscService = $container->query('MiscService'); - $this->solrService = $container->query('SolrService'); - $this->userId = $container->query('UserId'); - $this->groupManager = $container->query('GroupManager'); - - // $groups - $groups = array_map(function ($value) { - return (string) $value; - }, array_keys($this->groupManager->getUserIdGroups($this->userId))); - array_push($groups, '__all'); - - $this->solrService->setOwner($this->userId, $groups); - } - - /** - * performs a search - * - * @param string $query - * @return array - * - */ - public function search($query) - { - $results = array(); - - if ($this->solrService == false) - return $results; - - if ($query !== null) { - - $solrResult = $this->solrService->search($query, array( - '' - )); - if ($solrResult == false) - return $results; - - foreach ($solrResult as $data) { - - // This is not clean, but right now it is the only descent way I found to display result - $fileData = FileService::getFileInfo($data['id']); - if ($fileData === false) - continue; - - $result = new \OC\Search\Result\File($fileData); - // $result->type = 'nextant'; - // $result->name = $result->path . ' (Accuracy: ' . round($data['score'] * 100 / $topScore, 2) . '%) '; - - $name = ''; - $name .= ($data['owner'] != $this->userId) ? '[shared] ' : ''; - $name .= ($data['deleted']) ? '[trashbin] ' : ''; - if (key_exists('highlight', $data) && is_array($data['highlight'])) - $name .= '... ' . implode(' (...) ', $data['highlight']) . ' ...'; - else - $name .= $result->path; - $name .= ' (Score: ' . round($data['score'], 2) . ') '; - - $result->name = $name; - $results[] = $result; - } - } - - return $results; - } -}
\ No newline at end of file diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index 5f4fb34..463d066 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -94,6 +94,7 @@ class ConfigService public function removeOldConfig() { + $this->deleteAppValue('display_result'); $this->deleteAppValue('solr_lock'); $this->deleteAppValue('needed_index'); $this->deleteAppValue('last_index'); diff --git a/templates/settings.admin.php b/templates/settings.admin.php index 0f63737..2b90d17 100644 --- a/templates/settings.admin.php +++ b/templates/settings.admin.php @@ -208,14 +208,6 @@ style('nextant', 'admin'); id="solr_index_delay" value="2" style="width: 50px;" /> hours</td> </tr> - <tr style="height: 30px;"> - <td class="nextant_admin_left"> - <?php p($l->t('Display result :')) ?></td> - <td><select id="solr_display_result" style="width: 260px;"> - <option value="1">Nextant style</option> - <option value="2">Integrated to Files</option> - </select></td> - </tr> <!-- <tr style="height: 30px;"> |