diff options
author | daita <maxence@pontapreta.net> | 2016-10-14 15:26:18 +0300 |
---|---|---|
committer | daita <maxence@pontapreta.net> | 2016-10-14 15:26:18 +0300 |
commit | de19b3c5484a3bf0a2f15b63de51fc4d48bd647e (patch) | |
tree | df0a6e276a1d60128932df8e75184adc6550e86b | |
parent | c23686a04f048cb43c2e4d210732e8889af92885 (diff) |
chunk admin
-rw-r--r-- | appinfo/routes.php | 14 | ||||
-rw-r--r-- | css/admin.css | 7 | ||||
-rw-r--r-- | js/settings.admin.js | 95 | ||||
-rw-r--r-- | lib/Controller/SettingsController.php | 21 | ||||
-rw-r--r-- | templates/settings.admin.php | 20 |
5 files changed, 107 insertions, 50 deletions
diff --git a/appinfo/routes.php b/appinfo/routes.php index 7919a64..751f8c3 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -31,8 +31,18 @@ return [ 'verb' => 'POST' ], [ - 'name' => 'settings#setOptions', - 'url' => 'ajax/settings/option.php', + 'name' => 'settings#setOptionsFiles', + 'url' => 'ajax/settings/option_files.php', + 'verb' => 'POST' + ], + [ + 'name' => 'settings#setOptionsBookmarks', + 'url' => 'ajax/settings/option_bookmarks.php', + 'verb' => 'POST' + ], + [ + 'name' => 'settings#setOptionsStatus', + 'url' => 'ajax/settings/option_status.php', 'verb' => 'POST' ], [ diff --git a/css/admin.css b/css/admin.css index b671d33..43e5387 100644 --- a/css/admin.css +++ b/css/admin.css @@ -1,9 +1,10 @@ -#nextant_saving { +#nextant_saving_settings, #nextant_saving_files, + #nextant_saving_bookmarks, #nextant_saving_check, + #nextant_saving_status { font-weight: bolder; font-size: 12px; margin-left: 30px; font-style: italic; - opacity: 0.5; filter: alpha(opacity = 50); opacity: 0.5; } @@ -33,7 +34,7 @@ DIV.nextant_display_text { } TD.nextant_admin_left { - width: 250px; + width: 200px; text-align: right; font-weight: bold; padding-right: 15px; diff --git a/js/settings.admin.js b/js/settings.admin.js index 4296727..9db85aa 100644 --- a/js/settings.admin.js +++ b/js/settings.admin.js @@ -29,7 +29,11 @@ $(document) var nextantSettings = { init : function() { - $('#nextant_saving').fadeOut(0); + $('#nextant_saving_status').fadeOut(0); + // $('#nextant_saving_check').fadeOut(0); + $('#nextant_saving_settings').fadeOut(0); + $('#nextant_saving_files').fadeOut(0); + $('#nextant_saving_bookmarks').fadeOut(0); nextantSettings.statusclearall(true); nextantSettings.checksuboptions(true); setInterval(function() { @@ -37,20 +41,16 @@ $(document) }, 60000); }, - saving : function(load) { + saving : function(rub, load) { if (load) { - $('#nextant_saving').fadeIn(50); + $('#nextant_saving_' + rub).fadeIn(50); } else - $('#nextant_saving').fadeOut(50); + $('#nextant_saving_' + rub).fadeOut(50); }, - savesuboptions : function(switched) { + savesuboptions_files : function(switched) { - nextantSettings.saving(true); - - var force_index = 0; - if (switched == 'force_index') - force_index = 1; + nextantSettings.saving('files', true); var data = { index_files_live_extract : ($('#solr_index_files_live_extract') @@ -60,12 +60,7 @@ $(document) index_files_max_size : $( '#solr_index_files_max_size').val(), index_files_external_index : ($('#solr_index_files_external_index') - .is(':checked')) ? 1 : 0, - index_bookmarks : ($('#solr_index_bookmarks') - .is(':checked')) ? 1 : 0, - display_result : $('#solr_display_result') - .val(), - force_index : force_index + .is(':checked')) ? 1 : 0 } if (switched == 'index_files_live_extract') @@ -79,19 +74,53 @@ $(document) data.index_files_external_index = (data.index_files_external_index == 1) ? 0 : 1; + $.post(OC.filePath('nextant', 'ajax/settings', + 'option_files.php'), data, + nextantSettings.updatesuboptions); + }, + + savesuboptions_bookmarks : function(switched) { + + nextantSettings.saving('bookmarks', true); + + var data = { + index_bookmarks : ($('#solr_index_bookmarks') + .is(':checked')) ? 1 : 0, + } + if (switched == 'index_bookmarks') data.index_bookmarks = (data.index_bookmarks == 1) ? 0 : 1; $.post(OC.filePath('nextant', 'ajax/settings', - 'option.php'), data, + 'option_bookmarks.php'), data, + nextantSettings.updatesuboptions); + }, + + savesuboptions_status : function(switched) { + + nextantSettings.saving('status', true); + + var force_index = 0; + if (switched == 'force_index') + force_index = 1; + + var data = { + display_result : $('#solr_display_result') + .val(), + force_index : force_index + } + + $.post(OC.filePath('nextant', 'ajax/settings', + 'option_status.php'), data, nextantSettings.updatesuboptions); }, checksuboptions : function(instant) { $.post(OC.filePath('nextant', 'ajax/settings', 'updateSubOptions.php'), { - instant : instant + instant : instant, + source : 'check' }, nextantSettings.updatesuboptions); }, @@ -100,7 +129,8 @@ $(document) if (response.instant == 'true') delay = 0; - nextantSettings.saving(false); + if (response.source != '') + nextantSettings.saving(response.source, false); $('#nextant_version') .text(response.nextant_version); @@ -295,7 +325,7 @@ $(document) break; case 'save': - nextantSettings.saving(true); + nextantSettings.saving('settings', true); nextantSettings .status( '#save', @@ -364,7 +394,7 @@ $(document) break; case 'save': - nextantSettings.saving(false); + nextantSettings.saving('settings', false); nextantSettings.reset(); nextantSettings.checksuboptions(false); break; @@ -385,35 +415,38 @@ $(document) .mousedown( function() { nextantSettings - .savesuboptions('index_files_live_extract'); + .savesuboptions_files('index_files_live_extract'); }); $('#solr_index_files_live_update') .mousedown( function() { nextantSettings - .savesuboptions('index_files_live_update'); + .savesuboptions_files('index_files_live_update'); }); $('#solr_index_files_max_size').on('input', function(e) { - nextantSettings.savesuboptions(); + nextantSettings.savesuboptions_files(); }); $('#solr_index_files_external_index') .mousedown( function() { nextantSettings - .savesuboptions('index_files_external_index'); + .savesuboptions_files('index_files_external_index'); }); $('#nextant_force_index').on('click', function() { - nextantSettings.savesuboptions('force_index'); + nextantSettings.savesuboptions_status('force_index'); }); $('#nextant_force_first_index').on('click', function() { - nextantSettings.savesuboptions('force_index'); + nextantSettings.savesuboptions_status('force_index'); }); $('#solr_display_result').on('change', function() { - nextantSettings.savesuboptions(); - }); - $('#solr_index_bookmarks').mousedown(function() { - nextantSettings.savesuboptions('index_bookmarks'); + nextantSettings.savesuboptions_status(); }); + $('#solr_index_bookmarks') + .mousedown( + function() { + nextantSettings + .savesuboptions_bookmarks('index_bookmarks'); + }); nextantSettings.init(); diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index e02c97a..8adb327 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -77,7 +77,7 @@ class SettingsController extends Controller $this->configService->needIndexFiles(true); } - public function updateSubOptions($instant) + public function updateSubOptions($instant, $source = '') { $response = array( 'instant' => $instant, @@ -99,26 +99,39 @@ class SettingsController extends Controller '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')) + 'index_last_format' => date('r', $this->configService->getAppValue('index_last')), + 'source' => $source ); return $response; } - public function setOptions($index_files_live_extract, $index_files_live_update, $index_files_max_size, $index_files_external_index, $index_bookmarks, $display_result, $force_index) + public function setOptionsFiles($index_files_live_extract, $index_files_live_update, $index_files_max_size, $index_files_external_index) { $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); $this->configService->setAppValue('index_files_max_size', $index_files_max_size); + + return $this->updateSubOptions(false, 'files'); + } + + public function setOptionsBookmarks($index_bookmarks) + { $this->configService->setAppValue('index_bookmarks', $index_bookmarks); + + return $this->updateSubOptions(false, 'bookmarks'); + } + + public function setOptionsStatus($display_result, $force_index) + { $this->configService->setAppValue('display_result', $display_result); if ($force_index == '1') { $this->configService->setAppValue('configured', '1'); $this->configService->needIndexFiles(true); } - return $this->updateSubOptions(false); + return $this->updateSubOptions(false, 'status'); } public function setSettings($solr_url, $solr_core, $command) diff --git a/templates/settings.admin.php b/templates/settings.admin.php index 7e8b39c..11483fa 100644 --- a/templates/settings.admin.php +++ b/templates/settings.admin.php @@ -39,12 +39,12 @@ style('nextant', 'admin'); </tr> <tr valign="top"> <td> - <table> + <table style="width: 550px;"> <tr> <td> </td> </tr> <tr class="nextant_admin_head"> - <td></td> + <td><div id="nextant_saving_settings">Saving</div></td> <td class="nextant_admin_head">Settings</td> </tr> <tr style="height: 30px;"> @@ -68,16 +68,16 @@ style('nextant', 'admin'); <tr style="height: 30px;"> <td></td> <td> - <button type="button" id="nextant_apply" style="width: 270px"><?php p($l->t('Test and Save')) ?></button> + <button type="button" id="nextant_apply" style="width: 264px"><?php p($l->t('Test and Save')) ?></button> </td> </tr> </table> - <table id="nextant_suboptions"> + <table style="width: 550px;" id="nextant_suboptions"> <tr> <td> </td> </tr> <tr class="nextant_admin_head"> - <td></td> + <td><div id="nextant_saving_files">Saving</div></td> <td class="nextant_admin_head">Indexing Files</td> </tr> <tr style="height: 30px;"> @@ -115,13 +115,12 @@ style('nextant', 'admin'); </tr> --> - <!-- <tr> <td> </td> </tr> <tr class="nextant_admin_head"> - <td></td> + <td><div id="nextant_saving_bookmarks">Saving</div></td> <td class="nextant_admin_head">Indexing Bookmarks</td> </tr> @@ -135,18 +134,18 @@ style('nextant', 'admin'); </div> <div id="nextant_bookmarks_appenabled"> <input type="checkbox" name="solr_index_bookmarks" - id="solr_index_bookmarks" value="1" style="margin: 10px;"> + id="solr_index_bookmarks" value="1" style="margin: 10px;"> </div> </td> </tr> - --> <tr> <td> </td> </tr> <tr class="nextant_admin_head"> - <td><div id="nextant_saving">Saving</div></td> + <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> @@ -263,6 +262,7 @@ style('nextant', 'admin'); </tr> </table> + </div> |