aboutsummaryrefslogblamecommitdiff
path: root/plugins/base/public/message.html
blob: 38b41c5cb192cf21226b46affda7ff6049a60176 (plain) (tree)
1
2
3
4
5
6
7
8
9
                          
 
             
 
   


                                                                          
    
 
    




                                  
     
 

                                                                          






                                                                              

       

                                                                            
                                      

       
             

                                                                            














                                                                  

       
                      




                                                               

       
    


















                                                                          

     
                              




                                                              
                                                     
              
                                                         

             
                                                            
                 
                                                             








                                                             

       




                                                            
 
            

                                     
                                                                              
            

                                                                                   

           
           
        
                                         
                                                                       
       
 
                        
{{template "head.html" .}}

<h1>alps</h1>

<p>
  <a href="/mailbox/{{.Mailbox.Name | pathescape}}?page={{.MailboxPage}}">
    Back
  </a>
</p>

<h2>
  {{if .Message.Envelope.Subject}}
    {{.Message.Envelope.Subject}}
  {{else}}
    (No subject)
  {{end}}
</h2>

<form method="post" action="/message/{{.Mailbox.Name | pathescape}}/move">
  <input type="hidden" name="uids" value="{{.Message.Uid}}">
  <label for="move-to">Move to:</label>
  <select name="to" id="move-to">
    {{range .Mailboxes}}
      <option {{if eq .Name $.Mailbox.Name}}selected{{end}}>{{.Name}}</option>
    {{end}}
  </select>
  <input type="submit" value="Move">
</form>

<form method="post" action="/message/{{.Mailbox.Name | pathescape}}/delete">
  <input type="hidden" name="uids" value="{{.Message.Uid}}">
  <input type="submit" value="Delete">
</form>

{{if .Flags}}
  <form method="post" action="/message/{{.Mailbox.Name | pathescape}}/flag">
    <input type="hidden" name="uids" value="{{.Message.Uid}}">
    <p>Flags:</p>
    {{range $name, $has := .Flags}}
      {{if ismutableflag $name}}
        <input type="checkbox" name="flags" id="flag-{{$name}}"
          value="{{$name}}" {{if $has}}checked{{end}}>
        <label for="flag-{{$name}}">{{$name | formatflag}}</label>
        <br>
      {{else}}
        {{if $has}}
          <input type="hidden" name="flags" value="{{$name}}">
        {{end}}
      {{end}}
    {{end}}
    <input type="submit" value="Set flags">
  </form>
{{end}}

{{define "addr-list"}}
  {{range $i, $addr := .}}
    {{if $i}},{{end}}
    {{.PersonalName}}
    &lt;<a href="/compose?to={{.Address}}">{{.Address}}</a>&gt;
  {{end}}
{{end}}

<ul>
  <li>
    <strong>Date</strong>: {{.Message.Envelope.Date | formatdate}}
  </li>
  <li>
    <strong>From</strong>: {{template "addr-list" .Message.Envelope.From}}
  </li>
  <li>
    <strong>To</strong>: {{template "addr-list" .Message.Envelope.To}}
  </li>
  {{if .Message.Envelope.Cc}}
    <li>
      <strong>Cc</strong>: {{template "addr-list" .Message.Envelope.Cc}}
    </li>
  {{end}}
  {{if .Message.Envelope.Bcc}}
    <li>
      <strong>Bcc</strong>: {{template "addr-list" .Message.Envelope.Bcc}}
    </li>
  {{end}}
</ul>

{{define "message-part-tree"}}
  {{/* nested templates can't access the parent's context */}}
  {{$ = index . 0}}
  {{with index . 1}}
    <a
      {{if .IsText}}
        href="{{$.Message.URL}}?part={{.PathString}}"
      {{else}}
        href="{{$.Message.URL}}/raw?part={{.PathString}}"
      {{end}}
    >
      {{if eq $.Part.PathString .PathString}}<strong>{{end}}
      {{.String}}
      {{if eq $.Part.PathString .PathString}}</strong>{{end}}
    </a>
    {{if .Children}}
    <ul>
      {{range .Children}}
        <li>{{template "message-part-tree" (tuple $ .)}}</li>
      {{end}}
    </ul>
    {{end}}
  {{end}}
{{end}}

<p>Parts:</p>

{{template "message-part-tree" (tuple $ .Message.PartTree)}}

<hr>

{{if .View}}
  <p>
    {{if .Message.HasFlag "\\Draft"}}
      <a href="{{.Message.URL}}/edit?part={{.Part.PathString}}">Edit draft</a>
    {{else}}
      <a href="{{.Message.URL}}/reply?part={{.Part.PathString}}">Reply</a> &middot;
      <a href="{{.Message.URL}}/forward?part={{.Part.PathString}}">Forward</a>
    {{end}}
  </p>
  {{.View}}
{{else}}
  <p>Can't preview this message part.</p>
  <a href="{{.Message.URL}}/raw?part={{.Part.PathString}}">Download</a>
{{end}}

{{template "foot.html"}}