Neue Oberfläche für VMail-Account-Übersicht
bernd

bernd commited on 2008-02-21 09:37:03
Zeige 1 geänderte Dateien mit 61 Einfügungen und 10 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@959 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -6,22 +6,73 @@ require_role(ROLE_SYSTEMUSER);
6 6
 
7 7
 require_once('vmail.php');
8 8
 
9
-$accounts = get_vmail_accounts();
9
+$domains = get_vmail_domains();
10
+$all_accounts = get_vmail_accounts();
11
+
12
+$sorted_by_domains = array();
13
+foreach ($all_accounts AS $account)
14
+{
15
+  if (array_key_exists($account['domain'], $sorted_by_domains))
16
+    array_push($sorted_by_domains[$account['domain']], $account);
17
+  else
18
+    $sorted_by_domains[$account['domain']] = array($account);
19
+}
20
+
21
+DEBUG($sorted_by_domains);
10 22
 
11 23
 output('<h3>E-Mail-Accounts</h3>
12 24
 <p>Folgende E-Mail-Konten sind eingerichtet:</p>
13
-<table style="margin-bottom: 1em;">
14
-<tr><th>Adresse</th><th>...</th><th>&#160;</th></tr>
15 25
 ');
16
-
17
-        foreach ($accounts as $account)
26
+        foreach ($sorted_by_domains as $accounts_on_domain)
27
+        {
28
+	    output('<h4>'.$accounts_on_domain[0]['domainname'].'</h4>');
29
+	    foreach ($accounts_on_domain AS $this_account)
30
+	    {
31
+	      $acc = get_account_details($this_account['id']);
32
+	      $actions = array();
33
+	      DEBUG($acc);
34
+	      if ($acc['password'] != '')
35
+	      {
36
+	      	$spam = 'ohne Spamfilter';
37
+	        switch ($acc['spamfilter'])
38
+	  	{
39
+		        case 'folder':  $spam = 'Spam in Unterordner';
40
+					break;
41
+			case 'tag':	$spam = 'Spam markieren';
42
+					break;
43
+			case 'delete':	$spam = 'Spam nicht zustellen';
44
+					break;
45
+	        }
46
+	        array_push($actions, "Ablegen in Mailbox ({$spam})");
47
+	      }
48
+	      foreach ($acc['forwards'] AS $fwd)
49
+	      {
50
+	      	$spam = 'ohne Spamfilter';
51
+	        switch ($acc['spamfilter'])
18 52
 	  	{
19
-            output('<tr>
20
-            <td>'.internal_link('edit.php', $account['local'].'@'.$account['domainname'], 'id='.$account['id']).'</td>
21
-            <td><a href="save.php?action=delete&amp;id='.$account['id'].'">löschen</a></td></tr>');
53
+			case 'tag':	$spam = 'Spam markieren';
54
+					break;
55
+			case 'delete':	$spam = 'Spam nicht zustellen';
56
+					break;
57
+	        }
58
+		$fwd['destination'] = filter_input_general($fwd['destination']);
59
+	        array_push($actions, "Weiterleitung an <strong>{$fwd['destination']}</strong> ({$spam})");
60
+	      }
61
+	      $dest = '';
62
+	      if (count($actions) > 0)
63
+	      {
64
+	        $dest = "<ul>";
65
+		foreach ($actions as $a)
66
+		  $dest .= "<li>{$a}</li>";
67
+		$dest .= '</ul>';
68
+	      }
69
+              output('
70
+              <div style="margin-left: 2em;"><p>'.internal_link('edit.php', $acc['local'].'@'.$this_account['domainname'], 'id='.$acc['id']).' <a href="save.php?action=delete&amp;id='.$acc['id'].'"><img src="'.$prefix.'images/delete.png" alt="löschen" title="Dieses Konto löschen"/></a></p>
71
+	      <p>'.$dest.'</p></div>');
72
+	    }
73
+
22 74
         }
23
-        output('</table>
24
-<p><a href="edit.php">Neuen Account anlegen</a></p>');
75
+output('<p><a href="edit.php">Neuen Account anlegen</a></p>');
25 76
 
26 77
 /* FIXME: Das sollte nur kommen, wenn der IMAP/POP3-Menü-Eintrag nicht da ist */
27 78
 output('<p>Hinweis: schokokeks.org bietet für fortgeschrittene Nutzer die manuelle Einrichtung von POP3/IMAP-Accounts.<br/><a href="'.$prefix.'go/imap/accounts.php?action=create">Neuen POP3/IMAP-Account anlegen</a></p>');
28 79