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--appinfo/app.php4
-rw-r--r--appinfo/routes.php14
-rw-r--r--js/settings.admin.js11
-rw-r--r--lib/AppInfo/Application.php28
-rw-r--r--lib/Controller/SettingsController.php4
-rw-r--r--lib/Service/ConfigService.php5
-rw-r--r--lib/admin.php (renamed from settings/admin.php)2
-rw-r--r--templates/settings.admin.php9
8 files changed, 61 insertions, 16 deletions
diff --git a/appinfo/app.php b/appinfo/app.php
index 5e8281e..0ee569a 100644
--- a/appinfo/app.php
+++ b/appinfo/app.php
@@ -33,4 +33,6 @@ $app = new \OCA\Nextant\AppInfo\Application();
// $app->registerNavigation();
$app->registerFilesHooks();
$app->registerSettingsAdmin();
-$app->registerSearchProvider(); \ No newline at end of file
+$app->registerSearchProvider();
+
+
diff --git a/appinfo/routes.php b/appinfo/routes.php
index b9e0988..05ba4e4 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -31,14 +31,19 @@ return [
'verb' => 'POST'
],
[
- 'name' => 'settings#setOption',
+ 'name' => 'settings#setOptions',
'url' => 'ajax/settings/option.php',
'verb' => 'POST'
- ],
+ ],
[
'name' => 'settings#updateSubOptions',
'url' => 'ajax/settings/updateSubOptions.php',
'verb' => 'POST'
+ ],
+ [
+ 'name' => 'search#searchRequest',
+ 'url' => 'ajax/search.php',
+ 'verb' => 'POST'
]
]
]
@@ -48,8 +53,3 @@ return [
* This route is now useless. It was used with navigate.js + SearchController
* We are now using SearchProvider.
*/
-// [
-// 'name' => 'search#searchRequest',
-// 'url' => 'ajax/search.php',
-// 'verb' => 'POST'
-// ]
diff --git a/js/settings.admin.js b/js/settings.admin.js
index 65427f0..e1aa1fc 100644
--- a/js/settings.admin.js
+++ b/js/settings.admin.js
@@ -47,6 +47,8 @@ $(document)
live_docupdate : ($('#solr_live_docupdate')
.is(":checked")) ? 1 : 0,
max_size : $('#solr_max_size').val(),
+ display_result : $('#solr_display_result')
+ .val(),
needed_index : needed_index
}
@@ -102,6 +104,11 @@ $(document)
$('#solr_max_size').val(response.max_size);
+ $(
+ '#solr_display_result option[value="'
+ + response.display_result + '"]')
+ .prop('selected', true);
+
if (response.configured == 0) {
$('#solr_current_docs').text(
'Nextant is not configured yet');
@@ -321,6 +328,10 @@ $(document)
$('#nextant_force_index').on('click', function() {
nextantSettings.savesuboptions('force_index');
});
+ $('#solr_display_result').on('change', function() {
+ nextantSettings.savesuboptions();
+ });
+
nextantSettings.init();
});
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 132fa9a..79c92d3 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -27,6 +27,7 @@
namespace OCA\Nextant\AppInfo;
use \OCA\Nextant\Controller\SettingsController;
+use \OCA\Nextant\Controller\SearchController;
use \OCA\Nextant\Db\IndexMapper;
use \OCA\Nextant\Events\FilesEvents;
use \OCA\Nextant\Hooks\FilesHooks;
@@ -176,16 +177,31 @@ class Application extends App
public function registerSearchProvider()
{
- \OC::$server->getSearch()->registerProvider('\OCA\Nextant\Provider\SearchProvider', array(
- 'apps' => array(
- 'files'
- )
- ));
+ $config = $this->getContainer()->query('ConfigService');
+ if ($config->getAppValue('configured') != 1)
+ return;
+
+ switch ($config->getAppValue('search_display')) {
+
+ case ConfigService::SEARCH_DISPLAY_NEXTANT:
+ \OC::$server->getEventDispatcher()->addListener('OCA\Files::loadAdditionalScripts', function () {
+ \OCP\Util::addScript('nextant', 'navigate');
+ });
+ break;
+
+ case ConfigService::SEARCH_DISPLAY_FILES:
+ \OC::$server->getSearch()->registerProvider('\OCA\Nextant\Provider\SearchProvider', array(
+ 'apps' => array(
+ 'files'
+ )
+ ));
+ break;
+ }
}
public function registerSettingsAdmin()
{
- \OCP\App::registerAdmin($this->getContainer()->query('AppName'), 'settings/admin');
+ \OCP\App::registerAdmin($this->getContainer()->query('AppName'), 'lib/admin');
}
// public function registerNavigation()
diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php
index 4634283..f831091 100644
--- a/lib/Controller/SettingsController.php
+++ b/lib/Controller/SettingsController.php
@@ -88,6 +88,7 @@ class SettingsController extends Controller
'last_index_format' => date('r', $this->configService->getAppValue('last_index')),
'needed_index' => $this->configService->getAppValue('needed_index'),
'max_size' => $this->configService->getAppValue('max_size'),
+ 'display_result' => $this->configService->getAppValue('display_result'),
'live_extract' => $this->configService->getAppValue('live_extract'),
'live_docupdate' => $this->configService->getAppValue('live_docupdate'),
'solr_lock' => $this->configService->getAppValue('solr_lock')
@@ -96,11 +97,12 @@ class SettingsController extends Controller
return $response;
}
- public function setOption($live_extract, $live_docupdate, $max_size, $needed_index)
+ public function setOptions($live_extract, $live_docupdate, $max_size, $display_result, $needed_index)
{
$this->configService->setAppValue('live_extract', $live_extract);
$this->configService->setAppValue('live_docupdate', $live_docupdate);
$this->configService->setAppValue('max_size', $max_size);
+ $this->configService->setAppValue('display_result', $display_result);
if ($needed_index == 1)
$this->configService->needIndex(true, true);
diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php
index c5d2125..b41a157 100644
--- a/lib/Service/ConfigService.php
+++ b/lib/Service/ConfigService.php
@@ -31,6 +31,10 @@ use OCP\IConfig;
class ConfigService
{
+ const SEARCH_DISPLAY_NEXTANT = 1;
+
+ const SEARCH_DISPLAY_FILES = 2;
+
const ACTION_LIVE_EXTRACT = 'live_extract';
const ACTION_LIVE_DOCUPDATE = 'live_docupdate';
@@ -43,6 +47,7 @@ class ConfigService
'live_extract' => '1',
'live_docupdate' => '0',
'last_index' => 0,
+ 'search_display' => 2,
'solr_lock' => 0
];
diff --git a/settings/admin.php b/lib/admin.php
index 7ffda96..2b80245 100644
--- a/settings/admin.php
+++ b/lib/admin.php
@@ -24,7 +24,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-namespace OCA\Nextant\Settings;
+namespace OCA\Nextant;
$app = new \OCA\Nextant\AppInfo\Application();
$app->registerSettingsAdmin();
diff --git a/templates/settings.admin.php b/templates/settings.admin.php
index c3b9eb7..4bf8c8f 100644
--- a/templates/settings.admin.php
+++ b/templates/settings.admin.php
@@ -94,6 +94,15 @@ style('nextant', 'admin');
<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="2">Integrated to the Files app</option>
+ <option value="1">Nextant style (alpha - do not use)</option>
+ </select></td>
+ </tr>
+
+ <tr style="height: 30px;">
+ <td class="nextant_admin_left">
<?php p($l->t('Last index :')) ?></td>
<td><div id="solr_last_index"></div></td>