diff --git a/lib/Froxlor/UI/Callbacks/Customer.php b/lib/Froxlor/UI/Callbacks/Customer.php index 315abf97..b1c1016f 100644 --- a/lib/Froxlor/UI/Callbacks/Customer.php +++ b/lib/Froxlor/UI/Callbacks/Customer.php @@ -34,4 +34,9 @@ class Customer return $attributes['fields']['loginfail_count'] >= Settings::Get('login.maxloginattempts') && $attributes['fields']['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime')); } + + public static function hasNote(array $attributes) + { + return !empty($attributes['fields']['custom_notes']); + } } diff --git a/lib/Froxlor/UI/Callbacks/Text.php b/lib/Froxlor/UI/Callbacks/Text.php index d1a30030..0656cc1c 100644 --- a/lib/Froxlor/UI/Callbacks/Text.php +++ b/lib/Froxlor/UI/Callbacks/Text.php @@ -75,6 +75,17 @@ class Text return wordwrap($attributes['data'], 100, '
', true); } + public static function customerNoteDetailModal(array $attributes): array + { + $note = $attributes['fields']['custom_notes'] ?? ''; + return [ + 'entry' => $attributes['fields']['id'], + 'id' => 'cnModal' . $attributes['fields']['id'], + 'title' => lng('usersettings.custom_notes.title') . ': ' . ($attributes['fields']['loginname'] ?? $attributes['fields']['adminname']), + 'body' => nl2br($note) + ]; + } + public static function apikeyDetailModal(array $attributes): array { $linker = UI::getLinker(); diff --git a/lib/tablelisting/admin/tablelisting.admins.php b/lib/tablelisting/admin/tablelisting.admins.php index 05d4aeb7..36fdf813 100644 --- a/lib/tablelisting/admin/tablelisting.admins.php +++ b/lib/tablelisting/admin/tablelisting.admins.php @@ -24,6 +24,7 @@ */ use Froxlor\UI\Callbacks\Admin; +use Froxlor\UI\Callbacks\Customer; use Froxlor\UI\Callbacks\Impersonate; use Froxlor\UI\Callbacks\ProgressBar; use Froxlor\UI\Callbacks\Style; @@ -112,6 +113,12 @@ return [ 'deactivated', ]), 'actions' => [ + 'show' => [ + 'icon' => 'fa fa-eye', + 'title' => lng('usersettings.custom_notes.title'), + 'modal' => [Text::class, 'customerNoteDetailModal'], + 'visible' => [Customer::class, 'hasNote'] + ], 'edit' => [ 'icon' => 'fa fa-edit', 'title' => lng('panel.edit'), diff --git a/lib/tablelisting/admin/tablelisting.customers.php b/lib/tablelisting/admin/tablelisting.customers.php index f60c5a19..17bb385c 100644 --- a/lib/tablelisting/admin/tablelisting.customers.php +++ b/lib/tablelisting/admin/tablelisting.customers.php @@ -153,6 +153,12 @@ return [ 'c.traffic', ]), 'actions' => [ + 'show' => [ + 'icon' => 'fa fa-eye', + 'title' => lng('usersettings.custom_notes.title'), + 'modal' => [Text::class, 'customerNoteDetailModal'], + 'visible' => [Customer::class, 'hasNote'] + ], 'unlock' => [ 'icon' => 'fa fa-unlock', 'title' => lng('panel.unlock'), diff --git a/lng/de.lng.php b/lng/de.lng.php index 8762bf38..8cab6150 100644 --- a/lng/de.lng.php +++ b/lng/de.lng.php @@ -483,6 +483,8 @@ return [ 'no_api_keys' => 'Keine API Keys gefunden', 'key_add' => 'API Key hinzufügen', 'apikey_removed' => 'Der API Key mit der ID #%s wurde erfolgreich gelöscht.', + 'apikey_added' => 'Der neue API Key wurde erfolgreich angelegt.', + 'clicktoview' => 'API Key Details anzeigen', 'allowed_from' => 'Erlaube Zugriff von', 'allowed_from_help' => 'Komma getrennte Liste von IPs oder Netzen.
Standard ist leer (von überall erlaubt).', 'valid_until' => 'Gültig bis',