$(document).ready(function() { // Log modal $('#logModal').on('show.bs.modal', function(e) { var logText = $(e.relatedTarget).data('log-text'); $(e.currentTarget).find('#logText').html('
' + logText + ''); }); }); jQuery(function($){ // http://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery var entityMap = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '/': '/', '`': '`', '=': '=' }; function escapeHtml(string) { return String(string).replace(/[&<>"'`=\/]/g, function (s) { return entityMap[s]; }); } // http://stackoverflow.com/questions/46155/validate-email-address-in-javascript function validateEmail(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } function unix_time_format(tm) { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString(); } function draw_tla_table() { ft_tla_table = FooTable.init('#tla_table', { "columns": [ {"name":"chkbox","title":"","style":{"maxWidth":"40px","width":"40px","text-align":"center"},"filterable": false,"sortable": false,"type":"html"}, {"sorted": true,"name":"address","title":lang.alias}, {"name":"validity","formatter":function unix_time_format(tm) { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString();},"title":lang.alias_valid_until,"style":{"width":"170px"}}, ], "empty": lang.empty, "rows": $.ajax({ dataType: 'json', url: '/api/v1/get/time_limited_aliases', jsonp: false, error: function () { console.log('Cannot draw tla table'); }, success: function (data) { $.each(data, function (i, item) { item.chkbox = ''; }); } }), "paging": { "enabled": true, "limit": 5, "size": pagination_size }, "sorting": { "enabled": true } }); } function draw_sync_job_table() { ft_syncjob_table = FooTable.init('#sync_job_table', { "columns": [ {"name":"chkbox","title":"","style":{"maxWidth":"40px","width":"40px","text-align":"center"},"filterable": false,"sortable": false,"type":"html"}, {"sorted": true,"name":"id","title":"ID"}, {"name":"server_w_port","title":"Server"}, {"name":"enc1","title":lang.encryption}, {"name":"user1","title":lang.username}, {"name":"exclude","title":lang.excludes}, {"name":"mins_interval","title":lang.interval + " (min)"}, {"name":"last_run","title":lang.last_run}, {"name":"log","title":"Log"}, {"name":"active","filterable": false,"style":{"maxWidth":"50px","width":"70px"},"title":lang.active}, {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"180px","width":"180px"},"type":"html","title":lang.action,"breakpoints":"xs sm"} ], "empty": lang.empty, "rows": $.ajax({ dataType: 'json', url: '/api/v1/get/syncjobs', jsonp: false, error: function () { console.log('Cannot draw sync job table'); }, success: function (data) { $.each(data, function (i, item) { item.log = 'Open logs' item.exclude = '
' + item.exclude + '
'
item.server_w_port = item.host1 + ':' + item.port1;
item.action = '