diff --git a/backend/00-router.go b/backend/00-router.go index 4453680..3fcacd9 100644 --- a/backend/00-router.go +++ b/backend/00-router.go @@ -59,9 +59,9 @@ func renderShell(w http.ResponseWriter, active, readingPane string) { fmt.Fprintf(w, ` Mail-Graveyard - + - +
@@ -216,9 +216,9 @@ func emailBoxHandler(w http.ResponseWriter, r *http.Request) { kind := strings.TrimPrefix(r.URL.Path, "/boxes/") switch kind { case "source": - renderEmailBoxPage(w, "source", "Quell-Postfach", uniqueAccountValues(accounts, "source")) + renderSourceEmailBoxPage(w, accounts) case "target": - renderEmailBoxPage(w, "target", "Ziel-Postfach", uniqueAccountValues(accounts, "target")) + renderTargetEmailBoxPage(w, accounts) default: http.Redirect(w, r, "/view", http.StatusSeeOther) } @@ -331,9 +331,9 @@ func renderAccountsPage(w http.ResponseWriter, accounts []Account, edit Account, fmt.Fprintf(w, ` Konten-Verwaltung - Mail-Graveyard - + - +
@@ -375,9 +375,9 @@ func renderArchivesPage(w http.ResponseWriter, archives []string, accounts []Acc fmt.Fprintf(w, ` Archiv-mbox Verwaltung - Mail-Graveyard - + - +
@@ -442,9 +442,9 @@ func renderTransferPage(w http.ResponseWriter, mode transferMode, accounts []Acc fmt.Fprintf(w, ` %s - Mail-Graveyard - + - +
@@ -477,14 +477,14 @@ func renderTransferPage(w http.ResponseWriter, mode transferMode, accounts []Acc html.EscapeString(mode.RightTitle), renderTransferPicker(mode.RightKind, accounts, archives)) } -func renderEmailBoxPage(w http.ResponseWriter, active, title string, values []string) { +func renderSourceEmailBoxPage(w http.ResponseWriter, accounts []Account) { w.Header().Set("Content-Type", "text/html; charset=utf-8") fmt.Fprintf(w, ` -%s - Mail-Graveyard - +Quell-Postfach - Mail-Graveyard + - +
@@ -507,30 +507,124 @@ func renderEmailBoxPage(w http.ResponseWriter, active, title string, values []st Einstellungen -
-
-
%s
%s
-
Status
-
-
+
bereit
`, - html.EscapeString(title), renderRibbonEmailBoxMenu(active), renderRibbonTransferMenu(""), - html.EscapeString(title), renderEmailBoxList(values)) + renderRibbonEmailBoxMenu("source"), renderRibbonTransferMenu(""), renderEmailBoxSourcePane(accounts)) } -func renderEmailBoxList(values []string) string { - if len(values) == 0 { - return `
Keine Postfaecher eingetragen.
` - } +func renderTargetEmailBoxPage(w http.ResponseWriter, accounts []Account) { + w.Header().Set("Content-Type", "text/html; charset=utf-8") + fmt.Fprintf(w, ` + +Ziel-Postfach - Mail-Graveyard + + + + +
+ + +
Mail-Graveyard
+
+ + + +
bereit
`, + renderRibbonEmailBoxMenu("target"), renderRibbonTransferMenu(""), renderEmailBoxTargetPane(accounts)) +} + +func renderEmailBoxSourcePane(accounts []Account) string { var b strings.Builder - b.WriteString(``) return b.String() } +func renderEmailBoxTargetPane(accounts []Account) string { + var b strings.Builder + b.WriteString(`
Ziel-Postfach
`) + if len(targets) == 0 { + b.WriteString(`
Keine Ziel-Postfaecher eingetragen.
`) + return b.String() + } + for _, target := range targets { + fmt.Fprintf(&b, ``, html.EscapeString(target)) + } + return b.String() +} + +func accountsBySource(accounts []Account) []Account { + out := append([]Account{}, accounts...) + for i := 0; i < len(out); i++ { + for j := i + 1; j < len(out); j++ { + left := strings.ToLower(out[i].SrcUser) + right := strings.ToLower(out[j].SrcUser) + if right < left { + out[i], out[j] = out[j], out[i] + } + } + } + return out +} + +func accountProto(a Account) string { + if strings.TrimSpace(a.SrcProto) != "" { + return a.SrcProto + } + return "imap" +} + func transferMenuItems(active string) string { items := []transferMode{ {Slug: "postfach-archiv", Title: "Postfach <--> Archiv-MBox"}, diff --git a/frontend-js/dist/style.css b/frontend-js/dist/style.css index 9a9a4bf..c176fac 100644 --- a/frontend-js/dist/style.css +++ b/frontend-js/dist/style.css @@ -408,6 +408,16 @@ a.tree-node { display: block; color: inherit; text-decoration: none; } .email-box-page { background: #fff; } +.email-box-view { + grid-template-columns: 220px 6px 340px 6px minmax(300px, 1fr); +} +.email-box-target-view { + grid-template-columns: minmax(300px, 1fr) 6px minmax(340px, 1fr) 6px 260px; +} +.email-box-target-view .pane-tree { + border-right: 0; + border-left: 1px solid var(--ol-border); +} .archive-page-layout { display: grid; grid-template-columns: minmax(520px, 1fr) minmax(360px, 460px);