diff --git a/configs/menu.conf b/configs/menu.conf
index e57348d3..71d851ae 100644
--- a/configs/menu.conf
+++ b/configs/menu.conf
@@ -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
diff --git a/css/default.css b/css/default.css
index 23f53fbc..4786e701 100644
--- a/css/default.css
+++ b/css/default.css
@@ -376,6 +376,7 @@ z-index:100;
margin-top:-14px;
}
.quota_bg { background-color: white; z-index:98; width:120px; height:14px;margin-top:-1px;margin-left:-1px; border: 1px solid #999;}
+.quota_no_border { border:none; margin:0; }
.quota_high { background: url(../images/quota-colors.png) repeat-x 0 -28px #f90509; }
.quota_mid { background: url(../images/quota-colors.png) repeat-x 0 -14px #e3e909; }
.quota_low { background: url(../images/quota-colors.png) repeat-x 0 0px #05f905; }
diff --git a/functions.inc.php b/functions.inc.php
index 4ba9ba0b..63c0a499 100644
--- a/functions.inc.php
+++ b/functions.inc.php
@@ -1322,8 +1322,9 @@ function db_get_boolean($bool) {
*/
function db_quota_text($count, $quota, $fieldname) {
return " CASE $quota
- WHEN '-1' THEN coalesce($count,0)
- ELSE CONCAT(coalesce($count,0), ' / ', $quota)
+ WHEN '-1' THEN CONCAT(coalesce($count,0), ' / -')
+ WHEN '0' THEN CONCAT(coalesce($count,0), ' / ', '" . escape_string(html_entity_decode('∞')) . "')
+ ELSE CONCAT(coalesce($count,0), ' / ', $quota)
END AS $fieldname";
}
@@ -1335,8 +1336,9 @@ function db_quota_text($count, $quota, $fieldname) {
* @return string
*/
function db_quota_percent($count, $quota, $fieldname) {
- return " CASE $quota
+ return " CASE $quota
WHEN '-1' THEN -1
+ WHEN '0' THEN -1
ELSE round(100 * coalesce($count,0) / $quota)
END AS $fieldname";
}
diff --git a/languages/de.lang b/languages/de.lang
index 89053db8..9902451f 100644
--- a/languages/de.lang
+++ b/languages/de.lang
@@ -27,7 +27,7 @@ $PALANG['missing_field'] = 'Das Feld %s fehlt';
$PALANG['must_be_numeric'] = '%s muss numerisch sein';
$PALANG['must_be_boolean'] = "%s muss ein Bool'scher Wert sein";
$PALANG['invalid_value_given'] = 'Ungültiger Wert für %s angegeben';
-$PALANG['edit_not_allowed'] = 'Sie dülrfen %s nicht bearbeiten!';
+$PALANG['edit_not_allowed'] = 'Sie dürfen %s nicht bearbeiten!';
$PALANG['searchparams'] = 'Suchparameter:';
$PALANG['pFooter_logged_as'] = 'Angemeldet als %s';
diff --git a/list-domain.php b/list-domain.php
deleted file mode 100644
index c3b51dcf..00000000
--- a/list-domain.php
+++ /dev/null
@@ -1,53 +0,0 @@
-getList('');
-$domain_properties = $handler->result();
-
-$smarty->assign ('domain_properties', $domain_properties);
-$smarty->assign ('select_options', select_options($list_admins, array ($fUsername)), false);
-if ($is_superadmin) {
- $smarty->assign('smarty_template', 'adminlistdomain');
-} else {
- $smarty->assign ('smarty_template', 'overview-get');
-}
-
-$smarty->display ('index.tpl');
-
-/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
-?>
diff --git a/list-virtual.php b/list-virtual.php
index f5487af6..b7d9dd44 100644
--- a/list-virtual.php
+++ b/list-virtual.php
@@ -46,7 +46,7 @@ if (count($list_domains) == 0) {
} else {
flash_error($PALANG['no_domains_for_this_admin']);
}
- header("Location: list-domain.php"); # no domains (for this admin at least) - redirect to domain list
+ header("Location: list.php?table=domain"); # no domains (for this admin at least) - redirect to domain list
exit;
}
@@ -59,14 +59,14 @@ if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) {
if(!in_array($fDomain, $list_domains)) {
flash_error( $PALANG['invalid_parameter'] );
unset($_SESSION['list-virtual:domain']);
- header("Location: list-domain.php"); # invalid domain, or not owned by this admin
+ header("Location: list.php?table=domain"); # invalid domain, or not owned by this admin
exit;
}
if (!check_owner(authentication_get_username(), $fDomain)) {
flash_error( $PALANG['invalid_parameter'] . " If you see this message, please open a bugreport"); # this check is most probably obsoleted by the in_array() check above
unset($_SESSION['list-virtual:domain']);
- header("Location: list-domain.php"); # domain not owned by this admin
+ header("Location: list.php?table=domain"); # domain not owned by this admin
exit(0);
}
diff --git a/model/DomainHandler.php b/model/DomainHandler.php
index da04c922..493ad004 100644
--- a/model/DomainHandler.php
+++ b/model/DomainHandler.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,
);
}
diff --git a/templates/adminlistadmin.tpl b/templates/adminlistadmin.tpl
index a7f228a5..cb67753c 100644
--- a/templates/adminlistadmin.tpl
+++ b/templates/adminlistadmin.tpl
@@ -9,7 +9,7 @@
{foreach from=$admin_properties item=admin}
{#tr_hilightoff#}
-
{$admin.username} |
+ {$admin.username} |
{if $admin.superadmin == 1}
{$PALANG.super_admin}
diff --git a/templates/adminlistdomain.tpl b/templates/adminlistdomain.tpl
deleted file mode 100644
index 3643dab8..00000000
--- a/templates/adminlistdomain.tpl
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-{#form_search#}
-
-{if $domain_properties}
-
- {#tr_header#}
- {$PALANG.domain} |
- {$PALANG.description} |
- {$PALANG.aliases} |
- {$PALANG.mailboxes} |
- {if $CONF.quota==YES}{$PALANG.pOverview_get_quota} | {/if}
- {if $CONF.domain_quota==YES}{$PALANG.pAdminList_domain_quota} | {/if}
- {if $CONF.transport==YES}{$PALANG.transport} | {/if}
- {$PALANG.pAdminList_domain_backupmx} |
- {$PALANG.last_modified} |
- {$PALANG.active} |
- |
-
-{foreach from=$domain_properties item=domain}
- {#tr_hilightoff#}
- {$domain.domain} |
- {$domain.description} |
- {$domain.alias_count} / {$domain.aliases} |
- {$domain.mailbox_count} / {$domain.mailboxes} |
- {if $CONF.quota==YES}{$domain.maxquota} | {/if}
- {if $CONF.domain_quota===YES}{$domain.total_quota} / {$domain.quota} | {/if}
- {if $CONF.transport==YES}{$domain.transport} | {/if}
- {$domain._backupmx} |
- {$domain.modified} |
- {$domain._active} |
- {$PALANG.edit} |
- {$PALANG.del} |
-
-{/foreach}
-
-{/if}
- {$PALANG.pAdminMenu_create_domain}
diff --git a/templates/list.tpl b/templates/list.tpl
index 2620d4e3..775ec38f 100644
--- a/templates/list.tpl
+++ b/templates/list.tpl
@@ -56,9 +56,13 @@
Special handling (td content) for {$table} / {$key}
{* {elseif $table == 'domain' && $key == 'domain'}
{$item.domain}
-*}
+*}
{elseif $key == 'active'}
- {$item._active}
+ {if $item._can_edit}
+ {$item._active}
+ {else}
+ {$item._active}
+ {/if}
{elseif $field.type == 'bool'}
{assign "tmpkey" "_{$key}"}{$item.{$tmpkey}}
{elseif $field.type == 'list'}
@@ -80,7 +84,8 @@
{$linktext}
{else}
- {$item[$key]}
+
+ {$linktext}
{/if}
{elseif $field.type == 'txtl'}
diff --git a/templates/overview-get.tpl b/templates/overview-get.tpl
deleted file mode 100644
index a7d6da22..00000000
--- a/templates/overview-get.tpl
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-{#form_search#}
-
-
-
- {$PALANG.pOverview_title} |
-
- {#tr_header#}
- {$PALANG.domain} |
- {$PALANG.aliases} |
- {$PALANG.mailboxes} |
- {if $CONF.quota===YES}{$PALANG.pOverview_get_quota} | {/if}
- {if $CONF.domain_quota===YES}{$PALANG.pAdminList_domain_quota} | {/if}
-
-{foreach from=$domain_properties item=domain}
- {#tr_hilightoff#}
- {$domain.domain} |
- {$domain.alias_count} / {$domain.aliases} |
- {$domain.mailbox_count} / {$domain.mailboxes} |
- {if $CONF.quota===YES}{$domain.maxquota} | {/if}
- {if $CONF.domain_quota===YES}{$domain.total_quota} / {$domain.quota} | {/if}
-
-{/foreach}
-
|