summaryrefslogtreecommitdiff
path: root/cgi/listinfo
blob: e8acf0113ebee216f363d6abb860e708a91e04d7 (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
#!/usr/local/bin/python
# We don't need to lock in this script, because we're never going to change data.

import sys, os, string
from regsub import gsub
sys.path.append('/home/mailman/mailman/modules')
import mm_utils, maillist, htmlformat

doc = htmlformat.Document()

path = os.environ['PATH_INFO']

list_info = mm_utils.GetPathPieces(path)

if len(list_info) < 1:
    doc.AddItem(htmlformat.Header(2, "Invalid options to CGI script."))
    print doc.Format()
    sys.exit(0)

list_name = string.lower(list_info[0])

try:
  list = maillist.MailList(list_name)
except:
  doc.AddItem(htmlformat.Header(2, "%s: No such list."  % list_name ))
  print doc.Format()
  sys.exit(0)

if not list._ready:
    doc.AddItem(htmlformat.Header(2, "%s: No such list." % list_name))
    print doc.Format()
    sys.exit(0)

replacements = list.GetStandardReplacements()


if not list.digestable or not list.nondigestable:
    replacements['<mm-digest-radio-button>'] = ""
    replacements['<mm-undigest-radio-button>'] = ""
else:
    replacements['<mm-digest-radio-button>'] = list.FormatDigestButton()
    replacements['<mm-undigest-radio-button>'] = list.FormatUndigestButton()
replacements['<mm-subscribe-box>'] = list.FormatBox('email')
replacements['<mm-subscribe-button>'] = list.FormatButton('email-button')
replacements['<mm-new-password-box>'] = list.FormatSecureBox('pw')
replacements['<mm-confirm-password>'] = list.FormatSecureBox('pw-conf')
replacements['<mm-form-start>'] = list.FormatFormStart('subscribe')
replacements['<mm-change-info>'] = htmlformat.TextBox('info', size=40).Format()
replacements['<mm-info-button>'] = htmlformat.SubmitButton('submitinfo', 
	                                                    'Submit').Format()

doc.AddItem(list.ParseTags('listinfo.html', replacements))
print doc.Format()