comparison MoinMoin/PageEditor.py @ 3035:b545446562a0

fix for MoinMoinBugs/TrivialChangeEasyAccess (thanks to Ninnu) (ported from 1.6)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 03 Feb 2008 20:57:26 +0100
parents d0d9fbc0f0ee
children 353739af70fa
comparison
equal deleted inserted replaced
3034:d0d9fbc0f0ee 3035:b545446562a0
397 %s 397 %s
398 <input class="button" type="submit" name="button_cancel" value="%s"> 398 <input class="button" type="submit" name="button_cancel" value="%s">
399 <input type="hidden" name="editor" value="text"> 399 <input type="hidden" name="editor" value="text">
400 ''' % (button_spellcheck, cancel_button_text, )) 400 ''' % (button_spellcheck, cancel_button_text, ))
401 401
402 # Trivial Change-checkbox to the top of the page, shows up only if user has JavaScript enabled. It's "linked" with the bottom's box (checking one checks both)
403 if self.cfg.mail_enabled:
404 request.write('''
405 <script type="text/javascript">
406 <!--
407 function toggle_trivial(CheckedBox)
408 {
409 TrivialBoxes = document.getElementsByName("trivial");
410 for (var i = 0; i < TrivialBoxes.length; i++)
411 TrivialBoxes[i].checked = CheckedBox.checked;
412 }
413
414 document.write('<input type="checkbox" name="trivial" id="chktrivial" value="1" %(checked)s onclick="toggle_trivial(this)">');
415 document.write('<label for="chktrivial">%(label)s</label>');
416 //-->
417 </script> ''' % {
418 'checked': ('', 'checked')[form.get('trivial', ['0'])[0] == '1'],
419 'label': _("Trivial change", formatted=False),
420 })
421
402 from MoinMoin.security.textcha import TextCha 422 from MoinMoin.security.textcha import TextCha
403 request.write(TextCha(request).render()) 423 request.write(TextCha(request).render())
404 424
405 # Add textarea with page text 425 # Add textarea with page text
406 self.sendconfirmleaving() 426 self.sendconfirmleaving()
438 }) 458 })
439 459
440 if self.cfg.mail_enabled: 460 if self.cfg.mail_enabled:
441 request.write(''' 461 request.write('''
442 &nbsp; 462 &nbsp;
443 <input type="checkbox" name="trivial" id="chktrivial" value="1" %(checked)s> 463
444 <label for="chktrivial">%(label)s</label> ''' % { 464 <input type="checkbox" name="trivial" id="chktrivial" value="1" %(checked)s onclick="toggle_trivial(this)">
465 <label for="chktrivial">%(label)s</label>
466
467 ''' % {
445 'checked': ('', 'checked')[form.get('trivial', ['0'])[0] == '1'], 468 'checked': ('', 'checked')[form.get('trivial', ['0'])[0] == '1'],
446 'label': _("Trivial change"), 469 'label': _("Trivial change"),
447 }) 470 })
448 471
449 request.write(''' 472 request.write('''