From 9a57dab223a28c4bcba905ab5ad22da10dfcd59f Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Sat, 23 Feb 2002 05:53:39 +0000 Subject: addError(): New method added to class Document, which is essentially a replacement for the function in the admin.py module. This makes it much easier for gui component HandleForm() methods to add an error or warning to the admin page. TextArea.__init__(): Add a `readonly' argument, which translates to the TEXTAREA tag getting a READONLY attribute. We'll use this to turn the header and body excerpt text boxes in the admindb pages to read-only (avoiding the common misperception that you can edit the message before it's approved). --- Mailman/htmlformat.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'Mailman/htmlformat.py') diff --git a/Mailman/htmlformat.py b/Mailman/htmlformat.py index ab6dcdebd..c4db6a468 100644 --- a/Mailman/htmlformat.py +++ b/Mailman/htmlformat.py @@ -334,10 +334,19 @@ class Document(Container): output.append('%s' % tab) return NL.join(output) + def addError(self, errmsg, tag=None, *args): + if tag is None: + tag = _('Warning: ') + self.AddItem(Header(3, Bold(FontAttr( + _(tag), color=mm_cfg.WEB_ERROR_COLOR, size='+2')).Format() + + Italic(errmsg % args).Format())) + + class HeadlessDocument(Document): """Document without head section, for templates that provide their own.""" suppress_head = 1 + class StdContainer(Container): def Format(self, indent=0): # If I don't start a new I ignore indent @@ -446,22 +455,26 @@ class Hidden(InputObj): InputObj.__init__(self, name, 'HIDDEN', value, checked=0) class TextArea: - def __init__(self, name, text='', rows=None, cols=None, wrap='soft'): + def __init__(self, name, text='', rows=None, cols=None, wrap='soft', + readonly=0): self.name = name self.text = text self.rows = rows self.cols = cols self.wrap = wrap + self.readonly = readonly def Format(self, indent=0): output = '' % self.text + output += ' WRAP=%s' % self.wrap + if self.readonly: + output += ' READONLY' + output += '>%s' % self.text return output class FileUpload(InputObj): -- cgit v1.2.3-70-g09d2