$(document).ready(function() { acl_data = JSON.parse(acl); FooTable.domainFilter = FooTable.Filtering.extend({ construct: function(instance){ this._super(instance); var domain_list = []; $.ajax({ dataType: 'json', url: '/api/v1/get/domain/all', jsonp: false, async: true, error: function () { domain_list.push('Cannot read domain list'); }, success: function (data) { $.each(data, function (i, item) { domain_list.push(item.domain_name); }); } }); this.domains = domain_list; this.def = 'All Domains'; this.$domain = null; }, $create: function(){ this._super(); var self = this, $form_grp = $('
', {'class': 'form-group'}) .append($('
'; item.chkbox = ''; }); } }), "paging": { "enabled": true, "limit": 5, "size": pagination_size }, "state": { "enabled": true }, "filtering": { "enabled": true, "delay": 100, "position": "left", "connectors": false, "placeholder": lang.filter_table }, "sorting": { "enabled": true }, "on": { "destroy.ft.table": function(e, ft){ $('.refresh_table').attr('disabled', 'true'); }, "ready.ft.table": function(e, ft){ table_mailbox_ready(ft, 'aliasdomain_table'); }, "after.ft.filtering": function(e, ft){ table_mailbox_ready(ft, 'aliasdomain_table'); } } }); } function draw_sync_job_table() { ft_syncjob_table = FooTable.init('#sync_job_table', { "columns": [ {"name":"chkbox","title":"","style":{"maxWidth":"60px","width":"60px","text-align":"center"},"filterable": false,"sortable": false,"type":"html"}, {"sorted": true,"name":"id","title":"ID","style":{"maxWidth":"60px","width":"60px","text-align":"center"}}, {"name":"user2","title":lang.owner}, {"name":"server_w_port","title":"Server","breakpoints":"xs","style":{"word-break":"break-all"}}, {"name":"exclude","title":lang.excludes,"breakpoints":"all"}, {"name":"mins_interval","title":lang.mins_interval,"breakpoints":"all"}, {"name":"last_run","title":lang.last_run,"breakpoints":"sm"}, {"name":"log","title":"Log"}, {"name":"active","filterable": false,"style":{"maxWidth":"70px","width":"70px"},"title":lang.active}, {"name":"is_running","filterable": false,"style":{"maxWidth":"120px","width":"100px"},"title":lang.status}, {"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/all/no_log', jsonp: false, error: function () { console.log('Cannot draw sync job table'); }, success: function (data) { $.each(data, function (i, item) { item.log = 'Open logs' item.user2 = escapeHtml(item.user2); if (!item.exclude > 0) { item.exclude = '-'; } else { item.exclude = '' + item.exclude + ''; } item.server_w_port = escapeHtml(item.user1) + '@' + item.host1 + ':' + item.port1; item.action = '
' + ' ' + lang.edit + '' + ' ' + lang.remove + '' + '
'; item.chkbox = ''; if (item.is_running == 1) { item.is_running = '' + lang.running + ''; } else { item.is_running = '' + lang.waiting + ''; } if (!item.last_run > 0) { item.last_run = lang.waiting; } }); } }), "paging": { "enabled": true, "limit": 5, "size": pagination_size }, "state": { "enabled": true }, "filtering": { "enabled": true, "delay": 100, "position": "left", "connectors": false, "placeholder": lang.filter_table }, "sorting": { "enabled": true }, "on": { "destroy.ft.table": function(e, ft){ $('.refresh_table').attr('disabled', 'true'); }, "ready.ft.table": function(e, ft){ table_mailbox_ready(ft, 'sync_job_table'); }, "after.ft.filtering": function(e, ft){ table_mailbox_ready(ft, 'sync_job_table'); } } }); } function draw_filter_table() { ft_filter_table = FooTable.init('#filter_table', { "columns": [ {"name":"chkbox","title":"","style":{"maxWidth":"60px","width":"60px","text-align":"center"},"filterable": false,"sortable": false,"type":"html"}, {"name":"id","title":"ID","style":{"maxWidth":"60px","width":"60px","text-align":"center"}}, {"name":"active","style":{"maxWidth":"80px","width":"80px"},"title":lang.active}, {"name":"filter_type","style":{"maxWidth":"80px","width":"80px"},"title":"Type"}, {"sorted": true,"name":"username","title":lang.owner,"style":{"maxWidth":"550px","width":"350px"}}, {"name":"script_desc","title":lang.description,"breakpoints":"xs"}, {"name":"script_data","title":"Script","breakpoints":"all"}, {"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/filters/all', jsonp: false, error: function () { console.log('Cannot draw filter table'); }, success: function (data) { $.each(data, function (i, item) { if (item.active_int == 1) { item.active = '' + lang.active + ''; } else { item.active = '' + lang.inactive + ''; } item.script_data = '
' + escapeHtml(item.script_data) + '
' item.filter_type = '
' + item.filter_type.charAt(0).toUpperCase() + item.filter_type.slice(1).toLowerCase() + '
' item.action = '
' + ' ' + lang.edit + '' + ' ' + lang.remove + '' + '
'; item.chkbox = '' }); } }), "paging": { "enabled": true, "limit": 5, "size": pagination_size }, "state": { "enabled": true }, "filtering": { "enabled": true, "delay": 100, "position": "left", "connectors": false, "placeholder": lang.filter_table }, "sorting": { "enabled": true }, "on": { "destroy.ft.table": function(e, ft){ $('.refresh_table').attr('disabled', 'true'); }, "ready.ft.table": function(e, ft){ table_mailbox_ready(ft, 'filter_table'); }, "after.ft.filtering": function(e, ft){ table_mailbox_ready(ft, 'filter_table'); } } }); }; draw_domain_table(); draw_mailbox_table(); draw_resource_table(); draw_alias_table(); draw_aliasdomain_table(); draw_sync_job_table(); draw_filter_table(); draw_bcc_table(); draw_recipient_map_table(); draw_tls_policy_table(); draw_transport_maps_table(); });