[BS5] jquery datatable - add classes to action column
This commit is contained in:
		| @@ -466,7 +466,7 @@ jQuery(function($){ | ||||
|   function process_table_data(data, table) { | ||||
|     if (table == 'relayhoststable') { | ||||
|       $.each(data, function (i, item) { | ||||
|         item.action = '<div class="btn-group dataTables-actions">' + | ||||
|         item.action = '<div class="btn-group">' + | ||||
|           '<a href="#" data-bs-toggle="modal" data-bs-target="#testTransportModal" data-transport-id="' + encodeURI(item.id) + '" data-transport-type="sender-dependent" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-caret-right-fill"></i> Test</a>' + | ||||
|           '<a href="/edit/relayhost/' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|           '<a href="#" data-action="delete_selected" data-id="single-rlyhost" data-api-url="delete/relayhost" data-item="' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-third btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
| @@ -484,7 +484,7 @@ jQuery(function($){ | ||||
|         if (item.username) { | ||||
|           item.username = '<i style="color:#' + intToRGB(hashCode(item.nexthop)) + ';" class="bi bi-square-fill"></i> ' + item.username; | ||||
|         } | ||||
|         item.action = '<div class="btn-group dataTables-actions">' + | ||||
|         item.action = '<div class="btn-group">' + | ||||
|           '<a href="#" data-bs-toggle="modal" data-bs-target="#testTransportModal" data-transport-id="' + encodeURI(item.id) + '" data-transport-type="transport-map" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-caret-right-fill"></i> Test</a>' + | ||||
|           '<a href="/edit/transport/' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|           '<a href="#" data-action="delete_selected" data-id="single-transport" data-api-url="delete/transport" data-item="' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-third btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
| @@ -498,20 +498,20 @@ jQuery(function($){ | ||||
|           return escapeHtml(i); | ||||
|         }); | ||||
|         item.recipients = rcpts.join('<hr style="margin:1px!important">'); | ||||
|         item.action = '<div class="btn-group dataTables-actions">' + | ||||
|         item.action = '<div class="btn-group">' + | ||||
|           '<a href="#" data-bs-toggle="modal" data-bs-target="#showQueuedMsg" data-queue-id="' + encodeURI(item.queue_id) + '" class="btn btn-xs btn-secondary">' + lang.queue_show_message + '</a>' + | ||||
|           '</div>'; | ||||
|       }); | ||||
|     } else if (table == 'forwardinghoststable') { | ||||
|       $.each(data, function (i, item) { | ||||
|         item.action = '<div class="btn-group dataTables-actions">' + | ||||
|         item.action = '<div class="btn-group">' + | ||||
|           '<a href="#" data-action="delete_selected" data-id="single-fwdhost" data-api-url="delete/fwdhost" data-item="' + encodeURI(item.host) + '" class="btn btn-xs btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|           '</div>'; | ||||
|         item.chkbox = '<input type="checkbox" data-id="fwdhosts" name="multi_select" value="' + item.host + '" />'; | ||||
|       }); | ||||
|     } else if (table == 'oauth2clientstable') { | ||||
|       $.each(data, function (i, item) { | ||||
|         item.action = '<div class="btn-group dataTables-actions">' + | ||||
|         item.action = '<div class="btn-group">' + | ||||
|           '<a href="/edit.php?oauth2client=' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|           '<a href="#" data-action="delete_selected" data-id="single-oauth2-client" data-api-url="delete/oauth2-client" data-item="' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|           '</div>'; | ||||
| @@ -524,7 +524,7 @@ jQuery(function($){ | ||||
|         item.selected_domains = escapeHtml(item.selected_domains); | ||||
|         item.selected_domains = item.selected_domains.toString().replace(/,/g, "<br>"); | ||||
|         item.chkbox = '<input type="checkbox" data-id="domain_admins" name="multi_select" value="' + item.username + '" />'; | ||||
|         item.action = '<div class="btn-group dataTables-actions">' + | ||||
|         item.action = '<div class="btn-group">' + | ||||
|           '<a href="/edit/domainadmin/' + encodeURI(item.username) + '" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|           '<a href="#" data-action="delete_selected" data-id="single-domain-admin" data-api-url="delete/domain-admin" data-item="' + encodeURI(item.username) + '" class="btn btn-xs btn-xs-third btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|           '<a href="/index.php?duallogin=' + encodeURIComponent(item.username) + '" class="btn btn-xs btn-xs-third btn-success"><i class="bi bi-person-fill"></i> Login</a>' + | ||||
| @@ -538,7 +538,7 @@ jQuery(function($){ | ||||
|           item.usr = item.username; | ||||
|         } | ||||
|         item.chkbox = '<input type="checkbox" data-id="admins" name="multi_select" value="' + item.username + '" />'; | ||||
|         item.action = '<div class="btn-group dataTables-actions">' + | ||||
|         item.action = '<div class="btn-group">' + | ||||
|           '<a href="/edit/admin/' + encodeURI(item.username) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|           '<a href="#" data-action="delete_selected" data-id="single-admin" data-api-url="delete/admin" data-item="' + encodeURI(item.username) + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|           '</div>'; | ||||
|   | ||||
| @@ -256,7 +256,7 @@ jQuery(function($){ | ||||
|             item.def_quota_for_mbox = humanFileSize(item.def_quota_for_mbox); | ||||
|             item.max_quota_for_mbox = humanFileSize(item.max_quota_for_mbox); | ||||
|             item.chkbox = '<input type="checkbox" data-id="domain" name="multi_select" value="' + encodeURIComponent(item.domain_name) + '" />'; | ||||
|             item.action = '<div class="btn-group footable-actions">'; | ||||
|             item.action = '<div class="btn-group">'; | ||||
|             if (role == "admin") { | ||||
|               item.action += '<a href="/edit/domain/' + encodeURIComponent(item.domain_name) + '" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|                 '<a href="#" data-action="delete_selected" data-id="single-domain" data-api-url="delete/domain" data-item="' + encodeURIComponent(item.domain_name) + '" class="btn btn-xs btn-xs-third btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
| @@ -414,7 +414,7 @@ jQuery(function($){ | ||||
|               var btnSize = 'btn-xs-third'; | ||||
|               if (ALLOW_ADMIN_EMAIL_LOGIN) btnSize = 'btn-xs-quart'; | ||||
|  | ||||
|             item.action = '<div class="btn-group footable-actions">' + | ||||
|             item.action = '<div class="btn-group">' + | ||||
|               '<a href="/edit/mailbox/' + encodeURIComponent(item.username) + '" class="btn btn-xs ' + btnSize + ' btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|               '<a href="#" data-action="delete_selected" data-id="single-mailbox" data-api-url="delete/mailbox" data-item="' + encodeURIComponent(item.username) + '" class="btn btn-xs ' + btnSize + ' btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|               '<a href="/index.php?duallogin=' + encodeURIComponent(item.username) + '" class="login_as btn btn-xs ' + btnSize + ' btn-success"><i class="bi bi-person-fill"></i> Login</a>'; | ||||
| @@ -551,7 +551,7 @@ jQuery(function($){ | ||||
|             } else { | ||||
|               item.multiple_bookings = '<span id="active-script" class="badge fs-5 bg-danger">' + lang.booking_custom_short + ' (' + item.multiple_bookings + ')</span>'; | ||||
|             } | ||||
|             item.action = '<div class="btn-group footable-actions">' + | ||||
|             item.action = '<div class="btn-group">' + | ||||
|               '<a href="/edit/resource/' + encodeURIComponent(item.name) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|               '<a href="#" data-action="delete_selected" data-id="single-resource" data-api-url="delete/resource" data-item="' + item.name + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|               '</div>'; | ||||
| @@ -623,7 +623,7 @@ jQuery(function($){ | ||||
|         url: "/api/v1/get/bcc/all", | ||||
|         dataSrc: function(json){ | ||||
|           $.each(json, function (i, item) { | ||||
|             item.action = '<div class="btn-group footable-actions">' + | ||||
|             item.action = '<div class="btn-group">' + | ||||
|               '<a href="/edit/bcc/' + item.id + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|               '<a href="#" data-action="delete_selected" data-id="single-bcc" data-api-url="delete/bcc" data-item="' + item.id + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|               '</div>'; | ||||
| @@ -705,7 +705,7 @@ jQuery(function($){ | ||||
|           $.each(json, function (i, item) { | ||||
|             item.recipient_map_old = escapeHtml(item.recipient_map_old); | ||||
|             item.recipient_map_new = escapeHtml(item.recipient_map_new); | ||||
|             item.action = '<div class="btn-group footable-actions">' + | ||||
|             item.action = '<div class="btn-group">' + | ||||
|               '<a href="/edit/recipient_map/' + item.id + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|               '<a href="#" data-action="delete_selected" data-id="single-recipient_map" data-api-url="delete/recipient_map" data-item="' + item.id + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|               '</div>'; | ||||
| @@ -777,7 +777,7 @@ jQuery(function($){ | ||||
|             } else { | ||||
|               item.parameters = '<code>' + escapeHtml(item.parameters) + '</code>'; | ||||
|             } | ||||
|             item.action = '<div class="btn-group footable-actions">' + | ||||
|             item.action = '<div class="btn-group">' + | ||||
|               '<a href="/edit/tls_policy_map/' + item.id + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|               '<a href="#" data-action="delete_selected" data-id="single-tls-policy-map" data-api-url="delete/tls-policy-map" data-item="' + item.id + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|               '</div>'; | ||||
| @@ -848,7 +848,7 @@ jQuery(function($){ | ||||
|         url: "/api/v1/get/alias/all", | ||||
|         dataSrc: function(json){ | ||||
|           $.each(json, function (i, item) { | ||||
|             item.action = '<div class="btn-group footable-actions">' + | ||||
|             item.action = '<div class="btn-group">' + | ||||
|               '<a href="/edit/alias/' + encodeURIComponent(item.id) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|               '<a href="#" data-action="delete_selected" data-id="single-alias" data-api-url="delete/alias" data-item="' + encodeURIComponent(item.id) + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|               '</div>'; | ||||
| @@ -962,7 +962,7 @@ jQuery(function($){ | ||||
|         url: "/api/v1/get/alias-domain/all", | ||||
|         dataSrc: function(json){ | ||||
|           $.each(json, function (i, item) { | ||||
|             item.action = '<div class="btn-group footable-actions">' + | ||||
|             item.action = '<div class="btn-group">' + | ||||
|               '<a href="/edit/aliasdomain/' + encodeURIComponent(item.alias_domain) + '" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|               '<a href="#" data-action="delete_selected" data-id="single-alias-domain" data-api-url="delete/alias-domain" data-item="' + encodeURIComponent(item.alias_domain) + '" class="btn btn-xs btn-xs-third btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|               '<a href="#dnsInfoModal" class="btn btn-xs btn-xs-third btn-info" data-bs-toggle="modal" data-domain="' + encodeURIComponent(item.alias_domain) + '"><i class="bi bi-globe2"></i> DNS</a></div>' + | ||||
| @@ -1047,7 +1047,7 @@ jQuery(function($){ | ||||
|               item.exclude  = '<code>' + item.exclude + '</code>'; | ||||
|             } | ||||
|             item.server_w_port = escapeHtml(item.user1) + '@' + item.host1 + ':' + item.port1; | ||||
|             item.action = '<div class="btn-group footable-actions">' + | ||||
|             item.action = '<div class="btn-group">' + | ||||
|               '<a href="/edit/syncjob/' + item.id + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|               '<a href="#" data-action="delete_selected" data-id="single-syncjob" data-api-url="delete/syncjob" data-item="' + item.id + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|               '</div>'; | ||||
| @@ -1161,7 +1161,7 @@ jQuery(function($){ | ||||
|             } | ||||
|             item.script_data = '<pre style="margin:0px">' + escapeHtml(item.script_data) + '</pre>' | ||||
|             item.filter_type = '<div class="badge fs-5 bg-secondary">' + item.filter_type.charAt(0).toUpperCase() + item.filter_type.slice(1).toLowerCase() + '</div>' | ||||
|             item.action = '<div class="btn-group footable-actions">' + | ||||
|             item.action = '<div class="btn-group">' + | ||||
|               '<a href="/edit/filter/' + item.id + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|               '<a href="#" data-action="delete_selected" data-id="single-filter" data-api-url="delete/filter" data-item="' + encodeURIComponent(item.id) + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|               '</div>'; | ||||
|   | ||||
| @@ -48,7 +48,7 @@ jQuery(function($){ | ||||
|               item.notified = '✖'; | ||||
|             } | ||||
|             if (acl_data.login_as === 1) { | ||||
|             item.action = '<div class="btn-group footable-actions">' + | ||||
|             item.action = '<div class="btn-group">' + | ||||
|               '<a href="#" data-item="' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-half btn-info show_qid_info"><i class="bi bi-box-arrow-up-right"></i> ' + lang.show_item + '</a>' + | ||||
|               '<a href="#" data-action="delete_selected" data-id="del-single-qitem" data-api-url="delete/qitem" data-item="' + encodeURI(item.id) + '" class="btn btn-xs  btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|               '</div>'; | ||||
|   | ||||
| @@ -139,7 +139,7 @@ jQuery(function($){ | ||||
|           console.log(data); | ||||
|           $.each(data, function (i, item) { | ||||
|             if (acl_data.spam_alias === 1) { | ||||
|               item.action = '<div class="btn-group footable-actions">' + | ||||
|               item.action = '<div class="btn-group">' + | ||||
|                 '<a href="#" data-action="delete_selected" data-id="single-tla" data-api-url="delete/time_limited_alias" data-item="' + encodeURIComponent(item.address) + '" class="btn btn-xs btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|                 '</div>'; | ||||
|               item.chkbox = '<input type="checkbox" data-id="tla" name="multi_select" value="' + encodeURIComponent(item.address) + '" />'; | ||||
| @@ -210,7 +210,7 @@ jQuery(function($){ | ||||
|             } | ||||
|             item.server_w_port = escapeHtml(item.user1 + '@' + item.host1 + ':' + item.port1); | ||||
|             if (acl_data.syncjobs === 1) { | ||||
|               item.action = '<div class="btn-group footable-actions">' + | ||||
|               item.action = '<div class="btn-group">' + | ||||
|                 '<a href="/edit/syncjob/' + item.id + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|                 '<a href="#" data-action="delete_selected" data-id="single-syncjob" data-api-url="delete/syncjob" data-item="' + item.id + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|                 '</div>'; | ||||
| @@ -337,7 +337,7 @@ jQuery(function($){ | ||||
|             if (item.sieve_access == 1) { item.protocols.push("<code>Sieve</code>"); } | ||||
|             item.protocols = item.protocols.join(" ") | ||||
|             if (acl_data.app_passwds === 1) { | ||||
|               item.action = '<div class="btn-group footable-actions">' + | ||||
|               item.action = '<div class="btn-group">' + | ||||
|                 '<a href="/edit/app-passwd/' + item.id + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + | ||||
|                 '<a href="#" data-action="delete_selected" data-id="single-apppasswd" data-api-url="delete/app-passwd" data-item="' + item.id + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + | ||||
|                 '</div>'; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user