Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/fulltextsearch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AppInfo/Application.php13
-rw-r--r--lib/Controller/SearchController.php16
-rw-r--r--lib/Controller/SettingsController.php7
-rw-r--r--lib/Service/ConfigService.php2
-rw-r--r--templates/settings.admin.php16
5 files changed, 46 insertions, 8 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 2cf5685..9410021 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -117,7 +117,7 @@ class Application extends App
// $container->query('IndexMapper')->insert(new IndexEntity(array(userid => 2, 'path' => '/toto', 'clef' => 'CLEFCLEF')));
$container->registerService('SearchController', function ($c) {
- return new SearchController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('GroupManager'), $c->query('SolrService'), $c->query('MiscService'));
+ return new SearchController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('GroupManager'), $c->query('ConfigService'), $c->query('SolrService'), $c->query('MiscService'));
});
$container->registerService('SettingsController', function ($c) {
@@ -208,14 +208,17 @@ class Application extends App
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');
});
- \OC::$server->getEventDispatcher()->addListener('OCA\Files_Sharing::loadAdditionalScripts', function () {
- \OCP\Util::addScript('nextant', 'navigate_sharelink');
- \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:
diff --git a/lib/Controller/SearchController.php b/lib/Controller/SearchController.php
index 69e7823..44462d4 100644
--- a/lib/Controller/SearchController.php
+++ b/lib/Controller/SearchController.php
@@ -48,16 +48,20 @@ class SearchController extends Controller
private $groupManager;
+ private $configService;
+
private $solrService;
private $miscService;
- public function __construct($appName, IRequest $request, $userId, $groupManager, $solrService, $miscService)
+ public function __construct($appName, IRequest $request, $userId, $groupManager, $configService, $solrService, $miscService)
{
parent::__construct($appName, $request);
$this->userId = $userId;
$this->groupManager = $groupManager;
+ $this->configService = $configService;
+
$this->solrService = $solrService;
$this->miscService = $miscService;
}
@@ -174,12 +178,20 @@ class SearchController extends Controller
{
$results = array();
+ if ($this->configService->getAppValue('index_files_sharelink') !== '1')
+ return $results;
+
if (! $this->solrService)
return $results;
+ if (strpos($key, '?') > 0)
+ $key = substr($key, 0, strpos($key, '?'));
+ if (strpos($key, '#') > 0)
+ $key = substr($key, 0, strpos($key, '#'));
+
$share = \OC\Share\Share::getShareByToken($key);
if (! $share)
- return $result;
+ return $results;
if ($query !== null) {
diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php
index 35f3791..0f94caa 100644
--- a/lib/Controller/SettingsController.php
+++ b/lib/Controller/SettingsController.php
@@ -94,6 +94,8 @@ class SettingsController extends Controller
'index_files_needed' => $this->configService->getAppValue('index_files_needed'),
'index_files_max_size' => $this->configService->getAppValue('index_files_max_size'),
'index_files_live' => $this->configService->getAppValue('index_files_live'),
+ 'index_files_tree' => $this->configService->getAppValue('index_files_tree'),
+ 'index_files_sharelink' => $this->configService->getAppValue('index_files_sharelink'),
'index_files_external' => $this->configService->getAppValue('index_files_external'),
'index_files_encrypted' => $this->configService->getAppValue('index_files_encrypted'),
'display_result' => $this->configService->getAppValue('display_result'),
@@ -113,11 +115,14 @@ class SettingsController extends Controller
return $response;
}
- public function setOptionsFiles($index_files, $index_files_live, $index_files_max_size, $index_files_external, $index_files_encrypted)
+ public function setOptionsFiles($index_files, $index_files_live, $index_files_max_size, $index_files_tree, $index_files_sharelink, $index_files_external, $index_files_encrypted)
{
$this->configService->setAppValue('index_files', $index_files);
$this->configService->setAppValue('index_files_live', $index_files_live);
+ $this->configService->setAppValue('index_files_tree', $index_files_tree);
+ $this->configService->setAppValue('index_files_sharelink', $index_files_sharelink);
$this->configService->setAppValue('index_files_external', $index_files_external);
+ $this->configService->setAppValue('index_files_encrypted', $index_files_encrypted);
$this->configService->setAppValue('index_files_max_size', $index_files_max_size);
return $this->updateSubOptions(false, 'files');
diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php
index 27e396f..106fa4e 100644
--- a/lib/Service/ConfigService.php
+++ b/lib/Service/ConfigService.php
@@ -53,6 +53,8 @@ class ConfigService
'index_files' => 1,
'index_files_needed' => 1,
'index_files_update_needed' => 1,
+ 'index_files_tree' => 0,
+ 'undex_files_sharelink' => 0,
'index_files_external' => 0,
'index_files_encrypted' => 0,
'index_files_live' => 1,
diff --git a/templates/settings.admin.php b/templates/settings.admin.php
index 0500844..165b163 100644
--- a/templates/settings.admin.php
+++ b/templates/settings.admin.php
@@ -106,6 +106,22 @@ style('nextant', 'admin');
target="_blank">help</a>)</td>
</tr>
+
+ <!-- <tr style="height: 30px;">
+ <td class="nextant_admin_left">
+ <?php p($l->t('Index Files Tree :')) ?></td>
+ <td><input type="checkbox" name="solr_index_files_tree"
+ id="solr_index_files_tree" value="1" style="margin: 10px;"></td>
+ </tr>
+ -->
+
+ <tr style="height: 30px;">
+ <td class="nextant_admin_left">
+ <?php p($l->t('Index Public Links :')) ?></td>
+ <td><input type="checkbox" name="solr_index_files_sharelink"
+ id="solr_index_files_sharelink" value="1" style="margin: 10px;"></td>
+ </tr>
+
<tr style="height: 30px;">
<td class="nextant_admin_left">
<?php p($l->t('Index External Storage :')) ?></td>