summaryrefslogtreecommitdiff
path: root/htc/dmled.htc
blob: 61929fab111f1e628f57158d7e0c120db7c83375 (plain)
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
118
119
120
121
122
123
124
125
126
127
128
\include{dml.htc}
\def{dmled.init}{xx}{
  %{listname}{address}
  \dml.init{\1}{\group}{\npwd}{\server\npwd};
  \reconst{dml.address}{\2};
  \sort{DML}{INDEX}{>}
}
\def{dmled.page}{}{
  \cond{T.find}{}
  \cond{T.msg}{0}
  \title{Database Mailing List (\dml.listname)}
  \db{DML}{
    \form{
      \table{width=100% bgcolor=#dddddd}{
        \tr{valign=top}{
          \td{
            <select name=dummy size=6>
            [tf:=\T.find];
            \query(
              (tf eq "" ||SUBJECT cntn tf||AUTHOR cntn tf||BODY cntn tf)&&
              (!PROTECT||\user.allow(\dml.group)(TIME))
            ){
              \option{\if(INDEX==\T.msg){ selected }}(INDEX){
                [INDEX] - \sub(SUBJECT){0}{30}
                \su(AUTHOR){\[\user.name\]}; (\time2htc(TIME))
                \if(count ATTACH){\[attach\]}
              }
            }
            </select>
          }
          \td{
            \button{View}<br>
            \button{Reply}<br>
            \button{New}
          }
        }
        \tr{valign=top}{
          \td{
            \input{find}{60}{\T.find}
          }
          \td{
            \button{Search}
          }
        }
      }            
    }
    \find.rec{\T.msg}{
      \if(!PROTECT||\user.allow(\dml.group)(TIME)){
        \table{width=100% bgcolor=#dddddd}{
          \tr{
            \th{align=left}{[INDEX] - [SUBJECT]}
            \td{align=right}{
              \find.rec(PARENT){
                \if(!PROTECT||\user.allow(\dml.group)(TIME)){
                  \bf{Prev:}
                  \href{\this?msg=[INDEX]}{[INDEX] - \sub(SUBJECT){0}{30}}
                  \su(AUTHOR){\[\user.name\]}
                }
              }
            }
          }
          \tr{
            \td{align=left}{
              \su(AUTHOR){
                \user.name \lt;\href{mailto:\user.email}{\user.email};\gt
              }
            }
            \td{align=right}{
              \time2htc(TIME)
            }
          }
          \tr{
            \td{align=left colspan=2}{
              \htmlize(BODY)
            }
          }
          \if(count ATTACH){
            \tr{
              \td{align=left colspan=2}{
                \forall{i}(ATTACH){
                  \href{\npwd/attach/[i]}(i)\n
                }
              }
            }
          }
          \tr{
            \td{align=left colspan=2}{
              [idx:=INDEX];
              \query(PARENT==idx&&(!PROTECT||\user.allow(\dml.group)(TIME))){
                \bf{Next:}
                \href{\this?msg=[INDEX]}{[INDEX] - [SUBJECT]}
                \su(AUTHOR){\[\user.name\]}
                <br>
              }
            }
          }
        }
      }
    }
  }
}
\def{dmled.onpost}{}{
  \switch{\T.cmd}
  {View}{
    \redirect{\server\this?msg=\T.dummy}
  }
  {Reply}{
    \redirect{\server\this}
    \db{DML}{
      \find.rec{\T.dummy}{
        \if(!PROTECT||\user.allow(\dml.group)(TIME)){
          \redirect{
            mailto:\dml.address?subject=Reply \dml.listname\[[INDEX]\] [SUBJECT]
          }
        }
      }
    }
  }
  {New}{
    [node:=\on.glob{T.dummy}{\T.dummy}{1}];
    \redirect{mailto:\dml.address?subject=New \dml.listname\[[node]\] (no subject)}
  }
  {
    \on.glob{T.find}{
      \redirect{\server\this?find=\encode{\T.find}}
    }
  }
}