Add active-status filter to the alias (forwards) list (#1038) (#1056)

Adds a **Forward status: All / Active / Inactive** selector above the
alias (forwards) list in the domain overview (`list-virtual.php`). 

see #1038, thanks @knofte
This commit is contained in:
Kent Riboe authored and GitHub committed 2026-07-07 20:44:43 +01:00
1 parent c51d00cefb
commit a400db12dc
38 files changed
+138

No files matched your search

+2
View File
@@ -90,6 +90,8 @@ $PALANG['pOverview_welcome'] = 'Преглед на ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domains'; # XXX
$PALANG['pOverview_alias_address'] = 'От';
$PALANG['active'] = 'Активен';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[and %s more...]'; # XXX
$PALANG['pOverview_mailbox_username'] = 'Е-мейл';
+2
View File
@@ -88,6 +88,8 @@ $PALANG['pOverview_welcome'] = 'Resum de ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domains'; # XXX
$PALANG['pOverview_alias_address'] = 'De';
$PALANG['active'] = 'Actiu';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[and %s more...]'; # XXX
$PALANG['pOverview_mailbox_username'] = 'E-mail'; # XXX
+2
View File
@@ -89,6 +89,8 @@ $PALANG['pOverview_welcome'] = '浏览 ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domains'; # XXX
$PALANG['pOverview_alias_address'] = '前往';
$PALANG['active'] = '活动';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[and %s more...]'; # XXX
$PALANG['pOverview_mailbox_username'] = '邮件地址';
+2
View File
@@ -97,6 +97,8 @@ $PALANG['pOverview_welcome'] = 'Přehled domény ';
$PALANG['pOverview_alias_domain_aliases'] = 'Přesměrované domény';
$PALANG['pOverview_alias_address'] = 'Od';
$PALANG['active'] = 'Aktivní';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[a %s dalších...]';
$PALANG['pOverview_mailbox_username'] = 'Email';
+2
View File
@@ -93,6 +93,8 @@ $PALANG['pOverview_welcome'] = 'Oversigt for ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias domæner';
$PALANG['pOverview_alias_address'] = 'Alias';
$PALANG['active'] = 'Aktiv';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[og %s til...]';
$PALANG['pOverview_mailbox_username'] = 'Emailadresse';
+2
View File
@@ -91,6 +91,8 @@ $PALANG['pOverview_welcome'] = 'Überblick über ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias-Domains';
$PALANG['pOverview_alias_address'] = 'Von';
$PALANG['active'] = 'Aktiv';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[und %s weitere...]';
$PALANG['pOverview_mailbox_username'] = 'Email';
+2
View File
@@ -97,6 +97,8 @@ $PALANG['pOverview_welcome'] = 'Overview for ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domains';
$PALANG['pOverview_alias_address'] = 'From';
$PALANG['active'] = 'Active';
$PALANG['inactive'] = 'Inactive';
$PALANG['alias_active_filter'] = 'Forward status:';
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[and %s more...]';
$PALANG['pOverview_mailbox_username'] = 'Email';
+2
View File
@@ -89,6 +89,8 @@ $PALANG['pOverview_welcome'] = 'Resumen de ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias de Dominios';
$PALANG['pOverview_alias_address'] = 'De';
$PALANG['active'] = 'Activo';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'SMTP';
$PALANG['and_x_more'] = '[y %s más...]';
$PALANG['pOverview_mailbox_username'] = 'E-mail';
+2
View File
@@ -89,6 +89,8 @@ $PALANG['pOverview_welcome'] = 'Ülevaade domeenist: ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domains'; # XXX
$PALANG['pOverview_alias_address'] = 'Kellelt';
$PALANG['active'] = 'Aktiivne';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[and %s more...]'; # XXX
$PALANG['pOverview_mailbox_username'] = 'E-posti aadress';
+2
View File
@@ -88,6 +88,8 @@ $PALANG['pOverview_welcome'] = 'Laburpena ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domains'; # XXX
$PALANG['pOverview_alias_address'] = 'Igorlea';
$PALANG['active'] = 'Aktibatua';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[and %s more...]'; # XXX
$PALANG['pOverview_mailbox_username'] = 'E-mail';
+2
View File
@@ -90,6 +90,8 @@ $PALANG['pOverview_welcome'] = 'Yleisnäkymä ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domainit';
$PALANG['pOverview_alias_address'] = 'Keneltä';
$PALANG['active'] = 'Aktiivinen';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[ja %s lisää...]';
$PALANG['pOverview_mailbox_username'] = 'Sähköposti';
+2
View File
@@ -89,6 +89,8 @@ $PALANG['pOverview_welcome'] = 'Yvirlit yvir ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domains'; # XXX
$PALANG['pOverview_alias_address'] = 'Frá';
$PALANG['active'] = 'Virkin';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[and %s more...]'; # XXX
$PALANG['pOverview_mailbox_username'] = 'E-post';
+2
View File
@@ -93,6 +93,8 @@ $PALANG['pOverview_welcome'] = 'Vue d\'ensemble pour ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias de domaines';
$PALANG['pOverview_alias_address'] = 'De';
$PALANG['active'] = 'Actif';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[et %s en plus...]';
$PALANG['pOverview_mailbox_username'] = 'courriel';
+2
View File
@@ -87,6 +87,8 @@ $PALANG['pOverview_welcome'] = 'Resumo de ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias de Dominios';
$PALANG['pOverview_alias_address'] = 'De';
$PALANG['active'] = 'Activo';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[e %s máis...]';
$PALANG['pOverview_mailbox_username'] = 'E-mail';
+2
View File
@@ -88,6 +88,8 @@ $PALANG['pOverview_welcome'] = 'Pregled za ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domains'; # XXX
$PALANG['pOverview_alias_address'] = 'Od';
$PALANG['active'] = 'Aktivan';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[and %s more...]'; # XXX
$PALANG['pOverview_mailbox_username'] = 'E-pošta';
+2
View File
@@ -90,6 +90,8 @@ $PALANG['pOverview_welcome'] = 'Áttekintés: ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domains'; # XXX
$PALANG['pOverview_alias_address'] = 'Honnan';
$PALANG['active'] = 'Aktív';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[and %s more...]'; # XXX
$PALANG['pOverview_mailbox_username'] = 'Email';
+2
View File
@@ -89,6 +89,8 @@ $PALANG['pOverview_welcome'] = 'Yfirlit fyrir ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domains'; # XXX
$PALANG['pOverview_alias_address'] = 'Póstur fyrir';
$PALANG['active'] = 'Virkt';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[and %s more...]'; # XXX
$PALANG['pOverview_mailbox_username'] = 'Póstfang';
+2
View File
@@ -91,6 +91,8 @@ $PALANG['pOverview_welcome'] = 'Resoconto per ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias di Dominio';
$PALANG['pOverview_alias_address'] = 'Da';
$PALANG['active'] = 'Attivo';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[più %s altri...]';
$PALANG['pOverview_mailbox_username'] = 'Email';
+2
View File
@@ -91,6 +91,8 @@ $PALANG['pOverview_welcome'] = '概要 ';
$PALANG['pOverview_alias_domain_aliases'] = 'エイリアスドメイン';
$PALANG['pOverview_alias_address'] = '転送元';
$PALANG['active'] = 'アクティブ';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[その他 %s 個]';
$PALANG['pOverview_mailbox_username'] = 'メールアドレス';
+2
View File
@@ -89,6 +89,8 @@ $PALANG['pOverview_welcome'] = 'Peržiūra ';
$PALANG['pOverview_alias_domain_aliases'] = 'Srities sinonimai';
$PALANG['pOverview_alias_address'] = 'Iš';
$PALANG['active'] = 'Įjungtas'; # XXX check text - should be 'Active'
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[ir %s daugiau...]';
$PALANG['pOverview_mailbox_username'] = 'El.paštas';
+2
View File
@@ -89,6 +89,8 @@ $PALANG['pOverview_welcome'] = 'Преглед за ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domains'; # XXX
$PALANG['pOverview_alias_address'] = 'Од';
$PALANG['active'] = 'Активен';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[and %s more...]'; # XXX
$PALANG['pOverview_mailbox_username'] = 'Адреса';
+2
View File
@@ -91,6 +91,8 @@ $PALANG['pOverview_welcome'] = 'Oversikt for ';
$PALANG['pOverview_alias_domain_aliases'] = 'Aliasdomener';
$PALANG['pOverview_alias_address'] = 'Fra';
$PALANG['active'] = 'Aktiv';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[og %s flere...]';
$PALANG['pOverview_mailbox_username'] = 'E-post';
+2
View File
@@ -91,6 +91,8 @@ $PALANG['pOverview_welcome'] = 'Overzicht voor ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias domeinen';
$PALANG['pOverview_alias_address'] = 'Van';
$PALANG['active'] = 'Actief';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[en %s meer...]';
$PALANG['pOverview_mailbox_username'] = 'e-mail';
+2
View File
@@ -89,6 +89,8 @@ $PALANG['pOverview_welcome'] = 'Oversikt for ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domains'; # XXX
$PALANG['pOverview_alias_address'] = 'Fra';
$PALANG['active'] = 'Aktiv'; # XXX check text - should be 'Active'
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[and %s more...]'; # XXX
$PALANG['pOverview_mailbox_username'] = 'E-post';
+2
View File
@@ -92,6 +92,8 @@ $PALANG['pOverview_welcome'] = 'Dane zbiorcze dla domeny ';
$PALANG['pOverview_alias_domain_aliases'] = 'Domeny aliasowe';
$PALANG['pOverview_alias_address'] = 'Od';
$PALANG['active'] = 'Aktywny';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[i %s wiecej...]';
$PALANG['pOverview_mailbox_username'] = 'Email';
+2
View File
@@ -91,6 +91,8 @@ $PALANG['pOverview_welcome'] = 'Visão geral de ';
$PALANG['pOverview_alias_domain_aliases'] = 'Aliases de Domínio';
$PALANG['pOverview_alias_address'] = 'De';
$PALANG['active'] = 'Habilitado';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[e %s mais...]';
$PALANG['pOverview_mailbox_username'] = 'Email';
+2
View File
@@ -91,6 +91,8 @@ $PALANG['pOverview_welcome'] = 'Visão geral de ';
$PALANG['pOverview_alias_domain_aliases'] = 'Aliases de Domínio';
$PALANG['pOverview_alias_address'] = 'De';
$PALANG['active'] = 'Activado';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[e %s mais...]';
$PALANG['pOverview_mailbox_username'] = 'Email';
+2
View File
@@ -90,6 +90,8 @@ $PALANG['pOverview_welcome'] = 'Vizualizare pentru ';
$PALANG['pOverview_alias_domain_aliases'] = 'Domenii alias';
$PALANG['pOverview_alias_address'] = 'De la';
$PALANG['active'] = 'Activ';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[inca %s ...]';
$PALANG['pOverview_mailbox_username'] = 'Email';
+2
View File
@@ -93,6 +93,8 @@ $PALANG['pOverview_welcome'] = 'Обзор для ';
$PALANG['pOverview_alias_domain_aliases'] = 'Алиасы доменов';
$PALANG['pOverview_alias_address'] = 'От';
$PALANG['active'] = 'Активен';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[и еще %s...]';
$PALANG['pOverview_mailbox_username'] = 'Ящик';
+2
View File
@@ -90,6 +90,8 @@ $PALANG['pOverview_welcome'] = 'Prehľad pre doménu ';
$PALANG['pOverview_alias_domain_aliases'] = 'Aliasy domén';
$PALANG['pOverview_alias_address'] = 'Od';
$PALANG['active'] = 'Aktívny';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[a %s ďalších...]';
$PALANG['pOverview_mailbox_username'] = 'Email';
+2
View File
@@ -89,6 +89,8 @@ $PALANG['pOverview_welcome'] = 'Pregled za ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domains'; # XXX
$PALANG['pOverview_alias_address'] = 'Od';
$PALANG['active'] = 'Aktiven';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[and %s more...]'; # XXX
$PALANG['pOverview_mailbox_username'] = 'E-pošta';
+2
View File
@@ -92,6 +92,8 @@ $PALANG['pOverview_welcome'] = 'Sammanfattning för ';
$PALANG['pOverview_alias_domain_aliases'] = 'Domänalias';
$PALANG['pOverview_alias_address'] = 'Från';
$PALANG['active'] = 'Aktiv';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[och %s mer...]';
$PALANG['pOverview_mailbox_username'] = 'E-post';
+2
View File
@@ -89,6 +89,8 @@ $PALANG['pOverview_welcome'] = 'Genel Bilgiler: ';
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domainleri';
$PALANG['pOverview_alias_address'] = 'Kimden';
$PALANG['active'] = 'Aktif';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[ve %s daha fazla...]';
$PALANG['pOverview_mailbox_username'] = 'E-posta';
+2
View File
@@ -90,6 +90,8 @@ $PALANG['pOverview_welcome'] = '瀏覽 ';
$PALANG['pOverview_alias_domain_aliases'] = '網域名';
$PALANG['pOverview_alias_address'] = '前往';
$PALANG['active'] = '生效';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[and %s more...]'; # XXX
$PALANG['pOverview_mailbox_username'] = '郵件地址';
+2
View File
@@ -91,6 +91,8 @@ $PALANG['pOverview_welcome'] = 'Огляд для ';
$PALANG['pOverview_alias_domain_aliases'] = 'Псевдоними (аліаси) доменів';
$PALANG['pOverview_alias_address'] = 'Від кого';
$PALANG['active'] = 'Активний';
$PALANG['inactive'] = 'Inactive'; # XXX
$PALANG['alias_active_filter'] = 'Forward status:'; # XXX
$PALANG['smtp_active'] = 'Smtp';
$PALANG['and_x_more'] = '[та ще %s...]';
$PALANG['pOverview_mailbox_username'] = 'Поштова адреса (Email)';
+18
View File
@@ -54,6 +54,15 @@ if (isset($_POST['search']) && is_array($_POST['search'])) {
$search = $_GET['search'];
}
// Active-status filter for the alias list (all|active|inactive). Persisted in
// $_SESSION like the 'tab' selector below, so it survives pagination (whose
// links only carry &limit=...).
$fAliasActive = safeget('alias_active', safesession('list-virtual:alias_active', 'all'));
if (!in_array($fAliasActive, ['all', 'active', 'inactive'], true)) {
$fAliasActive = 'all';
}
$_SESSION['list-virtual:alias_active'] = $fAliasActive;
if (count($list_domains) == 0) {
if (authentication_has_role('global-admin')) {
flash_error($PALANG['no_domains_exist']);
@@ -159,6 +168,14 @@ if (count($search) == 0 || !isset($search['_'])) {
$search_alias = array('_' => $search['_']);
}
// Restrict the alias list to (in)active entries when the filter is set. 'active'
// is a bool field in the struct, so db_where_clause() parameterises it for us.
if ($fAliasActive === 'active') {
$search_alias['active'] = 1;
} elseif ($fAliasActive === 'inactive') {
$search_alias['active'] = 0;
}
$handler = new AliasHandler(0, $admin_username);
$formconf = $handler->webformConfig(); # might change struct
$alias_data = array(
@@ -514,6 +531,7 @@ if (Config::bool('alias_domain')) {
$smarty->assign('tAlias', $tAlias);
$smarty->assign('alias_data', $alias_data);
$smarty->assign('alias_active', $fAliasActive);
$smarty->assign('tMailbox', $tMailbox);
$smarty->assign('gen_show_status_mailbox', $gen_show_status_mailbox, false);
+8
View File
@@ -64,6 +64,14 @@
{/if}
{*** Aliases ***}
{if $tab=='alias' || $tab=='all'}
<div class="text-center mb-2">{$PALANG.alias_active_filter}
{if $alias_active=='all'}<span class='active'>{$PALANG.all}</span>
{else}<a href="?domain={$fDomain|escape:"url"}&amp;tab={$tab|escape:"url"}&amp;alias_active=all&amp;limit=0{$searchsuffix}">{$PALANG.all}</a>{/if}
{if $alias_active=='active'}<span class='active'>{$PALANG.active}</span>
{else}<a href="?domain={$fDomain|escape:"url"}&amp;tab={$tab|escape:"url"}&amp;alias_active=active&amp;limit=0{$searchsuffix}">{$PALANG.active}</a>{/if}
{if $alias_active=='inactive'}<span class='active'>{$PALANG.inactive}</span>
{else}<a href="?domain={$fDomain|escape:"url"}&amp;tab={$tab|escape:"url"}&amp;alias_active=inactive&amp;limit=0{$searchsuffix}">{$PALANG.inactive}</a>{/if}
</div>
{$nav_bar_alias.top}
{include file="list-virtual_alias.tpl"}
{$nav_bar_alias.bottom}
+42
View File
@@ -390,4 +390,46 @@ class AliasHandlerTest extends \PHPUnit\Framework\TestCase
$this->assertEquals(5, count($results));
$this->assertTrue(isset($results['31-test@example.com']));
}
/**
* The list-virtual.php active-status filter works by passing an 'active'
* condition to AliasHandler::getList(). Verify that filters the list.
* @see https://github.com/postfixadmin/postfixadmin/issues/1038
*/
public function testActiveConditionFiltersAliasList()
{
$this->addDomain('example.com', 'admin');
// Add one active and one inactive alias (on top of the 4 default
// aliases, which are active).
foreach (['act@example.com' => 1, 'inact@example.com' => 0] as $addr => $active) {
$x = new AliasHandler(1, 'admin', true);
$this->assertTrue($x->init($addr));
$x->set([
'localpart' => explode('@', $addr)[0],
'domain' => 'example.com',
'active' => $active,
'address' => $addr,
'goto' => ['dest@example.com'],
]);
$this->assertTrue($x->save(), json_encode($x->errormsg));
}
// active-only: contains our active alias and the defaults, never the inactive one.
$x = new AliasHandler(0, 'admin', true);
$this->assertTrue($x->getList(['domain' => 'example.com', 'active' => 1]));
$activeList = $x->result();
$this->assertArrayHasKey('act@example.com', $activeList);
$this->assertArrayNotHasKey('inact@example.com', $activeList);
foreach ($activeList as $addr => $row) {
$this->assertEquals(1, $row['active'], "$addr should be active");
}
// inactive-only: exactly our inactive alias.
$x = new AliasHandler(0, 'admin', true);
$this->assertTrue($x->getList(['domain' => 'example.com', 'active' => 0]));
$inactiveList = $x->result();
$this->assertEquals(['inact@example.com'], array_keys($inactiveList));
$this->assertEquals(0, $inactiveList['inact@example.com']['active']);
}
}