Skip to content

Commit 229ef65

Browse files
author
Pascal Dreissen
committed
Fix #4222 (sorting mail quota / mail traffic) align columns to be more consistent and clearer.
1 parent 107b7a9 commit 229ef65

File tree

6 files changed

+18
-22
lines changed

6 files changed

+18
-22
lines changed

interface/web/mail/list/mail_user_stats.list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
$liste["auth"] = "yes";
4444

4545
// mark columns for php sorting (no real mySQL columns)
46-
$liste["phpsort"] = array('this_month', 'last_month', 'this_year', 'last_year');
46+
$liste["phpsort"] = array('this_month_sort', 'last_month_sort', 'this_year_sort', 'last_year_sort');
4747

4848
/*****************************************************
4949
* Suchfelder

interface/web/mail/list/user_quota_stats.list.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242

4343
// mark columns for php sorting (no real mySQL columns)
4444
$liste["phpsort"] = array('used_sort', 'percentage_sort');
45-
4645
/*****************************************************
4746
* Suchfelder
4847
*****************************************************/

interface/web/mail/mail_user_stats.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,31 @@ function prepareDataRow($rec)
3535
//** Traffic of the current month
3636
$tmp_date = date('Y-m');
3737
$tmp_rec = $app->db->queryOneRecord("SELECT traffic as t FROM mail_traffic WHERE mailuser_id = ? AND month = ?", $rec['mailuser_id'], $tmp_date);
38+
$rec['this_month_sort'] = $tmp_rec['t'];
3839
// $rec['this_month'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' ');
3940
$rec['this_month'] = $app->functions->formatBytes($tmp_rec['t']);
4041
if ($rec['this_month'] == 'NAN') $rec['this_month'] = '0 KB';
4142

4243
//** Traffic of the current year
4344
$tmp_date = date('Y');
4445
$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic) as t FROM mail_traffic WHERE mailuser_id = ? AND month like ?", $rec['mailuser_id'], $tmp_date . '%');
46+
$rec['this_year_sort'] = $tmp_rec['t'];
4547
// $rec['this_year'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' ');
4648
$rec['this_year'] = $app->functions->formatBytes($tmp_rec['t']);
4749
if ($rec['this_year'] == 'NAN') $rec['this_year'] = '0 KB';
4850

4951
//** Traffic of the last month
5052
$tmp_date = date('Y-m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
5153
$tmp_rec = $app->db->queryOneRecord("SELECT traffic as t FROM mail_traffic WHERE mailuser_id = ? AND month = ?", $rec['mailuser_id'], $tmp_date);
54+
$rec['last_month_sort'] = $tmp_rec['t'];
5255
// $rec['last_month'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' ');
5356
$rec['last_month'] = $app->functions->formatBytes($tmp_rec['t']);
5457
if ($rec['last_month'] == 'NAN') $rec['last_month'] = '0 KB';
5558

5659
//** Traffic of the last year
5760
$tmp_date = date('Y', mktime(0, 0, 0, date("m"), date("d"), date("Y")-1));
5861
$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic) as t FROM mail_traffic WHERE mailuser_id = ? AND month like ?", $rec['mailuser_id'], $tmp_date . '%');
62+
$rec['last_year_sort'] = $tmp_rec['t'];
5963
// $rec['last_year'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' ');
6064
$rec['last_year'] = $app->functions->formatBytes($tmp_rec['t']);
6165
if ($rec['last_year'] == 'NAN') $rec['last_year'] = '0 KB';

