diff options
-rw-r--r-- | js/settings.admin.js | 47 | ||||
-rw-r--r-- | lib/Controller/SettingsController.php | 5 | ||||
-rw-r--r-- | templates/settings.admin.php | 213 |
3 files changed, 152 insertions, 113 deletions
diff --git a/js/settings.admin.js b/js/settings.admin.js index 9db85aa..16acc52 100644 --- a/js/settings.admin.js +++ b/js/settings.admin.js @@ -53,6 +53,8 @@ $(document) nextantSettings.saving('files', true); var data = { + index_files : ($('#solr_index_files') + .is(':checked')) ? 1 : 0, index_files_live_extract : ($('#solr_index_files_live_extract') .is(':checked')) ? 1 : 0, index_files_live_update : ($('#solr_index_files_live_update') @@ -63,6 +65,9 @@ $(document) .is(':checked')) ? 1 : 0 } + if (switched == 'index_files') + data.index_files = (data.index_files == 1) ? 0 + : 1; if (switched == 'index_files_live_extract') data.index_files_live_extract = (data.index_files_live_extract == 1) ? 0 : 1; @@ -152,6 +157,8 @@ $(document) $('#nextant_suboptions').fadeTo(delay, 0.4); } + $('#solr_index_files').prop('checked', + (response.index_files == 1)); $('#solr_index_files_live_extract').prop('checked', (response.index_files_live_extract == 1)); $('#solr_index_files_live_update').prop('checked', @@ -159,20 +166,16 @@ $(document) $('#solr_index_files_external_index').prop( 'checked', (response.index_files_external_index == 1)); - - if (response.index_last > 0) - $('#solr_index_last').text( - response.index_last_format); - else - $('#solr_index_last').text('never'); - $('#solr_index_files_max_size').val( response.index_files_max_size); - $( - '#solr_display_result option[value="' - + response.display_result + '"]') - .prop('selected', true); + if (response.index_files == 1) + $('#solr_sub_files').show(delay); + else + $('#solr_sub_files').hide(delay); + + $('#solr_index_bookmarks').prop('checked', + (response.index_bookmarks == 1)); if (response.bookmarks_app_enabled) { $('#nextant_bookmarks_appdisabled').hide(delay); @@ -185,6 +188,22 @@ $(document) $('#nextant_bookmarks_appenabled').hide(delay); } + if (response.index_bookmarks == 1) + $('#solr_sub_bookmarks').show(delay); + else + $('#solr_sub_bookmarks').hide(delay); + + $( + '#solr_display_result option[value="' + + response.display_result + '"]') + .prop('selected', true); + + if (response.index_last > 0) + $('#solr_index_last').text( + response.index_last_format); + else + $('#solr_index_last').text('never'); + if (response.configured == 0) { $('#solr_current_docs').text( 'Nextant is not configured yet'); @@ -411,6 +430,9 @@ $(document) $('#nextant_apply').on('click', nextantSettings.save); + $('#solr_index_files_cont').mousedown(function() { + nextantSettings.savesuboptions_files('index_files'); + }); $('#solr_index_files_live_extract') .mousedown( function() { @@ -441,11 +463,12 @@ $(document) $('#solr_display_result').on('change', function() { nextantSettings.savesuboptions_status(); }); - $('#solr_index_bookmarks') + $('#solr_index_bookmarks_cont') .mousedown( function() { nextantSettings .savesuboptions_bookmarks('index_bookmarks'); + }); nextantSettings.init(); diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 8adb327..cb10e11 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -86,6 +86,7 @@ class SettingsController extends Controller 'solr_url' => $this->configService->getAppValue('solr_url'), 'solr_core' => $this->configService->getAppValue('solr_core'), 'nextant_version' => $this->configService->getAppValue('installed_version') . ' (beta)', + 'index_files' => $this->configService->getAppValue('index_files'), 'index_files_needed' => $this->configService->getAppValue('index_files_needed'), 'index_files_max_size' => $this->configService->getAppValue('index_files_max_size'), 'index_files_live_extract' => $this->configService->getAppValue('index_files_live_extract'), @@ -96,7 +97,6 @@ class SettingsController extends Controller 'bookmarks_app_enabled' => (\OCP\App::isEnabled('bookmarks')), 'index_bookmarks' => $this->configService->getAppValue('index_bookmarks'), 'index_bookmarks_needed' => $this->configService->getAppValue('index_bookmarks_needed'), - 'index_bookmarks_last_format' => date('r', $this->configService->getAppValue('index_bookmarks_last')), 'index_locked' => $this->configService->getAppValue('index_locked'), 'index_last' => $this->configService->getAppValue('index_last'), 'index_last_format' => date('r', $this->configService->getAppValue('index_last')), @@ -106,8 +106,9 @@ class SettingsController extends Controller return $response; } - public function setOptionsFiles($index_files_live_extract, $index_files_live_update, $index_files_max_size, $index_files_external_index) + public function setOptionsFiles($index_files, $index_files_live_extract, $index_files_live_update, $index_files_max_size, $index_files_external_index) { + $this->configService->setAppValue('index_files', $index_files); $this->configService->setAppValue('index_files_live_extract', $index_files_live_extract); $this->configService->setAppValue('index_files_live_update', $index_files_live_update); $this->configService->setAppValue('index_files_external_index', $index_files_external_index); diff --git a/templates/settings.admin.php b/templates/settings.admin.php index 11483fa..daa2349 100644 --- a/templates/settings.admin.php +++ b/templates/settings.admin.php @@ -72,41 +72,47 @@ style('nextant', 'admin'); </td> </tr> </table> - <table style="width: 550px;" id="nextant_suboptions"> - <tr> - <td> </td> - </tr> - <tr class="nextant_admin_head"> - <td><div id="nextant_saving_files">Saving</div></td> - <td class="nextant_admin_head">Indexing Files</td> - </tr> - <tr style="height: 30px;"> - <td class="nextant_admin_left"> + <div id="nextant_suboptions"> + <table style="width: 550px;"> + <tr> + <td> </td> + </tr> + <tr class="nextant_admin_head" id="solr_index_files_cont"> + <td><div id="nextant_saving_files">Saving</div></td> + <td class="nextant_admin_head"><input type="checkbox" + name="solr_index_files" id="solr_index_files" value="1" + style="margin: 5px; margin-right: 15px;">Indexing Files</td> + </tr> + </table> + <div id="solr_sub_files"> + <table style="width: 550px;"> + + <tr style="height: 30px;"> + <td class="nextant_admin_left"> <?php p($l->t('Maximum File Size (Mb) :')) ?></td> - <td><input type="text" id="solr_index_files_max_size" - style="width: 100px;"></td> - </tr> + <td><input type="text" id="solr_index_files_max_size" + style="width: 100px;"></td> + </tr> - <tr style="height: 30px;"> - <td class="nextant_admin_left"> + <tr style="height: 30px;"> + <td class="nextant_admin_left"> <?php p($l->t('Live Extract :')); ?> </td> - <td><input type="checkbox" name="solr_index_files_live_extract" - id="solr_index_files_live_extract" value="1" - style="margin: 10px;"> (<a id="nextant_help_link" - href="https://github.com/daita/nextant/wiki/Extracting,-Live-Update" - target="_blank">help</a>)</td> - </tr> + <td><input type="checkbox" name="solr_index_files_live_extract" + id="solr_index_files_live_extract" value="1" + style="margin: 10px;"> (<a id="nextant_help_link" + href="https://github.com/daita/nextant/wiki/Extracting,-Live-Update" + target="_blank">help</a>)</td> + </tr> - <tr style="height: 30px;"> - <td class="nextant_admin_left"> + <tr style="height: 30px;"> + <td class="nextant_admin_left"> <?php p($l->t('Live Document Update :')) ?></td> - <td><input type="checkbox" name="solr_index_files_live_update" - id="solr_index_files_live_update" value="1" style="margin: 10px;"></td> - </tr> - - - <!-- + <td><input type="checkbox" name="solr_index_files_live_update" + id="solr_index_files_live_update" value="1" + style="margin: 10px;"></td> + </tr> + <!-- <tr style="height: 30px;"> <td class="nextant_admin_left"> <?php p($l->t('Index External Storage :')) ?></td> @@ -114,89 +120,98 @@ style('nextant', 'admin'); id="solr_index_files_external_index" value="1" style="margin: 10px;"></td> </tr> --> + </table> + </div> + <table style="width: 550px;"> + <tr> + <td> </td> + </tr> + <tr class="nextant_admin_head" id="solr_index_bookmarks_cont"> + <td><div id="nextant_saving_bookmarks">Saving</div></td> + <td class="nextant_admin_head"><input type="checkbox" + name="solr_index_bookmarks" id="solr_index_bookmarks" value="1" + style="margin: 5px; margin-right: 15px;">Indexing Bookmarks</td> + </tr> + </table> - <tr> - <td> </td> - </tr> - <tr class="nextant_admin_head"> - <td><div id="nextant_saving_bookmarks">Saving</div></td> - <td class="nextant_admin_head">Indexing Bookmarks</td> - </tr> - - - <tr style="height: 30px;"> - <td class="nextant_admin_left"> - <?php p($l->t('Index bookmarks :')) ?></td> - <td> - <div id="nextant_bookmarks_appdisabled"> - The App <i>Bookmarks</i> is not installed/enabled. - </div> - <div id="nextant_bookmarks_appenabled"> - <input type="checkbox" name="solr_index_bookmarks" - id="solr_index_bookmarks" value="1" style="margin: 10px;"> - </div> - </td> - </tr> + <div id="solr_sub_bookmarks"> + <table style="width: 550px;"> + <tr style="height: 30px;"> + <td colspan="2"> + <div id="nextant_bookmarks_appdisabled"> + The App <i>Bookmarks</i> is not installed/enabled. + </div> + <div id="nextant_bookmarks_appenabled"> + The App <i>Bookmarks</i> is enabled, your bookmarks will be + indexed. + </div> + </td> + </tr> + </table> + </div> + <table style="width: 550px;"> - <tr> - <td> </td> - </tr> - <tr class="nextant_admin_head"> - <td><div id="nextant_saving_status">Saving</div> - <div id="nextant_saving_check">Checking</div></td> - <td class="nextant_admin_head">Nextant Status</td> - </tr> + <tr> + <td> </td> + </tr> + <tr class="nextant_admin_head"> + <td><div id="nextant_saving_status">Saving</div> + <div id="nextant_saving_check">Checking</div></td> + <td class="nextant_admin_head">Nextant Status</td> + </tr> - <tr style="height: 30px;"> - <td class="nextant_admin_left"> + <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> + <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;"> - <td class="nextant_admin_left"> + <tr style="height: 30px;"> + <td class="nextant_admin_left"> <?php p($l->t('Number of documents :')) ?></td> - <td><div id="solr_current_docs"></div></td> - </tr> - <tr style="height: 30px;"> - <td class="nextant_admin_left"> + <td><div id="solr_current_docs"></div></td> + </tr> + <tr style="height: 30px;"> + <td class="nextant_admin_left"> <?php p($l->t('Last index :')) ?></td> - <td><div id="solr_index_last"></div></td> + <td><div id="solr_index_last"></div></td> - </tr> + </tr> - <tr> - <td> </td> - </tr> - <tr style="height: 30px;"> + <tr> + <td> </td> + </tr> + <tr style="height: 30px;"> - <td></td> - <td> - <div id="nextant_first_index" - style="width: 270px; font-size: 12px; white-space: normal;"> - <i></i> we recommand doing the very first indexing of your files - using the <b>./occ nextant:index</b> command.<br /> However, you - can force it to be started as a background process: </i> <br /> - <button type="button" id="nextant_force_first_index" - style="width: 270px"><?php p($l->t('Force first index as a cronjob')) ?></button> - </div> - <button type="button" id="nextant_force_index" - style="width: 270px"><?php p($l->t('Force index')) ?></button> - <div id="nextant_index_scheduled"> - <i>Indexing is scheduled within the next few hours (cron)</i> - </div> - <div id="nextant_index_inprogress"> - <i>Indexing in progress</i> - </div> - </td> - </tr> + <td></td> + <td> + <div id="nextant_first_index" + style="width: 270px; font-size: 12px; white-space: normal;"> + <i></i> we recommand doing the very first indexing of your + files using the <b>./occ nextant:index</b> command.<br /> + However, you can force it to be started as a background + process: </i> <br /> + <button type="button" id="nextant_force_first_index" + style="width: 270px"><?php p($l->t('Force first index as a cronjob')) ?></button> + </div> + <button type="button" id="nextant_force_index" + style="width: 270px"><?php p($l->t('Force index')) ?></button> + <div id="nextant_index_scheduled"> + <i>Indexing is scheduled within the next few hours (cron)</i> + </div> + <div id="nextant_index_inprogress"> + <i>Indexing in progress</i> + </div> + </td> + </tr> - </table> + </table> + </div> </td> <td style="padding-left: 30px; padding-top: 40px; vertical-align: top"> |