1.1 --- a/actions/ApproveChanges.py Sun Oct 16 17:57:55 2011 +0200
1.2 +++ b/actions/ApproveChanges.py Sun Oct 16 19:18:44 2011 +0200
1.3 @@ -71,7 +71,12 @@
1.4 current_rev = target_page.current_rev()
1.5 parent_rev = int(directives.get("parent-revision", current_rev))
1.6
1.7 + # Get the user who submitted the changes.
1.8 +
1.9 + username = directives.get("unapproved-user")
1.10 +
1.11 d = {
1.12 + "approval_label" : escape(_("Make %s an approved user") % username),
1.13 "buttons_html" : buttons_html,
1.14 "prompt" : escape(_("Approve the displayed page version?")),
1.15 "rev" : escattr(rev),
1.16 @@ -92,6 +97,12 @@
1.17 <td><em>%(notice)s</em></td>
1.18 </tr>''' % d
1.19
1.20 + if username and not user_is_approved(request, username):
1.21 + html += '''
1.22 + <tr>
1.23 + <td><input name="approve" type="checkbox" value="true" /> %(approval_label)s</td>
1.24 + </tr>''' % d
1.25 +
1.26 html += '''
1.27 <tr>
1.28 <td class="buttons">
1.29 @@ -112,6 +123,7 @@
1.30
1.31 _ = self._
1.32 request = self.request
1.33 + form = get_form(request)
1.34
1.35 # Make sure that only suitably privileged users can perform this action.
1.36
1.37 @@ -144,6 +156,15 @@
1.38 current_rev = target_page.current_rev()
1.39 parent_rev = int(directives.get("parent-revision", current_rev))
1.40
1.41 + # Get the user who submitted the changes.
1.42 +
1.43 + username = directives.get("unapproved-user")
1.44 +
1.45 + # Approve the user if requested, regardless of what happens below.
1.46 +
1.47 + if username and form.get("approve", ["false"])[0] == "true":
1.48 + add_to_group_page(request, username, get_approved_editors_group(request))
1.49 +
1.50 # Where the parent revision differs from the current revision of the
1.51 # page, attempt to merge the changes.
1.52
1.53 @@ -187,7 +208,6 @@
1.54
1.55 # Switch user if a specific user was recorded.
1.56
1.57 - username = directives.get("unapproved-user")
1.58 if username:
1.59 new_user = get_user(request, username)
1.60 else: