diff options
Diffstat (limited to 'modules/mm_html.py')
| -rw-r--r-- | modules/mm_html.py | 72 |
1 files changed, 46 insertions, 26 deletions
diff --git a/modules/mm_html.py b/modules/mm_html.py index 20cddd4e9..1a4ab1f2d 100644 --- a/modules/mm_html.py +++ b/modules/mm_html.py @@ -1,13 +1,13 @@ """Routines for presentation of list-specific HTML text.""" -__version__ = "$Revision: 422 $" +__version__ = "$Revision: 525 $" import os import regsub import string import mm_cfg, mm_utils -import htmlformat +from htmlformat import * class HTMLFormatter: def InitVars(self): @@ -15,23 +15,23 @@ class HTMLFormatter: self._internal_name) def GetMailmanFooter(self): - owners_html = htmlformat.Container() + owners_html = Container() for i in range(len(self.owner)): owner = self.owner[i] - owners_html.AddItem(htmlformat.Link('mailto:%s' % owner, owner)) + owners_html.AddItem(Link('mailto:%s' % owner, owner)) if i + 1 <> len(self.owner): owners_html.AddItem(', ') # Remove the .Format() when htmlformat conversion is done. - return htmlformat.Container( + return Container( '<hr>', - htmlformat.Address( - htmlformat.Container( + Address( + Container( 'List run by ', owners_html, '<p>', 'HTML generated by ', - htmlformat.Link( + Link( mm_cfg.MAILMAN_URL, "Mailman v %s" % mm_cfg.VERSION)))).Format() @@ -60,25 +60,26 @@ class HTMLFormatter: else: concealed = "" - def FormatOneUser(person, me=self, disdel=mm_cfg.DisableDelivery): - import htmlformat, os - id = mm_utils.ObscureEmail(person) + def FormatOneUser(person, me=self, + # Make some local refs for efficiency: + disdel=mm_cfg.DisableDelivery, + Link=Link, os=os, + ObscureEmail=mm_utils.ObscureEmail): + id = ObscureEmail(person) if me.obscure_addresses: - showing = mm_utils.ObscureEmail(person, for_text=1) + showing = ObscureEmail(person, for_text=1) else: showing = person - got = htmlformat.Link(os.path.join(me.GetScriptURL('options'), - id), showing) + got = Link(os.path.join(me.GetScriptURL('options'), + id), showing) if me.GetUserOption(person, disdel): - got = htmlformat.Italic("(", - got, - ")") + got = Italic("(", got, ")") return got items = map(FormatOneUser, people) # Just return the .Format() so this works until I finish # converting everything to htmlformat... return (concealed + - apply(htmlformat.UnorderedList, tuple(items)).Format()) + apply(UnorderedList, tuple(items)).Format()) def FormatOptionButton(self, type, value, user): @@ -105,6 +106,26 @@ class HTMLFormatter: checked = '' return '<input type=radio name="digest" value="1"%s>' % checked + def FormatDisabledNotice(self, user): + if self.GetUserOption(user, mm_cfg.DisableDelivery): + text = Center(Header(3, + "Note - your list delivery is currently" + " disabled.")).Format() + text = text + "\n" + text = text + ("You may have set non-delivery deliberately, or" + " it may have been triggered by bounces from your" + " delivery address. In either case, to reenable " + " delivery, change the ") + text = text + Link('#disable', + "Disable mail delivery").Format() + text = text + " option. Contact " + text = text + Link('mailto:' + self.GetAdminEmail(), + 'your list administrator').Format() + text = text + " if you have questions." + return text + else: + return "" + def FormatSubscriptionMsg(self): "Tailor to approval, roster privacy, and web vetting requirements." msg = "" @@ -168,10 +189,9 @@ class HTMLFormatter: else: text = text % "" text = (text - + htmlformat.TextBox('info', size=30).Format() + + TextBox('info', size=30).Format() + " " - + htmlformat.SubmitButton('UserOptions', - 'Edit Options').Format() + + SubmitButton('UserOptions', 'Edit Options').Format() + "</center>") if self.private_roster == 0: text = text + ("<p>... <b><i>or</i></b> select your entry from the" @@ -191,13 +211,13 @@ class HTMLFormatter: return self.RosterOption().Format() def RosterOption(self): "Provide avenue to subscribers roster, contingent to .private_roster." - container = htmlformat.Container() + container = Container() if not self.private_roster: container.AddItem("Click here for the list of " + self.real_name + " subscribers: ") - container.AddItem(htmlformat.SubmitButton('SubscriberRoster', - 'Visit Subscriber list')) + container.AddItem(SubmitButton('SubscriberRoster', + 'Visit Subscriber list')) else: if self.private_roster == 1: only = 'members' @@ -218,8 +238,8 @@ class HTMLFormatter: container.AddItem(" Password: " + self.FormatSecureBox('roster-pw') + " ") - container.AddItem(htmlformat.SubmitButton('SubscriberRoster', - 'Visit Subscriber List')) + container.AddItem(SubmitButton('SubscriberRoster', + 'Visit Subscriber List')) container.AddItem("</center>") return container |