interface/web/mail/templates/mail_user_stats_list.htm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ <h1><tmpl_var name="list_head_txt"></h1>
99
<table class="table">
1010
<thead class="dark form-group-sm">
1111
<tr>
12-
<th data-column="email"><tmpl_var name="email_txt"></th>
13-
<th data-column="this_month"><tmpl_var name="this_month_txt"></th>
14-
<th data-column="last_month"><tmpl_var name="last_month_txt"></th>
15-
<th data-column="this_year"><tmpl_var name="this_year_txt"></th>
16-
<th data-column="last_year"><tmpl_var name="last_year_txt"></th>
12+
<th class="col-md-3" data-column="email"><tmpl_var name="email_txt"></th>
13+
<th class="col-md-1" data-column="this_month_sort"><tmpl_var name="this_month_txt"></th>
14+
<th class="col-md-1" data-column="last_month_sort"><tmpl_var name="last_month_txt"></th>
15+
<th class="col-md-1" data-column="this_year_sort"><tmpl_var name="this_year_txt"></th>
16+
<th class="col-md-1" data-column="last_year_sort"><tmpl_var name="last_year_txt"></th>
1717
<th class="small-col text-right">{tmpl_var name='search_limit'}</th>
1818
</tr>
1919
<tr>

interface/web/mail/templates/user_quota_stats_list.htm

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ <h1><tmpl_var name="list_head_txt"></h1>
88
<table class="table">
99
<thead class="dark form-group-sm">
1010
<tr>
11-
<th data-column="email"><tmpl_var name="email_txt"></th>
12-
<th data-column="name"><tmpl_var name="name_txt"></th>
13-
<th data-column="used"><tmpl_var name="used_txt"></th>
14-
<th data-column="quota"><tmpl_var name="quota_txt"></th>
15-
<th data-column="percentage"><tmpl_var name="percentage_txt"></th>
16-
<th class="small-col text-right">{tmpl_var name='search_limit'}</th>
11+
<th class="col-md-3" data-column="email"><tmpl_var name="email_txt"></th>
12+
<th class="col-md-2" data-column="name"><tmpl_var name="name_txt"></th>
13+
<th class="col-md-1" data-column="used_sort"><tmpl_var name="used_txt"></th>
14+
<th class="col-md-1" data-column="quota"><tmpl_var name="quota_txt"></th>
15+
<th class="col-md-1" data-column="percentage_sort"><tmpl_var name="percentage_txt"></th>
16+
<th class="col-md-1 text-right">{tmpl_var name='search_limit'}</th>
1717
</tr>
1818
<tr>
1919
<td><input class="form-control" type="text" name="search_email" value="{tmpl_var name='search_email'}" /></td>
2020
<td><input class="form-control" type="text" name="search_system_user" value="{tmpl_var name='search_name'}" /></td>
2121
<td>&nbsp;</td>
22-
<td>&nbsp;</td>
22+
<td>&nbsp;</td>
2323
<td>&nbsp;</td>
2424
<td class="text-right">
2525
<button type="button" class="btn btn-default formbutton-default formbutton-narrow" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" data-submit-form="pageForm" data-form-action="mail/user_quota_stats.php"><span class="icon icon-filter"></span></button>

interface/web/mail/user_quota_stats.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function prepareDataRow($rec)
5353

5454
if($rec['quota'] == 0){
5555
$rec['quota'] = $app->lng('unlimited');
56-
$rec['percentage'] = '';
56+
$rec['percentage'] = 'n/a';
5757
$rec['percentage_sort'] = 0;
5858
} else {
5959
$rec['percentage'] = round(100 * $rec['used'] / $rec['quota']) . '%';
@@ -63,13 +63,6 @@ function prepareDataRow($rec)
6363

6464

6565
$rec['used_sort'] = $rec['used'];
66-
/*
67-
if($rec['used'] < 1544000) {
68-
$rec['used'] = round($rec['used'] / 1024, 4).' KB';
69-
} else {
70-
$rec['used'] = round($rec['used'] / 1048576, 4).' MB';
71-
}
72-
*/
7366
$rec['used']=$app->functions->formatBytes($rec['used']);
7467
if ($rec['used'] == 'NAN') $rec['used']='0 KB';
7568

0 commit comments

Comments
 (0)