Mercurial > moin > 1.9
changeset 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 | fe0263c5d64c |
files | MoinMoin/PageEditor.py MoinMoin/PageGraphicalEditor.py |
diffstat | 2 files changed, 43 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/PageEditor.py Sun Feb 03 20:37:01 2008 +0100 +++ b/MoinMoin/PageEditor.py Sun Feb 03 20:57:26 2008 +0100 @@ -399,6 +399,26 @@ <input type="hidden" name="editor" value="text"> ''' % (button_spellcheck, cancel_button_text, )) + # 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) + if self.cfg.mail_enabled: + request.write(''' +<script type="text/javascript"> + <!-- + function toggle_trivial(CheckedBox) + { + TrivialBoxes = document.getElementsByName("trivial"); + for (var i = 0; i < TrivialBoxes.length; i++) + TrivialBoxes[i].checked = CheckedBox.checked; + } + + document.write('<input type="checkbox" name="trivial" id="chktrivial" value="1" %(checked)s onclick="toggle_trivial(this)">'); + document.write('<label for="chktrivial">%(label)s</label>'); + //--> +</script> ''' % { + 'checked': ('', 'checked')[form.get('trivial', ['0'])[0] == '1'], + 'label': _("Trivial change", formatted=False), + }) + from MoinMoin.security.textcha import TextCha request.write(TextCha(request).render()) @@ -440,8 +460,11 @@ if self.cfg.mail_enabled: request.write(''' -<input type="checkbox" name="trivial" id="chktrivial" value="1" %(checked)s> -<label for="chktrivial">%(label)s</label> ''' % { + +<input type="checkbox" name="trivial" id="chktrivial" value="1" %(checked)s onclick="toggle_trivial(this)"> +<label for="chktrivial">%(label)s</label> + +''' % { 'checked': ('', 'checked')[form.get('trivial', ['0'])[0] == '1'], 'label': _("Trivial change"), })
--- a/MoinMoin/PageGraphicalEditor.py Sun Feb 03 20:37:01 2008 +0100 +++ b/MoinMoin/PageGraphicalEditor.py Sun Feb 03 20:57:26 2008 +0100 @@ -287,6 +287,23 @@ <input class="button" type="submit" name="button_cancel" value="%s"> <input type="hidden" name="editor" value="gui"> ''' % (button_spellcheck, cancel_button_text, )) + if self.cfg.mail_enabled: + request.write(''' +<script type="text/javascript"> + function toggle_trivial(CheckedBox) + { + TrivialBoxes = document.getElementsByName("trivial"); + for (var i = 0; i < TrivialBoxes.length; i++) + TrivialBoxes[i].checked = CheckedBox.checked; + } +</script> + +<input type="checkbox" name="trivial" id="chktrivial" value="1" %(checked)s onclick="toggle_trivial(this)"> +<label for="chktrivial">%(label)s</label> +''' % { + 'checked': ('', 'checked')[form.get('trivial', ['0'])[0] == '1'], + 'label': _("Trivial change", formatted=False), + }) from MoinMoin.security.textcha import TextCha request.write(TextCha(request).render()) @@ -361,7 +378,7 @@ if self.cfg.mail_enabled: request.write(''' -<input type="checkbox" name="trivial" id="chktrivial" value="1" %(checked)s> +<input type="checkbox" name="trivial" id="chktrivial" value="1" %(checked)s onclick="toggle_trivial(this)"> <label for="chktrivial">%(label)s</label> ''' % { 'checked': ('', 'checked')[form.get('trivial', ['0'])[0] == '1'], 'label': _("Trivial change"),