diff options
author | Anna Stakhova <anna@rspamd.com> | 2016-12-12 23:07:22 +0000 |
---|---|---|
committer | Anna Stakhova <anna@rspamd.com> | 2016-12-12 23:07:22 +0000 |
commit | 6f9a377aac404ccf0b951e173ff05d2620cbd2da (patch) | |
tree | 87cb9e91210cbf83c7def6040411994386cf75bd /interface | |
parent | e72365b0f47a5e1048fbc7d57170d07fe8457018 (diff) | |
download | rspamd-6f9a377aac404ccf0b951e173ff05d2620cbd2da.tar.gz rspamd-6f9a377aac404ccf0b951e173ff05d2620cbd2da.zip |
[WebUI] Fix read only
Diffstat (limited to 'interface')
-rw-r--r-- | interface/js/rspamd.js | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/interface/js/rspamd.js b/interface/js/rspamd.js index ec273f27f..951d60bba 100644 --- a/interface/js/rspamd.js +++ b/interface/js/rspamd.js @@ -1057,13 +1057,16 @@ return a.idx - b.idx; }); - $('#actionsBody').html('<form id="actionsForm">' + + $('#actionsBody').html('<form id="actionsForm"><fieldset id="actionsFormField">' + items.map(function (e) { return e.html; }).join('') + '<br><div class="form-group">' + '<button class="btn btn-primary ' + btn_class + - '" type="submit">Save actions</button></div></form>'); + '" type="submit">Save actions</button></div></fieldset></form>'); + if (read_only) { + $('#actionsFormField').attr('disabled', true) + } } }); } @@ -1177,6 +1180,24 @@ // @connect to server function connectRSPAMD() { if (isLogged()) { + var data; + if (!supportsSessionStorage()) { + data = $.cookie('rspamdsession'); + } else { + data = JSON.parse(sessionStorage.getItem('Credentials')); + } + if (data.read_only) { + read_only = true; + btn_class = "disabled"; + $('#learning_nav').parent().addClass('disabled'); + $('#learning_nav').removeAttr('data-toggle', 'tab'); + } + else { + read_only = false; + btn_class = ""; + $('#learning_nav').parent().removeClass('disabled') + $('#learning_nav').attr('data-toggle', 'tab'); + } displayUI(); return; } @@ -1213,11 +1234,13 @@ read_only = true; btn_class = "disabled"; $('#learning_nav').parent().addClass('disabled'); + $('#learning_nav').removeAttr('data-toggle', 'tab'); } else { read_only = false; btn_class = ""; $('#learning_nav').parent().removeClass('disabled') + $('#learning_nav').attr('data-toggle', 'tab'); } saveCredentials(data, password); |