mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
model/DomainHandler.php:
- initStruct(): - add optical quota indicators for aliases, mailboxes, domain quota - some adjustments to get nice output with list.php (mostly following list-domain.php) - webformConfig(): switch listview to list.php configs/menu.conf, templates/adminlistadmin.tpl: - switch list-domain.php to list.php?table=domain git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1745 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
parent
5605561ca8
commit
1d35ba80ab
@ -4,7 +4,7 @@ url_editactive = editactive.php?table=
|
||||
url_list_admin = list-admin.php
|
||||
url_create_admin = edit.php?table=admin
|
||||
# list-domain
|
||||
url_list_domain = list-domain.php
|
||||
url_list_domain = list.php?table=domain
|
||||
url_edit_domain = edit.php?table=domain
|
||||
# list-virtual
|
||||
url_list_virtual = list-virtual.php
|
||||
|
@ -33,8 +33,12 @@ class DomainHandler extends PFAHandler {
|
||||
$super = $this->is_superadmin;
|
||||
|
||||
$transp = min($super, Config::intbool('transport'));
|
||||
$quota = min($super, Config::intbool('quota'));
|
||||
$dom_q = min($super, Config::intbool('domain_quota'));
|
||||
$editquota = min($super, Config::intbool('quota'));
|
||||
$quota = Config::intbool('quota');
|
||||
$edit_dom_q = min($super, Config::intbool('domain_quota'));
|
||||
$dom_q = Config::intbool('domain_quota');
|
||||
|
||||
$query_used_domainquota = 'round(coalesce(__total_quota/' . intval(Config::read('quota_multiplier')) . ',0))';
|
||||
|
||||
# NOTE: There are dependencies between alias_count, mailbox_count and total_quota.
|
||||
# NOTE: If you disable "display in list" for one of them, the SQL query for the others might break.
|
||||
@ -43,35 +47,54 @@ class DomainHandler extends PFAHandler {
|
||||
$this->struct=array(
|
||||
# field name allow display in... type $PALANG label $PALANG description default / options / ...
|
||||
# editing? form list
|
||||
'domain' => pacol( $this->new, 1, 1, 'text', 'domain' , '' ),
|
||||
'description' => pacol( $super, 1, 1, 'text', 'description' , '' ),
|
||||
'aliases' => pacol( $super, $super, 1, 'num' , 'aliases' , 'pAdminEdit_domain_aliases_text' , Config::read('aliases') ),
|
||||
'domain' => pacol( $this->new, 1, 1, 'text', 'domain' , '' , '', '',
|
||||
array('linkto' => 'list-virtual.php?domain=%s') ),
|
||||
'description' => pacol( $super, $super, $super, 'text', 'description' , '' ),
|
||||
|
||||
# Aliases
|
||||
'aliases' => pacol( $super, $super, 0, 'num' , 'aliases' , 'pAdminEdit_domain_aliases_text' , Config::read('aliases') ),
|
||||
'alias_count' => pacol( 0, 0, 1, 'vnum', '' , '' , '', '',
|
||||
/*not_in_db*/ 0,
|
||||
/*dont_write_to_db*/ 1,
|
||||
/*select*/ 'coalesce(__alias_count,0) - coalesce(__mailbox_count,0) as alias_count',
|
||||
/*extrafrom*/ 'left join ( select count(*) as __alias_count, domain as __alias_domain from ' . table_by_key('alias') .
|
||||
' group by domain) as __alias on domain = __alias_domain'),
|
||||
'mailboxes' => pacol( $super, $super, 1, 'num' , 'mailboxes' , 'pAdminEdit_domain_aliases_text' , Config::read('mailboxes') ),
|
||||
'aliases_quot' => pacol( 0, 0, 1, 'quot', 'aliases' , '' , 0, '',
|
||||
array('select' => db_quota_text( '__alias_count - __mailbox_count', 'aliases', 'aliases_quot')) ),
|
||||
'_aliases_quot_percent' => pacol( 0, 0, 1, 'vnum', '' ,'' , 0, '',
|
||||
array('select' => db_quota_percent('__alias_count - __mailbox_count', 'aliases', '_aliases_quot_percent')) ),
|
||||
|
||||
# Mailboxes
|
||||
'mailboxes' => pacol( $super, $super, 0, 'num' , 'mailboxes' , 'pAdminEdit_domain_aliases_text' , Config::read('mailboxes') ),
|
||||
'mailbox_count' => pacol( 0, 0, 1, 'vnum', '' , '' , '', '',
|
||||
/*not_in_db*/ 0,
|
||||
/*dont_write_to_db*/ 1,
|
||||
/*select*/ 'coalesce(__mailbox_count,0) as mailbox_count',
|
||||
/*extrafrom*/ 'left join ( select count(*) as __mailbox_count, sum(quota) as __total_quota, domain as __mailbox_domain from ' . table_by_key('mailbox') .
|
||||
' group by domain) as __mailbox on domain = __mailbox_domain'),
|
||||
'maxquota' => pacol( $quota, $quota, $quota, 'num' , 'pAdminEdit_domain_maxquota' , 'pAdminEdit_domain_maxquota_text' , Config::read('maxquota') ),
|
||||
'total_quota' => pacol( 0, 0, 1, 'vnum', '' , '' , '', '',
|
||||
/*not_in_db*/ 0,
|
||||
/*dont_write_to_db*/ 1,
|
||||
/*select*/ 'round(coalesce(__total_quota/' . intval(Config::read('quota_multiplier')) . ',0)) as total_quota' /*extrafrom*//* already in mailbox_count */ ),
|
||||
'quota' => pacol( $dom_q, $dom_q, $dom_q, 'num' , 'pAdminEdit_domain_quota' , 'pAdminEdit_domain_maxquota_text' , Config::read('domain_quota_default') ),
|
||||
'mailboxes_quot' => pacol( 0, 0, 1, 'quot', 'mailboxes' , '' , 0, '',
|
||||
array('select' => db_quota_text( '__mailbox_count', 'mailboxes', 'mailboxes_quot')) ),
|
||||
'_mailboxes_quot_percent' => pacol( 0, 0, 1, 'vnum', '' , '' , 0, '',
|
||||
array('select' => db_quota_percent('__mailbox_count', 'mailboxes', '_mailboxes_quot_percent')) ),
|
||||
|
||||
'maxquota' => pacol($editquota,$editquota,$quota, 'num' , 'pOverview_get_quota' , 'pAdminEdit_domain_maxquota_text' , Config::read('maxquota') ),
|
||||
|
||||
# Domain quota
|
||||
'quota' => pacol($edit_dom_q,$edit_dom_q, 0, 'num', 'pAdminEdit_domain_quota' , 'pAdminEdit_domain_maxquota_text' , Config::read('domain_quota_default') ),
|
||||
'total_quota' => pacol( 0, 0, 1, 'vnum', 'total_quota' , '' , '', '',
|
||||
array('select' => "$query_used_domainquota AS total_quota") /*extrafrom*//* already in mailbox_count */ ),
|
||||
'total_quot' => pacol( 0, 0, 1, 'quot', 'pAdminEdit_domain_quota' , '' , 0, '',
|
||||
array('select' => db_quota_text( $query_used_domainquota, 'quota', 'total_quot')) ),
|
||||
'_total_quot_percent'=> pacol( 0, 0, 1, 'vnum', '' , '' , 0, '',
|
||||
array('select' => db_quota_percent($query_used_domainquota, 'quota', '_total_quot_percent')) ),
|
||||
|
||||
'transport' => pacol( $transp, $transp,$transp,'enum', 'transport' , 'pAdminEdit_domain_transport_text' , Config::read('transport_default') ,
|
||||
/*options*/ Config::read('transport_options') ),
|
||||
'backupmx' => pacol( $super, $super, 1, 'bool', 'pAdminEdit_domain_backupmx' , '' , 0),
|
||||
'active' => pacol( $super, $super, 1, 'bool', 'active' , '' , 1 ),
|
||||
'default_aliases' => pacol( $this->new, $this->new, 0, 'bool', 'pAdminCreate_domain_defaultaliases', '' , 1,'', /*not in db*/ 1 ),
|
||||
'created' => pacol( 0, 0, 1, 'ts', 'created' , '' ),
|
||||
'modified' => pacol( 0, 0, 1, 'ts', 'last_modified' , '' ),
|
||||
'created' => pacol( 0, 0, 0, 'ts', 'created' , '' ),
|
||||
'modified' => pacol( 0, 0, $super, 'ts', 'last_modified' , '' ),
|
||||
'_can_edit' => pacol( 0, 0, 1, 'int', '' , '' , 0 ,
|
||||
/*options*/ '',
|
||||
/*not_in_db*/ 0,
|
||||
@ -108,7 +131,7 @@ class DomainHandler extends PFAHandler {
|
||||
|
||||
# various settings
|
||||
'required_role' => 'admin',
|
||||
'listview' => 'list-domain.php',
|
||||
'listview' => 'list.php?table=domain',
|
||||
'early_init' => 0,
|
||||
);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
</tr>
|
||||
{foreach from=$admin_properties item=admin}
|
||||
{#tr_hilightoff#}
|
||||
<td><a href="list-domain.php?username={$admin.username|escape:"url"}">{$admin.username}</a></td>
|
||||
<td><a href="list.php?table=domain&username={$admin.username|escape:"url"}">{$admin.username}</a></td>
|
||||
<td>
|
||||
{if $admin.superadmin == 1}
|
||||
{$PALANG.super_admin}
|
||||
|
Loading…
Reference in New Issue
Block a user