diff --git a/functions.inc.php b/functions.inc.php index 59b9f55f..5598cc01 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -260,6 +260,78 @@ function get_domain_properties ($domain) $list['quota_sum'] = $row[0]; $list['alias_count'] = $list['alias_count'] - $list['mailbox_count']; + $list['alias_pgindex']=array (); + $list['mbox_pgindex']=array (); + + //while loop to figure index names. use page_size and loop of queries + $i=0; + $current=0; + $page_size = $CONF['page_size']; + $tmpstr=""; + $idxlabel=""; + + if ( $list['alias_count'] > $page_size ) + { + while ( $current < $list['alias_count'] ) + { + $limitSql=('pgsql'==$CONF['database_type']) ? "1 OFFSET $current" : "$current, 1"; + $query = "SELECT $table_alias.address FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE $table_alias.domain='$domain' AND $table_mailbox.maildir IS NULL ORDER BY $table_alias.address LIMIT $limitSql"; + $result = db_query ("$query"); + $row = db_array ($result['result']); + $tmpstr = $row['address']; + //get first 2 chars + $idxlabel = $tmpstr[0] . $tmpstr[1] . "-"; + ($current + $page_size - 1 <= $list['alias_count']) ? $current = $current + $page_size - 1 : $current = $list['alias_count'] - 1; + $limitSql=('pgsql'==$CONF['database_type']) ? "1 OFFSET $current" : "$current, 1"; + $query = "SELECT $table_alias.address FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE $table_alias.domain='$domain' AND $table_mailbox.maildir IS NULL ORDER BY $table_alias.address LIMIT $limitSql"; + $result = db_query ("$query"); + $row = db_array ($result['result']); + $tmpstr = $row['address']; + $idxlabel = $idxlabel . $tmpstr[0] . $tmpstr[1]; + + $current = $current + 1; + + $list['alias_pgindex'][]=$idxlabel; + $i++; + } + $list['alias_pgindex_count']=$i; + } + + $i=0; + $current=0; + $page_size = $CONF['page_size']; + $tmpstr=""; + $idxlabel=""; + + if ( $list['mailbox_count'] > $page_size ) + { + while ( $current < $list['mailbox_count'] ) + { + $limitSql=('pgsql'==$CONF['database_type']) ? "1 OFFSET $current" : "$current, 1"; + $query = "SELECT $table_mailbox.username FROM $table_mailbox WHERE $table_mailbox.domain='$domain' ORDER BY $table_mailbox.username LIMIT $limitSql"; + $result = db_query ("$query"); + $row = db_array ($result['result']); + $tmpstr = $row['username']; + //get first 2 chars + $idxlabel = $tmpstr[0] . $tmpstr[1] . "-"; + ($current + $page_size - 1 <= $list['mailbox_count']) ? $current = $current + $page_size - 1 : $current = $list['mailbox_count'] - 1; + $limitSql=('pgsql'==$CONF['database_type']) ? "1 OFFSET $current" : "$current, 1"; + $query = "SELECT $table_mailbox.username FROM $table_mailbox WHERE $table_mailbox.domain='$domain' ORDER BY $table_mailbox.username LIMIT $limitSql"; + $result = db_query ("$query"); + $row = db_array ($result['result']); + $tmpstr = $row['username']; + $idxlabel = $idxlabel . $tmpstr[0] . $tmpstr[1]; + + $current = $current + 1; + + $list['mbox_pgindex'][]=$idxlabel; + $i++; + } + $list['mbox_pgindex_count']=$i; + } + +// end mod + $query="SELECT * FROM $table_domain WHERE domain='$domain'"; if ('pgsql'==$CONF['database_type']) { diff --git a/templates/admin_list-virtual.tpl b/templates/admin_list-virtual.tpl index 2e47110f..32387ea8 100644 --- a/templates/admin_list-virtual.tpl +++ b/templates/admin_list-virtual.tpl @@ -27,7 +27,22 @@ for ($i = 0; $i < sizeof ($list_domains); $i++) \n"; +print "
\n"; + if (sizeof ($tAlias) > 0) { @@ -77,9 +93,25 @@ if (sizeof ($tAlias) > 0) } print "\n"; } - print "" . $PALANG['pMenu_create_alias'] . "\n"; +print "
" . $PALANG['pMenu_create_alias'] . "\n"; + + print "
\n"; + if (sizeof ($tMailbox) > 0) { diff --git a/templates/overview.tpl b/templates/overview.tpl index 556c5cbc..eb097863 100644 --- a/templates/overview.tpl +++ b/templates/overview.tpl @@ -34,11 +34,25 @@ for ($i = 0; $i < sizeof ($list_domains); $i++) \n"; +print " \n"; if (sizeof ($tAlias) > 0) { @@ -100,7 +114,21 @@ if (sizeof ($tAlias) > 0) } print "" . $PALANG['pMenu_create_alias'] . "\n"; - print "