summaryrefslogtreecommitdiffstats
path: root/settings
Commit message (Expand)AuthorAgeFilesLines
* [tx-robot] updated from transifexJenkins for ownCloud2012-08-052-6/+10
* Make 3rd party label a bit smaller.Thomas Tanghus2012-08-051-1/+1
* Some more pixel pushing.Thomas Tanghus2012-08-051-2/+2
* CSS tweaks for app settings.Thomas Tanghus2012-08-052-6/+11
* Return possibly changed appid.Thomas Tanghus2012-08-051-3/+4
* Restructure JS code and small fixes.Thomas Tanghus2012-08-041-55/+63
* Listen to correct undo click for undoing deleting usersMichael Gapczynski2012-08-041-1/+1
* Show delete tipsy for usersMichael Gapczynski2012-08-043-7/+10
* Tweak users delete notificationMichael Gapczynski2012-08-041-1/+1
* Remove unused code.Thomas Tanghus2012-08-041-33/+0
* Merge branch 'master' of gitorious.org:owncloud/owncloudAlessandro Cosentino2012-08-041-1/+1
|\
| * Wait with csrf check for now.Thomas Tanghus2012-08-041-1/+1
* | link of Add your app was brokenAlessandro Cosentino2012-08-041-1/+1
|/
* And add the file goddammitThomas Tanghus2012-08-041-0/+65
* Load OCS apps in an ajax call to avoid blocking the WUI.Thomas Tanghus2012-08-044-33/+86
* reset version number when not specified - again bug oc-1433Alessandro Cosentino2012-08-041-1/+5
* fixes bug oc-1433Alessandro Cosentino2012-08-041-0/+1
* hide morelog button if there are no more log entries - bugfix for oc-1398Georg Ehrke2012-08-044-1/+10
* [tx-robot] updated from transifexJenkins for ownCloud2012-08-041-0/+2
* [tx-robot] updated from transifexJenkins for ownCloud2012-08-0212-9/+7
* little fix for previous commitGeorg Ehrke2012-08-011-1/+1
* fix a subadmin UI bugGeorg Ehrke2012-08-012-1/+11
* [tx-robot] updated from transifexJenkins for ownCloud2012-07-315-3/+45
* [tx-robot] updated from transifexJenkins for ownCloud2012-07-304-1/+9
* [tx-robot] updated from transifexJenkins for ownCloud2012-07-294-4/+12
* [tx-robot] updated from transifexJenkins for ownCloud2012-07-284-0/+12
* Cast groups as string, fixes bug oc-1309. Thanks to nderambure.Michael Gapczynski2012-07-261-1/+1
* Check if size isset, try to fix used space calculation again, fixs bug oc-1331Michael Gapczynski2012-07-261-1/+1
* [tx-robot] updated from transifexJenkins for ownCloud2012-07-2733-1/+259
* Merge branch 'subadmin'Georg Ehrke2012-07-269-41/+202
|\
| * Merge branch 'master' into subadminGeorg Ehrke2012-07-263-0/+62
| |\
| * | some js improvements for subadminsGeorg Ehrke2012-07-211-0/+3
| * | don't show label 'add group' for subadmins and remove some debug codeGeorg Ehrke2012-07-201-5/+7
| * | improve default qouta for subadminsGeorg Ehrke2012-07-202-3/+14
| * | fix tooglegroup for subadminsGeorg Ehrke2012-07-201-1/+7
| * | simplify code of createuser.phpGeorg Ehrke2012-07-201-7/+4
| * | simplify code of changepassword.phpGeorg Ehrke2012-07-191-12/+2
| * | fix copy&paste fail and deny subadmins to set the default qoutaGeorg Ehrke2012-07-193-4/+4
| * | fix setqouta for subadminsGeorg Ehrke2012-07-191-1/+7
| * | simplify code of remoteuser.phpGeorg Ehrke2012-07-191-14/+4
| * | fix removeuser.php for subadminsGeorg Ehrke2012-07-181-1/+17
| * | remove unused code from togglesubadmins.phpGeorg Ehrke2012-07-181-4/+0
| * | fix changepassword.php for subadminsGeorg Ehrke2012-07-181-1/+22
| * | Merge branch 'master' into subadminGeorg Ehrke2012-07-151-18/+17
| |\ \
| * | | add another file which was missing in the previous commitGeorg Ehrke2012-07-151-0/+23
| * | | subadmins can now add usersGeorg Ehrke2012-07-154-40/+110
| * | | fix merge conflictsGeorg Ehrke2012-07-1117-28/+17
| |\ \ \
| * | | | some work on subadminsGeorg Ehrke2012-07-092-10/+37
* | | | | Fix used space calculation if shared folder does not exist, fixes bug oc-1331Michael Gapczynski2012-07-261-1/+6
| |_|_|/ |/| | |
* | | | [tx-robot] updated from transifexJenkins for ownCloud2012-07-261-0/+48
pan> }, error: function (jqXHR, textStatus, errorThrown) { alertMessage('alert-error', 'Cannot receive throughput data: ' + textStatus + ' ' + jqXHR.status + ' ' + errorThrown); } }); } // @get history log // function getChart() { // //console.log(data) // $.ajax({ // dataType: 'json', // url: './pie', // beforeSend: function(xhr) { // xhr.setRequestHeader('Password', getPassword()) // }, // error: function() { // alertMessage('alert-error', 'Cannot receive history'); // }, // success: function(data) { // console.log(data); // } // }); // } // @get history log function getHistory() { if (history) { var history_length = document.getElementsByName('historyLog_length')[0]; if (history_length !== undefined) { history_length = parseInt(history_length.value); } else { history_length = 10; } history.destroy(); $('#historyLog').children('tbody').remove(); } var items = []; $.ajax({ dataType: 'json', url: 'history', jsonp: false, beforeSend: function (xhr) { xhr.setRequestHeader('Password', getPassword()); }, error: function () { alertMessage('alert-error', 'Cannot receive history'); }, success: function (data) { $.each(data, function (i, item) { var action; if (item.action === 'clean' || item.action === 'no action') { action = 'label-success'; } else if (item.action === 'rewrite subject' || item.action === 'add header' || item.action === 'probable spam') { action = 'label-warning'; } else if (item.action === 'spam' || item.action === 'reject') { action = 'label-danger'; } else { action = 'label-info'; } var score; if (item.score < item.required_score) { score = 'label-success'; } else { score = 'label-danger'; } items.push( '<tr><td data-order="' + item.unix_time + '">' + item.time + '</td>' + '<td data-order="' + item.id + '"><div class="cell-overflow" tabindex="1" title="' + item.id + '">' + item.id + '</div></td>' + '<td data-order="' + item.ip + '"><div class="cell-overflow" tabindex="1" title="' + item.ip + '">' + item.ip + '</div></td>' + '<td data-order="' + item.action + '"><span class="label ' + action + '">' + item.action + '</span></td>' + '<td data-order="' + item.score + '"><span class="label ' + score + '">' + item.score.toFixed(2) + ' / ' + item.required_score.toFixed(2) + '</span></td>' + '<td data-order="' + item.symbols + '"><div class="cell-overflow" tabindex="1" title="' + item.symbols + '">' + item.symbols + '</div></td>' + '<td data-order="' + item.size + '">' + item.size + '</td>' + '<td data-order="' + item.scan_time + '">' + item.scan_time.toFixed(3) + '</td>' + '<td data-order="' + item.user + '"><div class="cell-overflow" tabindex="1" "title="' + item.user + '">' + item.user + '</div></td></tr>'); }); $('<tbody/>', { html: items.join('') }).insertAfter('#historyLog thead'); history = $('#historyLog').DataTable({ "aLengthMenu": [ [100, 200, -1], [100, 200, "All"] ], "bStateSave": true, "order": [ [0, "desc"] ], "pageLength": history_length }); } }); } function getErrors() { if (read_only) return; if (errors) { errors.destroy(); $('#errorsLog').children('tbody').remove(); } var items = []; $.ajax({ dataType: 'json', url: 'errors', jsonp: false, beforeSend: function (xhr) { xhr.setRequestHeader('Password', getPassword()); }, error: function () { alertMessage('alert-error', 'Cannot receive errors'); }, success: function (data) { $.each(data, function (i, item) { items.push( '<tr><td data-order="' + item.ts + '">' + new Date(item.ts * 1000) + '</td>' + '<td data-order="' + item.type + '">' + item.type + '</td>' + '<td data-order="' + item.pid + '">' + item.pid + '</td>' + '<td data-order="' + item.module + '">' + item.module + '</td>' + '<td data-order="' + item.id + '">' + item.id + '</td>' + '<td data-order="' + item.message + '"><div class="cell-overflow" tabindex="1" title="' + item.message + '">' + item.message + '</div></td></tr>' ); }); $('<tbody/>', { html: items.join('') }).insertAfter('#errorsLog thead'); errors = $('#errorsLog').DataTable({ "paging": true, "orderMulti": false, "order": [ [0, "desc"], ], "info": false, "columns": [ {"width": "15%", "searchable": true, "orderable": true, "type": "num"}, {"width": "5%", "searchable": true, "orderable": true}, {"width": "5%", "searchable": true, "orderable": true}, {"width": "3%", "searchable": true, "orderable": true}, {"width": "3%", "searchable": true, "orderable": true}, {"width": "65%", "searchable": true, "orderable": true}, ], }); errors.columns.adjust().draw(); } }); } function decimalStep(number) { var digits = ((+number).toFixed(20)).replace(/^-?\d*\.?|0+$/g, '').length; if (digits == 0 || digits > 4) { return 0.1; } else { return 1.0 / (Math.pow(10, digits)); } } // @get symbols into modal form function getSymbols() { if (symbols) { symbols.destroy(); symbols = null; $('#symbolsTable').children('tbody').remove(); } var items = []; $.ajax({ dataType: 'json', type: 'GET', url: 'symbols', jsonp: false, beforeSend: function (xhr) { xhr.setRequestHeader('Password', getPassword()); }, success: function (data) { $.each(data, function (i, group) { $.each(group.rules, function (i, item) { var max = 20; var min = -20; if (item.weight > max) { max = item.weight * 2; } if (item.weight < min) { min = item.weight * 2; } var label; if (item.weight < 0) { label_class = 'scorebar-ham'; } else { label_class = 'scorebar-spam'; } if (!item.time) { item.time = 0; } if (!item.frequency) { item.frequency = 0; } items.push('<tr>' + '<td data-order="' + group.group + '"><div class="cell-overflow" tabindex="1" title="' + group.group + '">' + group.group + '</div></td>' + '<td data-order="' + item.symbol + '"><strong>' + item.symbol + '</strong></td>' + '<td data-order="' + item.description + '"><div class="cell-overflow" tabindex="1" title="' + item.description + '">' + item.description + '</div></td>' + '<td data-order="' + item.weight + '"><input class="numeric mb-disabled ' + label_class + '" data-role="numerictextbox" autocomplete="off" "type="number" class="input" min="' + min + '" max="' + max + '" step="' + decimalStep(item.weight) + '" tabindex="1" value="' + Number(item.weight).toFixed(3) + '" id="_sym_' + item.symbol + '"></span></td>' + '<td data-order="' + item.frequency + '">' + item.frequency + '</td>' + '<td data-order="' + item.time + '">' + Number(item.time).toFixed(2) + 'ms</td>' + '<td><button type="button" class="btn btn-primary btn-sm mb-disabled">Save</button></td></tr>'); }); }); $('<tbody/>', { html: items.join('') }).insertAfter('#symbolsTable thead'); symbols = $('#symbolsTable').DataTable({ "paging": false, "orderMulti": true, "order": [ [0, "asc"], [1, "asc"], [3, "desc"] ], "info": false, "columns": [ {"width": "7%", "searchable": true, "orderable": true}, {"width": "20%", "searchable": true, "orderable": true}, {"width": "30%", "searchable": false, "orderable": false}, {"width": "7%", "searchable": false, "orderable": true, "type": "num"}, {"searchable": false, "orderable": true, "type": "num"}, {"searchable": false, "orderable": true, "type": "num"}, {"width": "5%", "searchable": false, "orderable": false, "type": "html"} ], }); symbols.columns.adjust().draw(); $('#symbolsTable :button').on('click', function(){saveSymbols("./savesymbols", "symbolsTable")}); if (read_only) { $( ".mb-disabled" ).attr('disabled', true); } }, error: function (data) { alertMessage('alert-modal alert-error', data.statusText); } }); } // @reset history log $('#resetHistory').on('click', function () { if (!confirm("Are you sure you want to reset history log?")) { return }; if (history) { history.destroy(); $('#historyLog').children('tbody').remove(); } $.ajax({ dataType: 'json', type: 'GET', jsonp: false, url: 'historyreset', beforeSend: function (xhr) { xhr.setRequestHeader('Password', getPassword()); }, success: function (data) { getHistory(); getErrors(); }, error: function (data) { alertMessage('alert-modal alert-error', data.statusText); } }); }); // @update history log $('#updateHistory').on('click', function () { getHistory(); }); $('#updateErrors').on('click', function () { getErrors(); }); $('#updateSymbols').on('click', function () { getSymbols(); }); // @upload text function uploadText(data, source, headers) { if (source === 'spam') { var url = 'learnspam'; } else if (source === 'ham') { var url = 'learnham'; } else if (source == 'fuzzy') { var url = 'fuzzyadd'; } else if (source === 'scan') { var url = 'scan'; } $.ajax({ data: data, dataType: 'json', type: 'POST', url: url, processData: false, jsonp: false, beforeSend: function (xhr) { xhr.setRequestHeader('Password', getPassword()); $.each(headers, function (name, value) { xhr.setRequestHeader(name, value); }); }, success: function (data) { cleanTextUpload(source); if (data.success) { alertMessage('alert-success', 'Data successfully uploaded'); } }, error: function (xhr, textStatus, errorThrown) { try { var json = $.parseJSON(xhr.responseText); var errorMsg = $('<a>').text(json.error).html(); } catch (err) { var errorMsg = $('<a>').text("Error: [" + textStatus + "] " + errorThrown).html(); } alertMessage('alert-error', errorMsg); } }); } // @upload text function scanText(data) { var url = 'scan'; var items = []; $.ajax({ data: data, dataType: 'json', type: 'POST', url: url, processData: false, jsonp: false, beforeSend: function (xhr) { xhr.setRequestHeader('Password', getPassword()); }, success: function (input) { var data = input['default']; if (data.action) { alertMessage('alert-success', 'Data successfully scanned'); if (data.action === 'clean' || 'no action') { var action = 'label-success'; } if (data.action === 'rewrite subject' || 'add header' || 'probable spam') { var action = 'label-warning'; } if (data.action === 'spam') { var action = 'label-danger'; } if (data.score <= data.required_score) { var score = 'label-success'; } if (data.score >= data.required_score) { var score = 'label-danger'; } $('<tbody id="tmpBody"><tr>' + '<td><span class="label ' + action + '">' + data.action + '</span></td>' + '<td><span class="label ' + score + '">' + data.score.toFixed(2) + '/' + data.required_score.toFixed(2) + '</span></td>' + '</tr></tbody>') .insertAfter('#scanOutput thead'); var sym_desc = {}; var nsym = 0; $.each(data, function (i, item) { if (typeof item == 'object') { var sym_id = "sym_" + nsym; if (item.description) { sym_desc[sym_id] = item.description; } items.push('<div class="cell-overflow" tabindex="1"><abbr id="' + sym_id + '">' + item.name + '</abbr>: ' + item.score.toFixed(2) + '</div>'); nsym++; } }); $('<td/>', { id: 'tmpSymbols', html: items.join('') }).appendTo('#scanResult'); $('#tmpSymbols').insertAfter('#tmpBody td:last').removeAttr('id'); $('#tmpBody').removeAttr('id'); $('#scanResult').show(); // Show tooltips $.each(sym_desc, function (k, v) { $('#' + k).tooltip({ "placement": "bottom", "title": v }); }); $('html, body').animate({ scrollTop: $('#scanResult').offset().top }, 1000); } else { alertMessage('alert-error', 'Cannot scan data'); } }, error: function (jqXHR, textStatus, errorThrown) { alertMessage('alert-error', 'Cannot upload data: ' + textStatus + ", " + errorThrown); }, statusCode: { 404: function () { alertMessage('alert-error', 'Cannot upload data, no server found'); }, 500: function () { alertMessage('alert-error', 'Cannot tokenize message: no text data'); }, 503: function () { alertMessage('alert-error', 'Cannot tokenize message: no text data'); } } }); } // @close scan output $('#scanClean').on('click', function () { $('#scanTextSource').val(""); $('#scanResult').hide(); $('#scanOutput tbody').remove(); $('html, body').animate({scrollTop: 0}, 1000); return false; }); // @init upload $('[data-upload]').on('click', function () { var source = $(this).data('upload'); var data; var headers = {}; data = $('#' + source + 'TextSource').val(); if (source == 'fuzzy') { //To access the proper headers.flag = $('#fuzzyFlagText').val(); headers.weigth = $('#fuzzyWeightText').val(); } else { data = $('#' + source + 'TextSource').val(); } if (data.length > 0) { if (source == 'scan') { scanText(data); } else { uploadText(data, source, headers); } } return false; }); // @empty textarea on upload complete function cleanTextUpload(source) { $('#' + source + 'TextSource').val(''); } // @get acions function getActions() { var items = []; $.ajax({ dataType: 'json', type: 'GET', url: 'actions', jsonp: false, beforeSend: function (xhr) { xhr.setRequestHeader('Password', getPassword()); }, success: function (data) { // Order of sliders greylist -> probable spam -> spam $('#actionsBody').empty(); $('#actionsForm').empty(); var items = []; var min = 0; var max = Number.MIN_VALUE; $.each(data, function (i, item) { var idx = -1; var label; if (item.action === 'add header') { label = 'Probably Spam'; idx = 1; } else if (item.action === 'greylist') { label = 'Greylist'; idx = 0; } else if (item.action === 'rewrite subject') { label = 'Rewrite subject'; idx = 2; } else if (item.action === 'reject') { label = 'Spam'; idx = 3; } if (idx >= 0) { items.push({ idx: idx, html: '<div class="form-group">' + '<label class="control-label col-sm-2">' + label + '</label>' + '<div class="controls slider-controls col-sm-10">' + '<input class="slider" type="slider" value="' + item.value + '">' + '</div>' + '</div>' }); } if (item.value > max) { max = item.value * 2; } if (item.value < min) { min = item.value; } }); items.sort(function (a, b) { return a.idx - b.idx; }); $('#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" type="submit">Save actions</button></div></fieldset></form>'); if (read_only) { $('#actionsFormField').attr('disabled', true) } } }); } // @upload edited actions $(document).on('submit', '#actionsForm', function () { var inputs = $('#actionsForm :input[type="slider"]'); var url = 'saveactions'; var values = []; // Rspamd order: [spam,probable_spam,greylist] values[0] = parseFloat(inputs[2].value); values[1] = parseFloat(inputs[1].value); values[2] = parseFloat(inputs[0].value); $.ajax({ data: JSON.stringify(values), dataType: 'json', type: 'POST', url: url, jsonp: false, beforeSend: function (xhr) { xhr.setRequestHeader('Password', getPassword()); }, success: function () { alertMessage('alert-success', 'Actions successfully saved'); }, error: function (data) { alertMessage('alert-modal alert-error', data.statusText); } }); return false; }); // @catch changes of file upload form $(window).resize(function (e) { var form = $(this).attr('id'); var height = $(form).height(); }); // @watch textarea changes $('textarea').change(function () { if ($(this).val().length != '') { $(this).closest('form').find('button').removeAttr('disabled').removeClass('disabled'); } else { $(this).closest('form').find('button').attr('disabled').addClass('disabled'); } }); // @save forms from modal $(document).on('click', '#modalSave', function () { var form = $('#modalBody').children().filter(':visible'); // var map = $(form).data('map'); // var type = $(form).data('type'); var action = $(form).attr('action'); var id = $(form).attr('id'); var type = $(form).data('type'); if (type === 'symbols') { saveSymbols(action, id); } else if (type === 'map') { saveMap(action, id); } }); // @upload map from modal function saveMap(action, id) { var data = $('#' + id).find('textarea').val(); $.ajax({ data: data, dataType: 'text', type: 'POST', jsonp: false, url: action, beforeSend: function (xhr) { xhr.setRequestHeader('Password', getPassword()); xhr.setRequestHeader('Map', id); xhr.setRequestHeader('Debug', true); }, error: function (data) { alertMessage('alert-modal alert-error', data.statusText); }, success: function (data) { alertMessage('alert-modal alert-success', 'Map data successfully saved'); $('#modalDialog').modal('hide'); } }); } // @upload symbols from modal function saveSymbols(action, id) { var inputs = $('#' + id + ' :input[data-role="numerictextbox"]'); var url = action; var values = []; $(inputs).each(function () { values.push({ name: $(this).attr('id').substring(5), value: parseFloat($(this).val()) }); }); $.ajax({ data: JSON.stringify(values), dataType: 'json', type: 'POST', url: url, jsonp: false, beforeSend: function (xhr) { xhr.setRequestHeader('Password', getPassword()); }, success: function () { alertMessage('alert-modal alert-success', 'Symbols successfully saved'); }, error: function (data) { alertMessage('alert-modal alert-error', data.statusText); } }); $('#modalDialog').modal('hide'); return false; } // @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; $('#learning_nav').hide(); $('#resetHistory').attr('disabled', true); $('#errors-history').hide(); } else { read_only = false; $('#learning_nav').show(); $('#resetHistory').removeAttr('disabled', true); } displayUI(); return; } var nav = $('#navBar'); var ui = $('#mainUI'); var dialog = $('#connectDialog'); var backdrop = $('#backDrop'); var disconnect = $('#navBar .pull-right'); $(ui).hide(); $(dialog).show(); $('#connectHost').focus(); $(backdrop).show(); document.getElementById("connectPassword").focus(); $('#connectForm').one('submit', function (e) { e.preventDefault(); var password = $('#connectPassword').val(); document.getElementById('connectPassword').value = ''; $.ajax({ global: false, jsonp: false, dataType: 'json', type: 'GET', url: 'auth', beforeSend: function (xhr) { xhr.setRequestHeader('Password', password); }, success: function (data) { if (data.auth === 'failed') { $(form).each(function () { $('.form-group').addClass('error'); }); } else { if (data.read_only) { read_only = true; $('#learning_nav').hide(); $('#resetHistory').attr('disabled', true); $('#errors-history').hide(); } else { read_only = false; $('#learning_nav').show(); $('#resetHistory').removeAttr('disabled', true); } saveCredentials(data, password); $(dialog).hide(); $(backdrop).hide(); displayUI(); } }, error: function (data) { alertMessage('alert-modal alert-error', data.statusText); } }); }); } function displayUI() { // @toggle auth and main var disconnect = $('#navBar .pull-right'); statWidgets(); stat_timeout = Visibility.every(10000, function () { statWidgets(); }); $('#mainUI').show(); $('#progress').show(); getChart(); initGraph(); if ($("#throughput_nav").attr("aria-expanded") === "true") { getGraphData(selected.selData); } $('#progress').hide(); $(disconnect).show(); } connectRSPAMD(); $('#configuration_nav').bind('click', function (e) { getActions(); $('#modalBody').empty(); getMaps(); }); $(document).ajaxStart(function () { $('#navBar').addClass('loading'); }); $(document).ajaxComplete(function () { setTimeout(function () { $('#navBar').removeClass('loading'); }, 1000); }); $('#status_nav').bind('click', function (e) { getChart(); }); $('#throughput_nav').bind('click', function () { getGraphData(selected.selData); }); $('#history_nav').bind('click', function () { getHistory(); getErrors(); }); $('#symbols_nav').bind('click', function () { getSymbols(); }); }); })();