Redesign der Domain-Mail-Verwaltungs-Seite
Bernd Wurst

Bernd Wurst commited on 2014-12-17 10:10:29
Zeige 4 geänderte Dateien mit 44 Einfügungen und 18 Löschungen.

... ...
@@ -24,10 +24,19 @@ require_role(ROLE_SYSTEMUSER);
24 24
 
25 25
 check_form_token('vmail_domainchange');
26 26
 
27
-if (! $_POST['type'] || ! $_POST['id'])
28
-  system_failure("Unvollständige POST-Daten");
29
-
30
-change_domain($_POST['id'], $_POST['type']);
27
+foreach ($_POST as $key => $value) {
28
+  if (strpos($key, "option-") === 0) {
29
+    $id = substr($key, 7);
30
+    $type = 'virtual';
31
+    if ($value == 'manual') {
32
+      $type = 'auto';
33
+    } elseif ($value == 'off') {
34
+      $type = 'none';
35
+    }
36
+    DEBUG('change request for id #'.$id.' to '.$value);
37
+    change_domain($id, $type);
38
+  }
39
+}
31 40
 
32 41
 if (!$debugmode) {
33 42
   header('Location: domains');
... ...
@@ -1,4 +1,9 @@
1 1
 $(function() {
2
+  $(".buttonset input[type=submit]").remove();
2 3
   $(".buttonset").buttonset();
3 4
   $(".buttonset .disabled").buttonset("option", "disabled", true);
5
+  
6
+  $(".buttonset input").click( function() {
7
+    $(this).closest("form").submit();
8
+    });
4 9
   });
... ...
@@ -48,39 +48,51 @@ $odd = true;
48 48
 foreach ($domains AS $id => $dom) {
49 49
   $odd = !$odd;
50 50
   $trextra = ($odd ? ' class="odd"' : ' class="even"');
51
-  $extra = '';
52 51
   $edit_disabled = false;
53
-  $type = maildomain_type($dom['type']);
54
-  $edit = html_form('vmail_domainchange', 'domainchange', '', html_select('type', array('virtual' => 'Webinterface-Verwaltung', 'auto' => '.courier-Dateien', 'none' => 'keine E-Mails empfangen'), $dom['type']).' <input type="hidden" name="id" value="'.$id.'" /><input type="submit" value="ändern" />');
52
+  $notice = '';
55 53
   if ($dom['type'] == 'manual') {
56 54
     $edit_disabled = true;
57
-    $edit = 'Kann nur von Admins geändert werden';
55
+    $notice = 'Kann nur von Admins geändert werden';
58 56
   }
59 57
   if (domain_has_vmail_accounts($id)) {
60 58
     $edit_disabled = true;
61
-    $edit = 'Keine Änderung möglich, so lange noch '.internal_link("vmail", "E-Mail-Konten").' für diese Domain eingerichtet sind.';
59
+    $notice = 'Keine Änderung möglich, so lange noch '.internal_link("vmail", "E-Mail-Konten").' für diese Domain eingerichtet sind.';
62 60
   }
63 61
   if ($dom['mailserver_lock']) {
64 62
     $trextra .= ' style="background-color: #faa;"';
65
-    $extra = '<strong>Mailserver-Sperre aktiv!</strong>';
63
+    $notice .= ' <strong>Mailserver-Sperre aktiv!</strong>';
66 64
   }
67 65
   $check_off = ($dom['type'] == 'none' ? ' checked="checked"' : '');
68 66
   $check_webinterface = ($dom['type'] == 'virtual' ? ' checked="checked"' : '');
69 67
   $check_manual = ($dom['type'] == 'auto' || $dom['type'] == 'manual' ? ' checked="checked"' : '');
70 68
   
71 69
   $buttons = '<span class="buttonset'.($edit_disabled ? ' disabled':'').'" id="buttonset-'.$id.'">
72
-         <input type="radio" name="option-'.$id.'" id="option-'.$id.'-off" value="off"'.$check_off.' '.($edit_disabled ? ' disabled="disabled"':'').'/>
73
-         <label for="option-'.$id.'-off">Ausgeschaltet</label>
74 70
          <input type="radio" name="option-'.$id.'" id="option-'.$id.'-webinterface" value="webinterface"'.$check_webinterface.' '.($edit_disabled ? ' disabled="disabled"':'').'/>
75 71
          <label for="option-'.$id.'-webinterface">Webinterface</label>
76 72
          <input type="radio" name="option-'.$id.'" id="option-'.$id.'-manual" value="manual"'.$check_manual.' '.($edit_disabled ? ' disabled="disabled"':'').'/>
77 73
          <label for="option-'.$id.'-manual">Manuell</label>
74
+         <input type="radio" name="option-'.$id.'" id="option-'.$id.'-off" value="off"'.$check_off.' '.($edit_disabled ? ' disabled="disabled"':'').'/>
75
+         <label for="option-'.$id.'-off">Ausgeschaltet</label>
76
+         <input type="submit" value="Speichern" />
78 77
       </span>';
79
-  output("<tr{$trextra}><td>{$dom['name']}</td><td>$buttons</td><td>{$type}</td><td>{$edit}</td><td style=\"border: none;\">{$extra}</td></tr>\n");
78
+  output("<tr{$trextra}><td>{$dom['name']}</td><td>".html_form('vmail_domainchange', 'domainchange', '', $buttons)."</td><td>{$notice}</td></tr>\n");
80 79
   if (array_key_exists($id, $subdomains)) {
81 80
     foreach ($subdomains[$id] AS $subdom) {
82
-      $type = maildomain_type($subdom['type']);
83
-      output("<tr><td>{$subdom['name']}.{$dom['name']}</td><td>{$type}</td><td>Subdomains können nur von Admins geändert werden!</td></tr>\n");
81
+      $odd = !$odd;
82
+      $trextra = ($odd ? ' class="odd"' : ' class="even"');
83
+      $edit_disabled = true;
84
+      $check_webinterface = ($subdom['type'] == 'virtual' ? ' checked="checked"' : '');
85
+      $check_manual = ($subdom['type'] == 'auto' || $subdom['type'] == 'manual' ? ' checked="checked"' : '');
86
+      $id = $id.'-'.$subdom['name'];
87
+      $buttons = '<span class="buttonset'.($edit_disabled ? ' disabled':'').'" id="buttonset-'.$id.'">
88
+         <input type="radio" name="option-'.$id.'" id="option-'.$id.'-webinterface" value="webinterface"'.$check_webinterface.' '.($edit_disabled ? ' disabled="disabled"':'').'/>
89
+         <label for="option-'.$id.'-webinterface">Webinterface</label>
90
+         <input type="radio" name="option-'.$id.'" id="option-'.$id.'-manual" value="manual"'.$check_manual.' '.($edit_disabled ? ' disabled="disabled"':'').'/>
91
+         <label for="option-'.$id.'-manual">Manuell</label>
92
+         <input type="radio" name="option-'.$id.'" id="option-'.$id.'-off" value="off"'.($edit_disabled ? ' disabled="disabled"':'').'/>
93
+         <label for="option-'.$id.'-off">Ausgeschaltet</label>
94
+      </span>';
95
+      output("<tr{$trextra}><td>{$subdom['name']}.{$dom['name']}</td><td>{$buttons}</td><td>Subdomains können nur von Admins geändert werden!</td></tr>\n");
84 96
     }
85 97
   }
86 98
 }
... ...
@@ -377,7 +377,7 @@ tr.unpaid td {
377 377
 }
378 378
 
379 379
 .ui-button {
380
-  border: 1px solid #000;
380
+  border: 1px solid #425d6c;
381 381
   background-color: #fff;
382 382
   color: #000;
383 383
 }
... ...
@@ -385,7 +385,7 @@ tr.unpaid td {
385 385
 .ui-state-active,
386 386
 .ui-widget-content .ui-state-active,
387 387
 .ui-widget-header .ui-state-active {
388
-  border: 1px solid #000;
389
-  background: #000;
388
+  border: 1px solid #425d6c;
389
+  background: #425d6c;
390 390
   color: #fff;
391 391
 }
392 392