179
if cgidata.keys() and not cgidata.has_key('langform'):
174
ChangeHTML(mlist, cgidata, template_name, doc)
181
ChangeHTML(mlist, cgidata, template_name, doc, lang=language)
177
184
_('The form lifetime has expired. (request forgery check)'))
178
FormatHTML(mlist, doc, template_name, template_info)
185
FormatHTML(mlist, doc, template_name, template_info, lang=language)
180
187
doc.AddItem(mlist.GetMailmanFooter())
181
188
print doc.Format()
185
def FormatHTML(mlist, doc, template_name, template_info):
192
def FormatHTML(mlist, doc, template_name, template_info, lang=None):
193
if lang not in mlist.GetAvailableLanguages():
194
lang = mlist.preferred_language
195
lcset = Utils.GetCharSet(lang)
186
196
doc.AddItem(Header(1,'%s:' % mlist.real_name))
187
197
doc.AddItem(Header(1, template_info))
188
198
doc.AddItem('<hr>')
190
200
link = Link(mlist.GetScriptURL('admin'),
191
201
_('View or edit the list configuration information.'))
202
backlink = Link(mlist.GetScriptURL('edithtml'),
203
_('Edit the public HTML pages and text files'))
193
205
doc.AddItem(FontSize("+1", link))
207
doc.AddItem(FontSize("+1", backlink))
194
208
doc.AddItem('<p>')
195
209
doc.AddItem('<hr>')
210
if len(mlist.GetAvailableLanguages()) > 1:
211
langform = Form(mlist.GetScriptURL('edithtml') + '/' + template_name,
212
mlist=mlist, contexts=AUTH_CONTEXTS)
214
mlist.FormatButton('editlang-button',
215
text = _("Edit this template for")))
216
langform.AddItem(mlist.GetLangSelectBox(lang))
217
langform.AddItem(Hidden('langform', 'True'))
218
doc.AddItem(langform)
196
220
form = Form(mlist.GetScriptURL('edithtml') + '/' + template_name,
197
221
mlist=mlist, contexts=AUTH_CONTEXTS)
198
text = Utils.maketext(template_name, raw=1, mlist=mlist)
222
text = Utils.maketext(template_name, raw=1, lang=lang, mlist=mlist)
199
223
# MAS: Don't websafe twice. TextArea does it.
200
224
form.AddItem(TextArea('html_code', text, rows=40, cols=75))
201
225
form.AddItem('<p>' + _('When you are done making changes...'))
226
if lang != mlist.preferred_language:
227
form.AddItem(Hidden('language', lang))
202
228
form.AddItem(SubmitButton('submit', _('Submit Changes')))
203
229
doc.AddItem(form)
207
def ChangeHTML(mlist, cgi_info, template_name, doc):
233
def ChangeHTML(mlist, cgi_info, template_name, doc, lang=None):
234
if lang not in mlist.GetAvailableLanguages():
235
lang = mlist.preferred_language
208
236
if not cgi_info.has_key('html_code'):
209
237
doc.AddItem(Header(3,_("Can't have empty html page.")))
210
238
doc.AddItem(Header(3,_("HTML Unchanged.")))