update listing, handle fields with or without callbacks or callbacks only

This commit is contained in:
envoyr
2022-02-28 13:16:44 +01:00
parent 8ff6e71729
commit 8f6f85ea8e
25 changed files with 87 additions and 79 deletions

View File

@@ -28,7 +28,7 @@ class Domain
// path or redirect // path or redirect
if (preg_match('/^https?\:\/\//', $attributes['fields']['documentroot'])) { if (preg_match('/^https?\:\/\//', $attributes['fields']['documentroot'])) {
return [ return [
'type' => 'link', 'macro' => 'link',
'data' => [ 'data' => [
'text' => $attributes['fields']['documentroot'], 'text' => $attributes['fields']['documentroot'],
'href' => $attributes['fields']['documentroot'], 'href' => $attributes['fields']['documentroot'],

View File

@@ -24,7 +24,7 @@ class Email
public static function account(array $attributes) public static function account(array $attributes)
{ {
return [ return [
'type' => 'booleanWithInfo', 'macro' => 'booleanWithInfo',
'data' => [ 'data' => [
'checked' => $attributes['data'] != 0, 'checked' => $attributes['data'] != 0,
'info' => $attributes['data'] != 0 ? PhpHelper::sizeReadable($attributes['fields']['mboxsize'], 'GiB', 'bi', '%01.' . (int)Settings::Get('panel.decimal_places') . 'f %s') : '' 'info' => $attributes['data'] != 0 ? PhpHelper::sizeReadable($attributes['fields']['mboxsize'], 'GiB', 'bi', '%01.' . (int)Settings::Get('panel.decimal_places') . 'f %s') : ''

View File

@@ -26,7 +26,7 @@ class Impersonate
if (UI::getCurrentUser()['adminid'] != $attributes['fields']['adminid']) { if (UI::getCurrentUser()['adminid'] != $attributes['fields']['adminid']) {
$linker = UI::getLinker(); $linker = UI::getLinker();
return [ return [
'type' => 'link', 'macro' => 'link',
'data' => [ 'data' => [
'text' => $attributes['data'], 'text' => $attributes['data'],
'href' => $linker->getLink([ 'href' => $linker->getLink([
@@ -45,7 +45,7 @@ class Impersonate
{ {
$linker = UI::getLinker(); $linker = UI::getLinker();
return [ return [
'type' => 'link', 'macro' => 'link',
'data' => [ 'data' => [
'text' => $attributes['data'], 'text' => $attributes['data'],
'href' => $linker->getLink([ 'href' => $linker->getLink([

View File

@@ -21,7 +21,7 @@ use Froxlor\UI\Panel\UI;
*/ */
class PHPConf class PHPConf
{ {
public static function domainList(array $attributes) public static function domainList(array $attributes): string
{ {
$idna = new IdnaWrapper; $idna = new IdnaWrapper;
$domains = ""; $domains = "";
@@ -56,7 +56,7 @@ class PHPConf
{ {
$linker = UI::getLinker(); $linker = UI::getLinker();
return [ return [
'type' => 'link', 'macro' => 'link',
'data' => [ 'data' => [
'text' => $attributes['data'], 'text' => $attributes['data'],
'href' => $linker->getLink([ 'href' => $linker->getLink([

View File

@@ -75,7 +75,7 @@ class ProgressBar
} }
return [ return [
'type' => 'progressbar', 'macro' => 'progressbar',
'data' => [ 'data' => [
'percent' => $percent, 'percent' => $percent,
'style' => $style, 'style' => $style,

View File

@@ -22,7 +22,7 @@ class SSLCertificate
public static function domainWithSan(array $attributes): array public static function domainWithSan(array $attributes): array
{ {
return [ return [
'type' => 'domainWithSan', 'macro' => 'domainWithSan',
'data' => [ 'data' => [
'domain' => $attributes['data'], 'domain' => $attributes['data'],
'san' => implode(', ', $attributes['fields']['san'] ?? []), 'san' => implode(', ', $attributes['fields']['san'] ?? []),

View File

@@ -27,7 +27,7 @@ class Text
public static function boolean(array $attributes): array public static function boolean(array $attributes): array
{ {
return [ return [
'type' => 'boolean', 'macro' => 'boolean',
'data' => (bool)$attributes['data'] 'data' => (bool)$attributes['data']
]; ];
} }

View File

@@ -65,31 +65,37 @@ class Listing
return $heading; return $heading;
} }
/**
* @throws Exception
*/
private static function generateTableRows(array $list, array $tabellisting): array private static function generateTableRows(array $list, array $tabellisting): array
{ {
$rows = []; $rows = [];
// Create new row from item // Create new row from item
foreach ($list as $row => $item) { foreach ($list as $row => $fields) {
// Generate columns from item // Generate columns from item
foreach ($tabellisting['visible_columns'] as $col => $visible_column) { foreach ($tabellisting['visible_columns'] as $col => $visible_column) {
// Continue if column is not visible
if (isset($tabellisting['columns'][$visible_column]['visible']) && !$tabellisting['columns'][$visible_column]['visible']) { if (isset($tabellisting['columns'][$visible_column]['visible']) && !$tabellisting['columns'][$visible_column]['visible']) {
continue; continue;
} }
$format_callback = $tabellisting['columns'][$visible_column]['format_callback'] ?? null; // Get data from filed if it is defined
$column = $tabellisting['columns'][$visible_column]['field'] ?? null; $field = $tabellisting['columns'][$visible_column]['field'] ?? null;
if (empty($column)) { $data = self::getMultiArrayFromString($fields, $field);
throw new Exception('Column in "visible columns" specified that is not defined in "fields"');
}
$data = self::getMultiArrayFromString($item, $column);
if ($format_callback) { // Call user function for given column if defined or return data from field, otherwise throw exception
$rows[$row]['td'][$col]['data'] = call_user_func($format_callback, ['data' => $data, 'fields' => $item]); $callback = $tabellisting['columns'][$visible_column]['callback'] ?? null;
} else { if ($callback) {
$rows[$row]['td'][$col]['data'] = call_user_func($callback, ['data' => $data, 'fields' => $fields]);
} elseif ($field) {
$rows[$row]['td'][$col]['data'] = $data; $rows[$row]['td'][$col]['data'] = $data;
} else {
throw new Exception('The visible column "'. $visible_column .'" has neither a "callback" nor a "field" set.');
} }
// Set class for table-row if defined
$rows[$row]['td'][$col]['class'] = $tabellisting['columns'][$visible_column]['class'] ?? null; $rows[$row]['td'][$col]['class'] = $tabellisting['columns'][$visible_column]['class'] ?? null;
} }
@@ -97,19 +103,19 @@ class Listing
if (isset($tabellisting['format_callback'])) { if (isset($tabellisting['format_callback'])) {
$class = []; $class = [];
foreach ($tabellisting['format_callback'] as $format_callback) { foreach ($tabellisting['format_callback'] as $format_callback) {
$class[] = call_user_func($format_callback, ['fields' => $item]); $class[] = call_user_func($format_callback, ['fields' => $fields]);
} }
$rows[$row]['class'] = implode(' ', $class); $rows[$row]['class'] = implode(' ', $class);
} }
// Set all actions for row // Set all actions for row
if (isset($tabellisting['actions'])) { if (isset($tabellisting['actions'])) {
$actions = self::setLinks($tabellisting['actions'], $item); $actions = self::setLinks($tabellisting['actions'], $fields);
$rows[$row]['td'][] = [ $rows[$row]['td'][] = [
'class' => 'text-end', 'class' => 'text-end',
'data' => [ 'data' => [
'type' => 'actions', 'macro' => 'actions',
'data' => $actions 'data' => $actions
] ]
]; ];
@@ -151,14 +157,14 @@ class Listing
public static function getVisibleColumnsForListing(string $listing, array $default_columns): array public static function getVisibleColumnsForListing(string $listing, array $default_columns): array
{ {
// Hier käme dann die Logik, die das aus der DB zieht ... // Here would come the logic that pulls this from the DB ...
// alternativ nimmt er die $default_columns, wenn kein Eintrag // alternatively, it takes the $default_columns if no entry is
// in der DB definiert ist // defined in the DB
return $default_columns; return $default_columns;
} }
public static function getMultiArrayFromString(array $arr, string $str) public static function getMultiArrayFromString(array $arr, ?string $str)
{ {
foreach (explode('.', $str) as $key) { foreach (explode('.', $str) as $key) {
if (!array_key_exists($key, $arr)) { if (!array_key_exists($key, $arr)) {

View File

@@ -48,18 +48,18 @@ return [
'diskspace' => [ 'diskspace' => [
'label' => $lng['customer']['diskspace'], 'label' => $lng['customer']['diskspace'],
'field' => 'diskspace', 'field' => 'diskspace',
'format_callback' => [ProgressBar::class, 'diskspace'], 'callback' => [ProgressBar::class, 'diskspace'],
], ],
'traffic' => [ 'traffic' => [
'label' => $lng['customer']['traffic'], 'label' => $lng['customer']['traffic'],
'field' => 'traffic', 'field' => 'traffic',
'format_callback' => [ProgressBar::class, 'traffic'], 'callback' => [ProgressBar::class, 'traffic'],
], ],
'deactivated' => [ 'deactivated' => [
'label' => $lng['admin']['deactivated'], 'label' => $lng['admin']['deactivated'],
'field' => 'deactivated', 'field' => 'deactivated',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'], 'callback' => [Text::class, 'boolean'],
], ],
], ],
'visible_columns' => Listing::getVisibleColumnsForListing('admin_list', [ 'visible_columns' => Listing::getVisibleColumnsForListing('admin_list', [
@@ -93,7 +93,7 @@ return [
], ],
], ],
], ],
'format_callback' => [ 'callback' => [
[Style::class, 'deactivated'], [Style::class, 'deactivated'],
[Style::class, 'diskspaceWarning'], [Style::class, 'diskspaceWarning'],
[Style::class, 'trafficWarning'] [Style::class, 'trafficWarning']

View File

@@ -26,12 +26,12 @@ return [
'c.description' => [ 'c.description' => [
'label' => $lng['cron']['description'], 'label' => $lng['cron']['description'],
'field' => 'desc_lng_key', 'field' => 'desc_lng_key',
'format_callback' => [Text::class, 'crondesc'] 'callback' => [Text::class, 'crondesc']
], ],
'c.lastrun' => [ 'c.lastrun' => [
'label' => $lng['cron']['lastrun'], 'label' => $lng['cron']['lastrun'],
'field' => 'lastrun', 'field' => 'lastrun',
'format_callback' => [Text::class, 'timestamp'] 'callback' => [Text::class, 'timestamp']
], ],
'c.interval' => [ 'c.interval' => [
'label' => $lng['cron']['interval'], 'label' => $lng['cron']['interval'],
@@ -40,7 +40,7 @@ return [
'c.isactive' => [ 'c.isactive' => [
'label' => $lng['cron']['isactive'], 'label' => $lng['cron']['isactive'],
'field' => 'isactive', 'field' => 'isactive',
'format_callback' => [Text::class, 'boolean'] 'callback' => [Text::class, 'boolean']
], ],
], ],
'visible_columns' => Listing::getVisibleColumnsForListing('cron_list', [ 'visible_columns' => Listing::getVisibleColumnsForListing('cron_list', [

View File

@@ -30,17 +30,17 @@ return [
'c.name' => [ 'c.name' => [
'label' => $lng['customer']['name'], 'label' => $lng['customer']['name'],
'field' => 'name', 'field' => 'name',
'format_callback' => [Text::class, 'customerfullname'], 'callback' => [Text::class, 'customerfullname'],
], ],
'c.loginname' => [ 'c.loginname' => [
'label' => $lng['login']['username'], 'label' => $lng['login']['username'],
'field' => 'loginname', 'field' => 'loginname',
'format_callback' => [Impersonate::class, 'customer'], 'callback' => [Impersonate::class, 'customer'],
], ],
'a.loginname' => [ 'a.loginname' => [
'label' => $lng['admin']['admin'], 'label' => $lng['admin']['admin'],
'field' => 'admin.loginname', 'field' => 'admin.loginname',
'format_callback' => [Impersonate::class, 'admin'], 'callback' => [Impersonate::class, 'admin'],
], ],
'c.email' => [ 'c.email' => [
'label' => $lng['customer']['email'], 'label' => $lng['customer']['email'],
@@ -49,12 +49,12 @@ return [
'c.diskspace' => [ 'c.diskspace' => [
'label' => $lng['customer']['diskspace'], 'label' => $lng['customer']['diskspace'],
'field' => 'diskspace', 'field' => 'diskspace',
'format_callback' => [ProgressBar::class, 'diskspace'], 'callback' => [ProgressBar::class, 'diskspace'],
], ],
'c.traffic' => [ 'c.traffic' => [
'label' => $lng['customer']['traffic'], 'label' => $lng['customer']['traffic'],
'field' => 'traffic', 'field' => 'traffic',
'format_callback' => [ProgressBar::class, 'traffic'], 'callback' => [ProgressBar::class, 'traffic'],
], ],
], ],
'visible_columns' => Listing::getVisibleColumnsForListing('customer_list', [ 'visible_columns' => Listing::getVisibleColumnsForListing('customer_list', [

View File

@@ -34,12 +34,12 @@ return [
'c.name' => [ 'c.name' => [
'label' => $lng['customer']['name'], 'label' => $lng['customer']['name'],
'field' => 'customer.name', 'field' => 'customer.name',
'format_callback' => [Text::class, 'customerfullname'], 'callback' => [Text::class, 'customerfullname'],
], ],
'c.loginname' => [ 'c.loginname' => [
'label' => $lng['login']['username'], 'label' => $lng['login']['username'],
'field' => 'customer.loginname', 'field' => 'customer.loginname',
'format_callback' => [Impersonate::class, 'customer'], 'callback' => [Impersonate::class, 'customer'],
], ],
'd.aliasdomain' => [ 'd.aliasdomain' => [
'label' => $lng['domains']['aliasdomain'], 'label' => $lng['domains']['aliasdomain'],

View File

@@ -30,8 +30,7 @@ return [
], ],
'configs' => [ 'configs' => [
'label' => $lng['admin']['phpsettings']['activephpconfigs'], 'label' => $lng['admin']['phpsettings']['activephpconfigs'],
'field' => 'configs', 'callback' => [PHPConf::class, 'configsList']
'text' => [PHPConf::class, 'configsList']
], ],
'reload_cmd' => [ 'reload_cmd' => [
'label' => $lng['serversettings']['phpfpm_settings']['reload'], 'label' => $lng['serversettings']['phpfpm_settings']['reload'],

View File

@@ -38,40 +38,40 @@ return [
'label' => 'Listen', 'label' => 'Listen',
'field' => 'listen_statement', 'field' => 'listen_statement',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'], 'callback' => [Text::class, 'boolean'],
'visible' => Settings::Get('system.webserver') != 'nginx' 'visible' => Settings::Get('system.webserver') != 'nginx'
], ],
'namevirtualhost' => [ 'namevirtualhost' => [
'label' => 'NameVirtualHost', 'label' => 'NameVirtualHost',
'field' => 'namevirtualhost_statement', 'field' => 'namevirtualhost_statement',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'], 'callback' => [Text::class, 'boolean'],
'visible' => Settings::Get('system.webserver') == 'apache2' && (int)Settings::Get('system.apache24') == 0 'visible' => Settings::Get('system.webserver') == 'apache2' && (int)Settings::Get('system.apache24') == 0
], ],
'vhostcontainer' => [ 'vhostcontainer' => [
'label' => 'vHost-Container', 'label' => 'vHost-Container',
'field' => 'vhostcontainer', 'field' => 'vhostcontainer',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'] 'callback' => [Text::class, 'boolean']
], ],
'specialsettings' => [ 'specialsettings' => [
'label' => 'Specialsettings', 'label' => 'Specialsettings',
'field' => 'specialsettings', 'field' => 'specialsettings',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'] 'callback' => [Text::class, 'boolean']
], ],
'servername' => [ 'servername' => [
'label' => 'ServerName', 'label' => 'ServerName',
'field' => 'vhostcontainer_servername_statement', 'field' => 'vhostcontainer_servername_statement',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'], 'callback' => [Text::class, 'boolean'],
'visible' => Settings::Get('system.webserver') == 'apache2' 'visible' => Settings::Get('system.webserver') == 'apache2'
], ],
'ssl' => [ 'ssl' => [
'label' => 'SSL', 'label' => 'SSL',
'field' => 'ssl', 'field' => 'ssl',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'] 'callback' => [Text::class, 'boolean']
], ],
], ],
'visible_columns' => Listing::getVisibleColumnsForListing('ipsandports_list', [ 'visible_columns' => Listing::getVisibleColumnsForListing('ipsandports_list', [

View File

@@ -32,13 +32,13 @@ return [
'domains' => [ 'domains' => [
'label' => $lng['admin']['phpsettings']['activedomains'], 'label' => $lng['admin']['phpsettings']['activedomains'],
'field' => 'domains', 'field' => 'domains',
'text' => [PHPConf::class, 'domainList'] 'callback' => [PHPConf::class, 'domainList']
], ],
'fpmdesc' => [ 'fpmdesc' => [
'label' => $lng['admin']['phpsettings']['fpmdesc'], 'label' => $lng['admin']['phpsettings']['fpmdesc'],
'field' => 'fpmdesc', 'field' => 'fpmdesc',
'visible' => (bool) Settings::Get('phpfpm.enabled'), 'visible' => (bool) Settings::Get('phpfpm.enabled'),
'format_callback' => [PHPConf::class, 'fpmConfLink'] 'callback' => [PHPConf::class, 'fpmConfLink']
], ],
'c.binary' => [ 'c.binary' => [
'label' => $lng['admin']['phpsettings']['binary'], 'label' => $lng['admin']['phpsettings']['binary'],

View File

@@ -39,7 +39,7 @@ return [
'p.ts' => [ 'p.ts' => [
'label' => $lng['admin']['plans']['last_update'], 'label' => $lng['admin']['plans']['last_update'],
'field' => 'ts', 'field' => 'ts',
'format_callback' => [Text::class, 'timestamp'], 'callback' => [Text::class, 'timestamp'],
], ],
], ],
'visible_columns' => Listing::getVisibleColumnsForListing('plan_list', [ 'visible_columns' => Listing::getVisibleColumnsForListing('plan_list', [

View File

@@ -33,7 +33,7 @@ return [
'c.domain' => [ 'c.domain' => [
'label' => $lng['ssl_certificates']['certificate_for'], 'label' => $lng['ssl_certificates']['certificate_for'],
'field' => 'domain', 'field' => 'domain',
'format_callback' => [SSLCertificate::class, 'domainWithSan'], 'callback' => [SSLCertificate::class, 'domainWithSan'],
], ],
'c.issuer' => [ 'c.issuer' => [
'label' => $lng['ssl_certificates']['issuer'], 'label' => $lng['ssl_certificates']['issuer'],
@@ -51,7 +51,7 @@ return [
'label' => $lng['panel']['letsencrypt'], 'label' => $lng['panel']['letsencrypt'],
'field' => 'letsencrypt', 'field' => 'letsencrypt',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'], 'callback' => [Text::class, 'boolean'],
'visible' => Settings::Get('system.le_froxlor_enabled'), 'visible' => Settings::Get('system.le_froxlor_enabled'),
], ],
], ],

View File

@@ -31,7 +31,7 @@ return [
'd.documentroot' => [ 'd.documentroot' => [
'label' => $lng['panel']['path'], 'label' => $lng['panel']['path'],
'field' => 'documentroot', 'field' => 'documentroot',
'format_callback' => [Domain::class, 'domainTarget'], 'callback' => [Domain::class, 'domainTarget'],
] ]
], ],
'visible_columns' => Listing::getVisibleColumnsForListing('domain_list', [ 'visible_columns' => Listing::getVisibleColumnsForListing('domain_list', [

View File

@@ -38,12 +38,12 @@ return [
'm.popaccountid' => [ 'm.popaccountid' => [
'label' => $lng['emails']['account'], 'label' => $lng['emails']['account'],
'field' => 'popaccountid', 'field' => 'popaccountid',
'format_callback' => [Email::class, 'account'], 'callback' => [Email::class, 'account'],
], ],
'm.iscatchall' => [ 'm.iscatchall' => [
'label' => $lng['emails']['catchall'], 'label' => $lng['emails']['catchall'],
'field' => 'iscatchall', 'field' => 'iscatchall',
'format_callback' => [Text::class, 'boolean'], 'callback' => [Text::class, 'boolean'],
'visible' => Settings::Get('catchall.catchall_enabled') == '1' 'visible' => Settings::Get('catchall.catchall_enabled') == '1'
], ],
'm.quota' => [ 'm.quota' => [

View File

@@ -36,7 +36,7 @@ return [
'homedir' => [ 'homedir' => [
'label' => $lng['panel']['path'], 'label' => $lng['panel']['path'],
'field' => 'homedir', 'field' => 'homedir',
'format_callback' => [Ftp::class, 'pathRelative'] 'callback' => [Ftp::class, 'pathRelative']
], ],
'shell' => [ 'shell' => [
'label' => $lng['panel']['shell'], 'label' => $lng['panel']['shell'],

View File

@@ -28,12 +28,12 @@ return [
'path' => [ 'path' => [
'label' => $lng['panel']['path'], 'label' => $lng['panel']['path'],
'field' => 'path', 'field' => 'path',
'format_callback' => [Ftp::class, 'pathRelative'] 'callback' => [Ftp::class, 'pathRelative']
], ],
'option_indexes' => [ 'option_indexes' => [
'label' => $lng['extras']['view_directory'], 'label' => $lng['extras']['view_directory'],
'field' => 'option_indexes', 'field' => 'option_indexes',
'format_callback' => [Text::class, 'boolean'] 'callback' => [Text::class, 'boolean']
], ],
'error404path' => [ 'error404path' => [
'label' => $lng['extras']['error404path'], 'label' => $lng['extras']['error404path'],
@@ -50,7 +50,7 @@ return [
'options_cgi' => [ 'options_cgi' => [
'label' => $lng['extras']['execute_perl'], 'label' => $lng['extras']['execute_perl'],
'field' => 'options_cgi', 'field' => 'options_cgi',
'format_callback' => [Text::class, 'boolean'], 'callback' => [Text::class, 'boolean'],
'visible' => $cperlenabled 'visible' => $cperlenabled
] ]
], ],

View File

@@ -31,7 +31,7 @@ return [
'path' => [ 'path' => [
'label' => $lng['panel']['path'], 'label' => $lng['panel']['path'],
'field' => 'path', 'field' => 'path',
'format_callback' => [Ftp::class, 'pathRelative'] 'callback' => [Ftp::class, 'pathRelative']
] ]
], ],
'visible_columns' => Listing::getVisibleColumnsForListing('htpasswd_list', [ 'visible_columns' => Listing::getVisibleColumnsForListing('htpasswd_list', [

View File

@@ -36,12 +36,12 @@ return [
'size' => [ 'size' => [
'label' => $lng['mysql']['size'], 'label' => $lng['mysql']['size'],
'field' => 'size', 'field' => 'size',
'format_callback' => [Text::class, 'size'] 'callback' => [Text::class, 'size']
], ],
'dbserver' => [ 'dbserver' => [
'label' => $lng['mysql']['mysql_server'], 'label' => $lng['mysql']['mysql_server'],
'field' => 'dbserver', 'field' => 'dbserver',
'format_callback' => [Mysql::class, 'dbserver'], 'callback' => [Mysql::class, 'dbserver'],
'visible' => $count_mysqlservers > 1 'visible' => $count_mysqlservers > 1
] ]
], ],

View File

@@ -45,8 +45,10 @@
{% macro domainWithSan(data) %} {% macro domainWithSan(data) %}
{{ data.domain }} {{ data.domain }}
{% if data.san is not empty %} {% if data.san is not empty %}
<br/><span class="small">SAN: <br/>
{{ data.san }}</span> <span class="small">
SAN: {{ data.san }}
</span>
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}

View File

@@ -1,6 +1,6 @@
{% macro table(listing) %} {% macro table(listing) %}
{% import "Froxlor/table/callbacks.html.twig" as callbacks %} {% import "Froxlor/table/macros.html.twig" as macros %}
{% import "Froxlor/table/pagination.html.twig" as pagination %} {% import "Froxlor/table/pagination.html.twig" as pagination %}
<form action="{{ action|default("") }}" method="post" enctype="application/x-www-form-urlencoded" class="form"> <form action="{{ action|default("") }}" method="post" enctype="application/x-www-form-urlencoded" class="form">
@@ -34,20 +34,21 @@
{% for td in tr.td %} {% for td in tr.td %}
<td class="px-3{% if td.class is defined %} {{ td.class }}{% endif %}"> <td class="px-3{% if td.class is defined %} {{ td.class }}{% endif %}">
{% if td.data is iterable %} {% if td.data is iterable %}
{% if td.data.type == 'progressbar' %} {% if td.data.macro == 'progressbar' %}
{{ callbacks.progressbar(td.data.data) }} {{ macros.progressbar(td.data.data) }}
{% elseif td.data.type == 'boolean' %} {% elseif td.data.macro == 'boolean' %}
{{ callbacks.boolean(td.data.data) }} {{ macros.boolean(td.data.data) }}
{% elseif td.data.type == 'booleanWithInfo' %} {% elseif td.data.macro == 'booleanWithInfo' %}
{{ callbacks.booleanWithInfo(td.data.data) }} {{ macros.booleanWithInfo(td.data.data) }}
{% elseif td.data.type == 'link' %} {% elseif td.data.macro == 'link' %}
{{ callbacks.link(td.data.data) }} {{ macros.link(td.data.data) }}
{% elseif td.data.type == 'domainWithSan' %} {% elseif td.data.macro == 'domainWithSan' %}
{{ callbacks.domainWithSan(td.data.data) }} {{ macros.domainWithSan(td.data.data) }}
{% elseif td.data.type == 'actions' %} {% elseif td.data.macro == 'actions' %}
{{ callbacks.actions(td.data.data) }} {{ macros.actions(td.data.data) }}
{% else %} {% else %}
Callback '{{ td|json_encode }}' is not implemented! Table macro '{{ td.data.macro|json_encode }}' is not implemented!
Unable to handle this data: {{ td.data|json_encode }}
{% endif %} {% endif %}
{% else %} {% else %}
{{ td.data|raw }} {{ td.data|raw }}