Zeige Archivgröße der Mailinglisten an
bernd

bernd commited on 2012-02-12 07:20:33
Zeige 2 geänderte Dateien mit 14 Einfügungen und 4 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@2193 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -8,7 +8,7 @@ require_once('inc/security.php');
8 8
 function get_lists()
9 9
 {
10 10
   $uid = (int) $_SESSION['userinfo']['uid'];
11
-  $result = db_query("SELECT id, status, listname, fqdn, admin FROM mail.v_mailman_lists WHERE owner={$uid};");
11
+  $result = db_query("SELECT id, status, listname, fqdn, admin, archivesize FROM mail.v_mailman_lists WHERE owner={$uid};");
12 12
   $ret = array();
13 13
   while ($list = mysql_fetch_assoc($result))
14 14
     $ret[] = $list;
... ...
@@ -21,7 +21,7 @@ function get_list($id)
21 21
 {
22 22
   $id = (int) $id;
23 23
   $uid = (int) $_SESSION['userinfo']['uid'];
24
-  $result = db_query("SELECT id, status, listname, fqdn, admin FROM mail.v_mailman_lists WHERE owner={$uid} AND id={$id};");
24
+  $result = db_query("SELECT id, status, listname, fqdn, admin, archivesize FROM mail.v_mailman_lists WHERE owner={$uid} AND id={$id};");
25 25
   if (mysql_num_rows($result) < 1)
26 26
     system_failure('Die gewünschte Mailingliste konnte nicht gefunden werden');
27 27
   $list = mysql_fetch_assoc($result);
... ...
@@ -15,9 +15,19 @@ $lists = get_lists();
15 15
 
16 16
 if (! empty($lists))
17 17
 {
18
-  output("<table>\n<tr><th>Listenname</th><th>Verwalter</th><th>Status</th><th>&nbsp;</th></tr>\n");
18
+  output("<table>\n<tr><th>Listenname</th><th>Verwalter</th><th>Status</th><th>Archivgröße</th><th>&nbsp;</th></tr>\n");
19 19
   foreach ($lists AS $list)
20 20
   {
21
+    $size = $list['archivesize'];
22
+    $sizestr = $size.' Bytes';
23
+    if (! $size) {
24
+      $sizestr = '<em>Kein Archiv</em>';
25
+    }
26
+    else {
27
+      $sizestr = sprintf('%.2f', $size/(1024*1024)).' MB';
28
+    }
29
+
30
+
21 31
     $style = '';
22 32
     $status = 'In Betrieb';
23 33
     if ($list['status'] == 'delete')
... ...
@@ -36,7 +46,7 @@ if (! empty($lists))
36 46
       $status = 'Fehler bei der Erstellung';
37 47
     }
38 48
 
39
-    output("<tr><td{$style}><strong>{$list['listname']}</strong>@{$list['fqdn']}</td><td{$style}>{$list['admin']}</td><td>{$status}</td>");
49
+    output("<tr><td{$style}><strong>{$list['listname']}</strong>@{$list['fqdn']}</td><td{$style}>{$list['admin']}</td><td>{$status}</td><td style=\"text-align: right;\">{$sizestr}</td>");
40 50
     if ($list['status'] == 'running')
41 51
       output("<td>".internal_link('save', "<img src=\"{$prefix}images/delete.png\" />", "action=delete&id={$list['id']}")."</td></tr>\n");
42 52
     else
43 53