aboutsummaryrefslogtreecommitdiff
path: root/templates/admin_mailing_list.html
blob: 1b947b24be84e199634383bd2501774aa39ff617 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{{define "title"}}ML {{.MailingList.GetAttributeValue .MailingNameAttr}} |{{end}}

{{define "body"}}

<div class="d-flex">
  <h4>ML {{.MailingList.GetAttributeValue .MailingNameAttr}}
    <a class="ml-auto btn btn-sm btn-dark" href="/admin/ldap/{{.MailingList.DN}}">Vue avancée</a>
  </h4>
  <a class="ml-auto btn btn-dark" href="/admin/mailing">Liste des ML</a>
  <a class="ml-4 btn btn-info" href="/">Menu principal</a>
</div>

{{if .Success}}
  <div class="alert alert-success mt-2">Modification enregistrée.</div>
{{end}}
{{if .Error}}
  <div class="alert alert-danger mt-2">
    Impossible d'effectuer la modification.
    <div style="font-size: 0.8em">{{.Error}}</div>
  </div>
{{end}}

{{with $desc := .MailingList.GetAttributeValue "description"}}{{if $desc}}
  <p class="mt-4">{{$desc}}</p>
{{end}}{{end}}

<table class="table mt-4">
  <thead>
    <th scope="col">Adresse</th>
    <th scope="col">Nom</th>
    <th scope="col" style="width: 6em"></th>
  </thead>
  <tbody>
    {{with $root := .}}
      {{range $member := $root.Members}}
        <tr>
          <td>
            <a href="/admin/ldap/{{$member.DN}}">
              {{$member.GetAttributeValue "mail"}}
            </a>
          </td>
          <td>{{$member.GetAttributeValue "displayname"}}</td>
          <td>
            <form method="POST" onsubmit="return confirm('Supprimer de la ML ?');">
              <input type="hidden" name="action" value="delete-member" />
              <input type="hidden" name="member" value="{{.DN}}" />
              <input type="submit" value="Suppr" class="form-control btn btn-danger btn-sm" />
            </form>
          </td>
        </tr>
      {{end}}
    {{end}}
    {{if not .Members}}
      <tr><td>(aucun abonné)</td></tr>
    {{end}}
  </tbody>
</table>

<hr class="mt-4" />
<h5 class="mt-4">Ajouter un destinataire</h5>

<div class="container">
  <form method="POST">
    <input type="hidden" name="action" value="add-member" />
    <div class="row mt-4">
      <div class="col-md-3"><strong>Utilisateur existant :</strong> </div>
      <div class="col-md-5">
        <input class="form-control" type="text" list="users" name="member" placeholder="Utilisateur..." />
        <datalist id="users">
          {{range .PossibleNewMembers}}
            {{if .GetAttributeValue "mail"}}
              <option value="{{.DN}}">{{if .GetAttributeValue "displayname"}}{{.GetAttributeValue "displayname"}} ({{.GetAttributeValue "mail" }}){{else}}{{.GetAttributeValue "mail"}}{{end}}</option>
            {{end}}
          {{end}}
        </datalist>
      </div>
      <div class="col-md-2">
        <input type="submit" value="Ajouter" class="form-control btn btn-success btn-sm" />
      </div>
    </div>
  </form>

  {{if .AllowGuest}}
  <div class="row mt-4">
    <div class="col-md-10">OU</div>
  </div>

  <form method="POST">
    <input type="hidden" name="action" value="add-external" />
    <div class="row mt-4">
      <div class="col-md-3"><strong>E-mail :</strong></div>
      <div class="col-md-5">
        <input class="form-control" type="text"  name="mail" placeholder="machin@truc.net..." />
      </div>
      <div class="col-md-2">
      </div>
    </div>
    <div class="row mt-4">
      <div class="col-md-3"><strong>Nom (optionnel) :</strong></div>
      <div class="col-md-5">
        <input class="form-control" type="text"  name="displayname" placeholder="Machin Truc..." />
      </div>
      <div class="col-md-2">
        <input type="submit" value="Ajouter" class="form-control btn btn-success btn-sm" />
      </div>
    </div>
    <div class="row">
      <small class="form-text text-muted col-md-10">
        Si un utilisateur existe déjà avec l'email spécifiée, celui-ci sera ajouté à la liste.
        Sinon, un utilisateur invité sera créé.
      </small>
    </div>
  </form>
  {{end}}
</div>

{{end}}