diff options
-rw-r--r-- | css/admin.css | 23 | ||||
-rw-r--r-- | img/check.png | bin | 0 -> 18895 bytes | |||
-rw-r--r-- | img/fail.png | bin | 0 -> 22720 bytes | |||
-rw-r--r-- | js/settings.admin.js | 111 | ||||
-rw-r--r-- | lib/Controller/SettingsController.php | 1 | ||||
-rw-r--r-- | templates/settings.admin.php | 184 |
6 files changed, 238 insertions, 81 deletions
diff --git a/css/admin.css b/css/admin.css new file mode 100644 index 0000000..5a629c4 --- /dev/null +++ b/css/admin.css @@ -0,0 +1,23 @@ +#nextant-display { + width: 400px; + height: 250px; + position: relative; +} + +DIV.nextant-display-line { + margin: 0 auto; + position: absolute; +} + +IMG.nextant_display_icon { + position: absolute; + width: 25px; + height: 25px; +} + +DIV.nextant_display_text { + top: 3px; + left: 40px; + position: absolute; + font-style: italic; +}
\ No newline at end of file diff --git a/img/check.png b/img/check.png Binary files differnew file mode 100644 index 0000000..d31c204 --- /dev/null +++ b/img/check.png diff --git a/img/fail.png b/img/fail.png Binary files differnew file mode 100644 index 0000000..b93f167 --- /dev/null +++ b/img/fail.png diff --git a/js/settings.admin.js b/js/settings.admin.js index 4d0b715..f078c3b 100644 --- a/js/settings.admin.js +++ b/js/settings.admin.js @@ -28,6 +28,53 @@ $(document) var nextantSettings = { + init : function() { + nextantSettings.statusclearall(true); + }, + + statusclearall : function(instant) { + nextantSettings.statusclear('#ping', instant); + nextantSettings.statusclear('#schema', instant); + nextantSettings.statusclear('#extract', instant); + nextantSettings.statusclear('#update', instant); + nextantSettings.statusclear('#search', instant); + nextantSettings.statusclear('#delete', instant); + nextantSettings.statusclear('#save', instant); + }, + + statusclear : function(vid, instant) { + var delay = 200; + if (instant) + delay = 0; + + $('#nextant-display').children(vid).children( + '#icon_fail').fadeTo(delay, 0); + $('#nextant-display').children(vid).children( + '#icon_check').fadeTo(delay, 0); + $('#nextant-display').children(vid).children( + '#text').fadeTo(delay, 0); + }, + + status : function(vid, text, level) { + $('#nextant-display').children(vid).children( + '#text').text(text).fadeTo(200, 1); + var src = ''; + if (level == 1) { + $('#nextant-display').children(vid).children( + '#icon_check').fadeTo(200, 1); + $('#nextant-display').children(vid).children( + '#icon_fail').fadeTo(200, 0); + } + + if (level == 2) { + $('#nextant-display').children(vid).children( + '#icon_check').fadeTo(200, 0); + $('#nextant-display').children(vid).children( + '#icon_fail').fadeTo(200, 1); + + } + }, + save : function() { $('#nextant_apply').attr('disabled', true); $('#solr_url').attr('disabled', true); @@ -38,10 +85,11 @@ $(document) }, test_standby : function(command) { - setTimeout(function() { - nextantSettings.test(command); - }, 1200); + // setTimeout(function() { + nextantSettings.test(command); + // }, 400); }, + test : function(command) { var data = { @@ -56,58 +104,64 @@ $(document) switch (command) { case 'ping': - OC.msg.startAction('#nextant-admin-msg', t( - 'nextant', - 'Ping querying your Solr Server')); + if ($('#nextant-display').children('#ping') + .children('#text').text() != '') + nextantSettings.statusclearall(false); + nextantSettings.status('#ping', + 'Ping querying your Solr Server', 0); break; case 'schema': - OC.msg.startAction('#nextant-admin-msg', - t('nextant', - 'Verifying Schema integrity')); + nextantSettings.status('#schema', + 'Verifying Schema integrity', 0); break; case 'extract': - OC.msg.startAction('#nextant-admin-msg', t( - 'nextant', - 'Test simple text extract query')); + nextantSettings.status('#extract', + 'Test simple text extract query', 0); break; case 'update': - OC.msg.startAction('#nextant-admin-msg', - t('nextant', - 'Test update document query')); + nextantSettings.status('#update', + 'Test update document query', 0); break; case 'search': - OC.msg.startAction('#nextant-admin-msg', t( - 'nextant', 'Test search query')); + nextantSettings.status('#search', + 'Test search query', 0); break; case 'delete': - OC.msg.startAction('#nextant-admin-msg', - t('nextant', - 'Removing the test document')); + nextantSettings.status('#delete', + 'Removing the test document', 0); break; case 'save': - OC.msg - .startAction( - '#nextant-admin-msg', - t('nextant', - 'All test went fine. Saving your configuration')); + nextantSettings + .status( + '#save', + 'All test went fine. Saving your configuration', + 0); break; } $.post(OC.filePath('nextant', 'ajax/settings', - 'admin.php'), data, nextantSettings.tested); + 'admin.php'), data, + nextantSettings.tested_standby); + + }, + tested_standby : function(response) { + // setTimeout(function() { + nextantSettings.tested(response); + // }, 200); }, tested : function(response) { + nextantSettings.status('#' + response.command, + response.data.message, + (response.status == 'success') ? 1 : 2); - OC.msg.finishedAction('#nextant-admin-msg', - response); switch (response.command) { case 'ping': if (response.status == 'success') @@ -182,4 +236,5 @@ $(document) $('#nextant_force_index').on('click', nextantSettings.forceindex); + nextantSettings.init(); }); diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index cd2c968..fb58f98 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -77,6 +77,7 @@ class SettingsController extends Controller 'live_docupdate' => $this->configService->getAppValue('live_docupdate'), 'solr_lock' => $this->configService->getAppValue('solr_lock') ]; + return new TemplateResponse($this->appName, 'settings.admin', $params, 'blank'); } diff --git a/templates/settings.admin.php b/templates/settings.admin.php index 03fb5a5..bcea9be 100644 --- a/templates/settings.admin.php +++ b/templates/settings.admin.php @@ -24,9 +24,11 @@ * */ script('nextant', 'settings.admin'); +style('nextant', 'admin'); + ?> <div class="section" id="nextant"> - <h2><?php p($l->t('Nextant (Solr)')) ?></h2> + <h2><?php p($l->t('Nextant (Full-Text Search)')) ?></h2> <table> <tr> @@ -36,30 +38,86 @@ script('nextant', 'settings.admin'); few guides on how to install one on the Wiki</a></em></td> </tr> <tr> - <td> </td> - </tr> + <td> + <table> + <tr> + <td> </td> + </tr> + <tr> + <td style="text-align: right;"><label> + <?php p($l->t('Address of your Solr Servlet :')) ?> </label></td> + <td><input type="text" name="solr_url" id="solr_url" + value="<?php p($_['solr_url'])?>" style="width: 250px;"></td> + </tr> + + <tr> + <td style="text-align: right;"><label><?php p($l->t('Core :')) ?> </label></td> + <td><input type="text" id="solr_core" + value="<?php p($_['solr_core'])?>" style="width: 250px;"></td> + </tr> + + <tr> + <td></td> + <td> + <button type="button" id="nextant_apply" style="width: 270px"><?php p($l->t('Test and Save')) ?></button> + </td> + </tr> + <tr> + <td> </td> + </tr> + <!-- <tr style="height: 40px;"> + <td colspan="2" style="text-align: center; width: 300px;"><span + id="nextant-admin-msg" class="msg"></span></td> + </tr> + --> <?php if ($_['configured'] == '1') { ?> - <tr> - <td style="width: 250px; text-align: right;"><label> - <?php p($l->t('Number of documents :')) ?> </label></td> - <td><?php ($_['current_docs'] === false) ? p('Solr Servlet is down') : p($_['current_docs']); ?></td> - </tr> - <tr> - <td style="width: 250px; text-align: right;"><label> + + <tr style="height: 30px;"> + <td style="text-align: right;"><label> + <?php p($l->t('Live Extract :')) ?> </label></td> + <td><input type="checkbox" name="solr_live_extract" + id="solr_live_extract" value="1" + <?php if ($_['live_extract'] == '1') { p('CHECKED'); } ?> + style="margin: 10px;"> (<a + href="https://github.com/daita/nextant/wiki/Extracting-&-Live-Update" + target="_blank">help</a>)</td> + </tr> + + <tr style="height: 30px;"> + <td style="text-align: right;"><label> + <?php p($l->t('Live Document Update :')) ?> </label></td> + <td><input type="checkbox" name="solr_live_docupdate" + id="solr_live_docupdate" value="1" + <?php if ($_['live_docupdate'] == '1') { p('CHECKED'); } ?> + style="margin: 10px;"></td> + </tr> + <tr style="height: 20px;"> + <td style="width: 250px; text-align: right;"><label> <?php p($l->t('Last index:')) ?> </label></td> - <td><?php + <td><?php if ($_['last_index'] > 0) { p(date('r', $_['last_index'])); ?></td> - <td><?php + + </tr> + <tr style="height: 20px;"> + <td style="width: 250px; text-align: right;"><label> + <?php p($l->t('Number of documents :')) ?> </label></td> + <td><?php ($_['current_docs'] === false) ? p('Solr Servlet is down') : p($_['current_docs']); ?></td> + </tr> + + <tr> + <td></td> + + <td><?php if ($_['needed_index'] == 0) { ?> <button type="button" id="nextant_force_index" - style="width: 170px"><?php p($l->t('Force re-index')) ?></button> + style="width: 270px"><?php p($l->t('Force re-index')) ?></button> <?php } else if ($_['needed_index'] == 2) { @@ -69,54 +127,74 @@ if ($_['configured'] == '1') { } else p('never'); ?></td> - </tr> -<?php } ?> - <tr> - <td style="text-align: right;"><label> - <?php p($l->t('Live Extract :')) ?> </label></td> - <td><input type="checkbox" name="solr_live_extract" - id="solr_live_extract" value="1" - <?php if ($_['live_extract'] == '1') { p('CHECKED'); } ?> - style="margin: 10px;"> (<a - href="https://github.com/daita/nextant/wiki/Extracting-&-Live-Update" - target="_blank">help</a>)</td> - </tr> + </tr> + <?php } ?> + + </table> + </td> + <td style="padding-left: 40px;"> + <div id="nextant-display"> + <div id="ping" class="nextant-display-line"> + <img id="icon_check" class="nextant_display_icon" + src="<?php print_unescaped(OCP\image_path('nextant', 'check.png')); ?>" /> + <img id="icon_fail" class="nextant_display_icon" + src="<?php print_unescaped(OCP\image_path('nextant', 'fail.png')); ?>" /> + <div id="text" class="nextant_display_text"></div> + </div> - <tr> - <td style="text-align: right;"><label> - <?php p($l->t('Live Document Update :')) ?> </label></td> - <td><input type="checkbox" name="solr_live_docupdate" - id="solr_live_docupdate" value="1" - <?php if ($_['live_docupdate'] == '1') { p('CHECKED'); } ?> - style="margin: 10px;"></td> - </tr> + <div id="schema" class="nextant-display-line" style="top: 30px;"> + <img id="icon_check" class="nextant_display_icon" + src="<?php print_unescaped(OCP\image_path('nextant', 'check.png')); ?>" /> + <img id="icon_fail" class="nextant_display_icon" + src="<?php print_unescaped(OCP\image_path('nextant', 'fail.png')); ?>" /> + <div id="text" class="nextant_display_text"></div> + </div> - <tr> - <td style="text-align: right;"><label> - <?php p($l->t('Address of your Solr Servlet :')) ?> </label></td> - <td><input type="text" name="solr_url" id="solr_url" - value="<?php p($_['solr_url'])?>" style="width: 360px;"></td> - </tr> + <div id="extract" class="nextant-display-line" style="top: 60px;"> + <img id="icon_check" class="nextant_display_icon" + src="<?php print_unescaped(OCP\image_path('nextant', 'check.png')); ?>" /> + <img id="icon_fail" class="nextant_display_icon" + src="<?php print_unescaped(OCP\image_path('nextant', 'fail.png')); ?>" /> + <div id="text" class="nextant_display_text"></div> + </div> - <tr> - <td style="text-align: right;"><label><?php p($l->t('Core :')) ?> </label></td> - <td><input type="text" id="solr_core" - value="<?php p($_['solr_core'])?>" style="width: 360px;"></td> - </tr> + <div id="update" class="nextant-display-line" style="top: 90px;"> + <img id="icon_check" class="nextant_display_icon" + src="<?php print_unescaped(OCP\image_path('nextant', 'check.png')); ?>" /> + <img id="icon_fail" class="nextant_display_icon" + src="<?php print_unescaped(OCP\image_path('nextant', 'fail.png')); ?>" /> + <div id="text" class="nextant_display_text"></div> + </div> - <tr> - <td></td> - <td> - <button type="button" id="nextant_apply" style="width: 370px"><?php p($l->t('Test and Save')) ?></button> + <div id="search" class="nextant-display-line" style="top: 120px;"> + <img id="icon_check" class="nextant_display_icon" + src="<?php print_unescaped(OCP\image_path('nextant', 'check.png')); ?>" /> + <img id="icon_fail" class="nextant_display_icon" + src="<?php print_unescaped(OCP\image_path('nextant', 'fail.png')); ?>" /> + <div id="text" class="nextant_display_text"></div> + </div> + + <div id="delete" class="nextant-display-line" style="top: 150px;"> + <img id="icon_check" class="nextant_display_icon" + src="<?php print_unescaped(OCP\image_path('nextant', 'check.png')); ?>" /> + <img id="icon_fail" class="nextant_display_icon" + src="<?php print_unescaped(OCP\image_path('nextant', 'fail.png')); ?>" /> + <div id="text" class="nextant_display_text"></div> + </div> + + <div id="save" class="nextant-display-line" style="top: 190px;"> + <img id="icon_check" class="nextant_display_icon" + src="<?php print_unescaped(OCP\image_path('nextant', 'check.png')); ?>" /> + <img id="icon_fail" class="nextant_display_icon" + src="<?php print_unescaped(OCP\image_path('nextant', 'fail.png')); ?>" /> + <div id="text" class="nextant_display_text"></div> + </div> + + </div> </td> </tr> - <tr style="height: 40px;"> - <td colspan="2" style="text-align: center; width: 550px;"><span - id="nextant-admin-msg" class="msg"></span></td> - </tr> </table> - </div> |