diff options
| -rw-r--r-- | Mailman/Cgi/listinfo.py | 10 | ||||
| -rw-r--r-- | Mailman/Cgi/options.py | 24 | ||||
| -rw-r--r-- | Mailman/HTMLFormatter.py | 8 |
3 files changed, 28 insertions, 14 deletions
diff --git a/Mailman/Cgi/listinfo.py b/Mailman/Cgi/listinfo.py index f00fd9bf1..e64693a55 100644 --- a/Mailman/Cgi/listinfo.py +++ b/Mailman/Cgi/listinfo.py @@ -181,8 +181,14 @@ def list_listinfo(mlist, lang): replacements['<mm-editing-options>'] = mlist.FormatEditingOption(lang) replacements['<mm-info-button>'] = SubmitButton('UserOptions', _('Edit Options')).Format() - replacements['<mm-displang-box>'] = mlist.FormatButton('displang-button', - text = _("View this page in")) + # If only one language is enabled for this mailing list, omit the choice + # buttons. + if len(mlist.GetAvailableLanguages()) == 1: + displang = '' + else: + displang = mlist.FormatButton('displang-button', + text = _("View this page in")) + replacements['<mm-displang-box>'] = displang replacements['<mm-lang-form-start>'] = mlist.FormatFormStart('listinfo') replacements['<mm-fullname-box>'] = mlist.FormatBox('fullname', size=30) diff --git a/Mailman/Cgi/options.py b/Mailman/Cgi/options.py index 919cc02b8..72011be25 100644 --- a/Mailman/Cgi/options.py +++ b/Mailman/Cgi/options.py @@ -88,7 +88,11 @@ def main(): if lenparts < 2: user = cgidata.getvalue('email') if not user: - doc.addError(_('No address given')) + # If we're coming from the listinfo page and we left the email + # address field blank, it's not an error. listinfo.html names the + # button UserOptions; we can use that as the descriminator. + if not cgidata.getvalue('UserOptions'): + doc.addError(_('No address given')) loginpage(mlist, doc, None, cgidata) print doc.Format() return @@ -727,13 +731,17 @@ def loginpage(mlist, doc, user, cgidata): # We use a subtable here so we can put a language selection box in lang = cgidata.getvalue('language', mlist.preferred_language) table = Table(width='100%', border=0, cellspacing=4, cellpadding=5) - langform = Form(actionurl) - langform.AddItem(SubmitButton('displang-button', _('View this page in'))) - langform.AddItem(mlist.GetLangSelectBox(lang)) + # If only one language is enabled for this mailing list, omit the choice + # buttons. table.AddRow([Center(Header(2, title))]) table.AddCellInfo(table.GetCurrentRowIndex(), 0, bgcolor=mm_cfg.WEB_HEADER_COLOR) - table.AddRow([Center(langform)]) + if len(mlist.GetAvailableLanguages()) > 1: + langform = Form(actionurl) + langform.AddItem(SubmitButton('displang-button', + _('View this page in'))) + langform.AddItem(mlist.GetLangSelectBox(lang)) + table.AddRow([Center(langform)]) doc.AddItem(table) # Preamble # Set up the login page @@ -749,12 +757,6 @@ def loginpage(mlist, doc, user, cgidata): <p><strong><em>Important:</em></strong> From this point on, you must have cookies enabled in your browser, otherwise none of your changes will take effect. - - <p>Session cookies are used in Mailman's membership options interface so - that you don't need to re-authenticate with every operation. This cookie - will expire automatically when you exit your browser, or you can - explicitly expire the cookie by hitting the <em>Logout</em> link (which - you'll see once you successfully log in). """)]) # Password and login button ptable = Table(width='50%', border=0, cellspacing=4, cellpadding=5) diff --git a/Mailman/HTMLFormatter.py b/Mailman/HTMLFormatter.py index 4d9caa053..cf689aff3 100644 --- a/Mailman/HTMLFormatter.py +++ b/Mailman/HTMLFormatter.py @@ -357,6 +357,12 @@ class HTMLFormatter: def GetStandardReplacements(self, lang=None): dmember_len = len(self.getDigestMemberKeys()) member_len = len(self.getRegularMemberKeys()) + # If only one language is enabled for this mailing list, omit the + # language choice buttons. + if len(self.GetAvailableLanguages()) == 1: + listlangs = '' + else: + listlangs = self.GetLangSelectBox(lang).Format() return { '<mm-favicon>' : mm_cfg.IMAGE_LOGOS + mm_cfg.SHORTCUT_ICON, '<mm-mailman-footer>' : self.GetMailmanFooter(), @@ -379,7 +385,7 @@ class HTMLFormatter: '<mm-owner>' : self.GetAdminEmail(), '<mm-reminder>' : self.FormatReminder(self.preferred_language), '<mm-host>' : self.host_name, - '<mm-list-langs>' : self.GetLangSelectBox(lang).Format(), + '<mm-list-langs>' : listlangs, } def GetAllReplacements(self, lang=None): |
