re-add contextual classes to domain-entry depending on deactivated/termination_date
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -61,7 +61,7 @@ class Domain
|
||||
return UI::getLng('domains.aliasdomain') . ' ' . $attributes['fields']['aliasdomain'];
|
||||
}
|
||||
|
||||
public static function domainExternalLink(array $attributes)
|
||||
public static function domainExternalLinkInfo(array $attributes)
|
||||
{
|
||||
$result = '<a href="http://' . $attributes['data'] . '" target="_blank">' . $attributes['data'] . '</a>';
|
||||
// check for statistics if parentdomainid==0 to show stats-link for customers
|
||||
@@ -72,6 +72,12 @@ class Domain
|
||||
}
|
||||
$result .= ' <a href="http://' . $attributes['data'] . '/' . $statsapp . '" rel="external" title="' . UI::getLng('domains.statstics') . '"><i class="fa-solid fa-chart-line text-secondary"></i></a>';
|
||||
}
|
||||
if ($attributes['fields']['registration_date'] != '') {
|
||||
$result .= '<br><small>' . UI::getLng('domains.registration_date') . ': ' . $attributes['fields']['registration_date'] . '</small>';
|
||||
}
|
||||
if ($attributes['fields']['termination_date'] != '') {
|
||||
$result .= '<br><small>' . UI::getLng('domains.termination_date_overview') . ': ' . $attributes['fields']['termination_date'] . '</small>';
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,21 @@ class Style
|
||||
return $isValid ? '' : 'bg-danger';
|
||||
}
|
||||
|
||||
public static function resultDomainTerminatedOrDeactivated(array $attributes): string
|
||||
{
|
||||
$termination_date = str_replace("0000-00-00", "", $attributes['fields']['termination_date'] ?? '');
|
||||
$termination_css = '';
|
||||
if (!empty($termination_date)) {
|
||||
$cdate = strtotime($termination_date . " 23:59:59");
|
||||
$today = time();
|
||||
$termination_css = 'bg-warning';
|
||||
if ($cdate < $today) {
|
||||
$termination_css = 'bg-danger';
|
||||
}
|
||||
}
|
||||
return $attributes['fields']['deactivated'] ? 'bg-info' : $termination_css;
|
||||
}
|
||||
|
||||
public static function diskspaceWarning(array $attributes): string
|
||||
{
|
||||
return self::getWarningStyle('diskspace', $attributes['fields'], (int)Settings::Get('system.report_webmax'));
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
use Froxlor\UI\Callbacks\Style;
|
||||
use Froxlor\UI\Callbacks\Domain;
|
||||
use Froxlor\UI\Callbacks\Impersonate;
|
||||
use Froxlor\UI\Callbacks\Text;
|
||||
@@ -117,6 +118,9 @@ return [
|
||||
],
|
||||
'visible' => [Domain::class, 'adminCanDelete']
|
||||
]
|
||||
],
|
||||
'format_callback' => [
|
||||
[Style::class, 'resultDomainTerminatedOrDeactivated']
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
use Froxlor\UI\Callbacks\Style;
|
||||
use Froxlor\UI\Callbacks\Domain;
|
||||
use Froxlor\UI\Listing;
|
||||
|
||||
@@ -119,6 +121,9 @@ return [
|
||||
],
|
||||
'visible' => [Domain::class, 'canDelete']
|
||||
]
|
||||
],
|
||||
'format_callback' => [
|
||||
[Style::class, 'resultDomainTerminatedOrDeactivated']
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user