source: products/qPloneComments/trunk/skins/qplonecomments/report_abuse.cpy @ 1221

Last change on this file since 1221 was 1187, checked in by liebster, 15 years ago

Merged revisions 1946-1951,1957-1962,1964-1965,1967-1970,1972-1986,1990-1993,2199-2200 via svnmerge from
http://svn.quintagroup.com/products/qPloneComments/branches/jcbrand-abuseFeature

........

r1946 | jcbrand | 2009-04-01 16:52:52 +0300 (Срд, 01 Апр 2009) | 3 lines


Add enable_report_abuse property to propertiestool.xml
Add checkbox for this property on the prefs_comments_setup_form.cpt

........

r1947 | jcbrand | 2009-04-01 17:29:20 +0300 (Срд, 01 Апр 2009) | 2 lines


Add report_abuse.pt containing the report_abuse form.

........

r1948 | jcbrand | 2009-04-01 17:30:35 +0300 (Срд, 01 Апр 2009) | 2 lines


Add utility method necesary for the report abuse form.

........

r1949 | jcbrand | 2009-04-01 17:31:05 +0300 (Срд, 01 Апр 2009) | 2 lines


Add the report abuse button and form (hidden).

........

r1950 | jcbrand | 2009-04-01 17:43:31 +0300 (Срд, 01 Апр 2009) | 1 line


Add qcomments.kss and register

........

r1951 | jcbrand | 2009-04-01 17:43:54 +0300 (Срд, 01 Апр 2009) | 1 line


Add qcomments.js and register

........

r1957 | jcbrand | 2009-04-02 12:52:54 +0300 (Чтв, 02 Апр 2009) | 2 lines


Add new mail action for the enable_report_abuse state.

........

r1958 | jcbrand | 2009-04-02 12:54:05 +0300 (Чтв, 02 Апр 2009) | 2 lines


Add a form and new hidden input containing 'comment_id'

........

r1959 | jcbrand | 2009-04-02 12:59:12 +0300 (Чтв, 02 Апр 2009) | 2 lines


Add CommentsKSS kss class and submit_abuse_report method.

........

r1960 | jcbrand | 2009-04-02 13:00:14 +0300 (Чтв, 02 Апр 2009) | 2 lines


Bugfix, preventDefault for all the forms.

........

r1961 | jcbrand | 2009-04-02 13:00:30 +0300 (Чтв, 02 Апр 2009) | 2 lines


remove comment_id passing.

........

r1962 | jcbrand | 2009-04-02 13:00:53 +0300 (Чтв, 02 Апр 2009) | 2 lines


get values from request if able.

........

r1964 | jcbrand | 2009-04-02 13:01:18 +0300 (Чтв, 02 Апр 2009) | 2 lines


Add comments.CommentsKSS

........

r1965 | jcbrand | 2009-04-02 13:01:39 +0300 (Чтв, 02 Апр 2009) | 2 lines


Include browser.

........

r1967 | jcbrand | 2009-04-02 14:26:07 +0300 (Чтв, 02 Апр 2009) | 1 line


Add email template for the report_abuse function

........

r1968 | jcbrand | 2009-04-02 14:26:41 +0300 (Чтв, 02 Апр 2009) | 2 lines


Use the new email template.

........

r1969 | jcbrand | 2009-04-02 14:29:41 +0300 (Чтв, 02 Апр 2009) | 3 lines


Register remove_abuse_report_form as a kss command.
Add new code to it that adds an optional html. (Used for status message)

........

r1970 | jcbrand | 2009-04-02 15:18:24 +0300 (Чтв, 02 Апр 2009) | 3 lines


Add form action.
Add place holder for abuse count info.

........

r1972 | jcbrand | 2009-04-02 16:08:42 +0300 (Чтв, 02 Апр 2009) | 2 lines


Add new portal_properties settings.

........

r1973 | jcbrand | 2009-04-02 19:39:27 +0300 (Чтв, 02 Апр 2009) | 1 line


Add controller python script for abuse reports

........

r1974 | jcbrand | 2009-04-02 19:39:55 +0300 (Чтв, 02 Апр 2009) | 1 line


Add validation script for abuse reporting

........

r1975 | jcbrand | 2009-04-02 19:40:43 +0300 (Чтв, 02 Апр 2009) | 1 line


Add template and metadata for rendering the report abuse form. Moved the macro form report_abuse.pt to this template

........

r1976 | jcbrand | 2009-04-02 19:41:22 +0300 (Чтв, 02 Апр 2009) | 1 line


remove old template

........

r1977 | jcbrand | 2009-04-02 19:41:52 +0300 (Чтв, 02 Апр 2009) | 3 lines


Fix form action.
Fix bug with form nesting.

........

r1978 | jcbrand | 2009-04-02 19:42:46 +0300 (Чтв, 02 Апр 2009) | 1 line


Add new utility methods. Use newly registered kss command

........

r1979 | jcbrand | 2009-04-02 19:43:20 +0300 (Чтв, 02 Апр 2009) | 2 lines


Bugfixes after the introduction of new portal_properties props.

........

r1980 | jcbrand | 2009-04-02 19:44:14 +0300 (Чтв, 02 Апр 2009) | 2 lines


Bugfixes

........

r1981 | jcbrand | 2009-04-02 19:44:31 +0300 (Чтв, 02 Апр 2009) | 2 lines


Register the remove_abuse_report_form kss action.

........

r1982 | jcbrand | 2009-04-03 11:41:32 +0300 (Птн, 03 Апр 2009) | 2 lines


Fix bug whereby emails were sent twice

........

r1983 | jcbrand | 2009-04-03 11:42:08 +0300 (Птн, 03 Апр 2009) | 1 line


Bugfixes related to anonymous comment adding

........

r1984 | jcbrand | 2009-04-03 11:59:44 +0300 (Птн, 03 Апр 2009) | 2 lines


Add macro for the captcha widget.

........

r1985 | jcbrand | 2009-04-03 12:00:22 +0300 (Птн, 03 Апр 2009) | 2 lines


Render a new captcha after hiding form.

........

r1986 | jcbrand | 2009-04-03 12:00:32 +0300 (Птн, 03 Апр 2009) | 2 lines


Change fade out time.

........

r1990 | jcbrand | 2009-04-03 13:37:13 +0300 (Птн, 03 Апр 2009) | 1 line


Add test suite

........

r1991 | jcbrand | 2009-04-03 13:37:38 +0300 (Птн, 03 Апр 2009) | 1 line


remove redundant line

........

r1992 | jcbrand | 2009-04-03 13:48:21 +0300 (Птн, 03 Апр 2009) | 1 line


bugfix

........

r1993 | jcbrand | 2009-04-03 13:56:51 +0300 (Птн, 03 Апр 2009) | 1 line


remove explicit microseconds

........

r2199 | jcbrand | 2009-07-25 02:07:58 +0300 (Сбт, 25 Июл 2009) | 1 line


Fixed a bug with syntax recognition of an older version of jquery

........

r2200 | jcbrand | 2009-07-25 02:08:58 +0300 (Сбт, 25 Июл 2009) | 1 line


Log email errors, so that the report abuse form still closes

........

File size: 2.8 KB
Line 
1## Script (Python) "report_abuse"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind state=state
7##bind subpath=traverse_subpath
8##parameters=message,text_format='plain',username=None,password=None
9##title=Reply to content
10
11from Products.PythonScripts.standard import url_quote_plus
12from Products.CMFCore.utils import getToolByName
13from Products.qPloneComments.utils import manage_mails
14from Products.CMFPlone import MessageFactory
15from Products.CMFPlone import PloneMessageFactory
16_ = MessageFactory('plonecomments')
17
18req = context.REQUEST
19mtool = getToolByName(context, 'portal_membership')
20dtool = getToolByName(context, 'portal_discussion')
21pp = getToolByName(context,'portal_properties')
22
23isForAnonymous = pp['qPloneComments'].getProperty('enable_anonymous_report_abuse', False)
24
25if username or password:
26    # The user username/password inputs on on the comment form were used,
27    # which might happen when anonymous commenting is enabled. If they typed
28    # something in to either of the inputs, we send them to 'logged_in'.
29    # 'logged_in' will redirect them back to this script if authentication
30    # succeeds with a query string which will post the message appropriately
31    # and show them the result.  if 'logged_in' fails, the user will be
32    # presented with the stock login failure page.  This all depends
33    # heavily on cookiecrumbler, but I believe that is a Plone requirement.
34    came_from = '%s?subject=%s&body_text=%s' % (req['URL'], subject, body_text)
35    came_from = url_quote_plus(came_from)
36    portal_url = context.portal_url()
37
38    return req.RESPONSE.redirect(
39        '%s/logged_in?__ac_name=%s'
40        '&__ac_password=%s'
41        '&came_from=%s' % (portal_url,
42                               url_quote_plus(username),
43                               url_quote_plus(password),
44                               came_from,
45                               )
46        )
47
48comment_creator = req.get('Creator', None)
49if isForAnonymous and comment_creator:
50    # Get entered anonymous name
51    comment_creator = comment_creator
52else:
53    member = mtool.getAuthenticatedMember()
54    comment_creator = member.getUserName()
55
56if mtool.isAnonymousUser():
57    email = req.get('email', '')
58else:
59    email = mtool.getAuthenticatedMember().getProperty('email')
60
61tb = dtool.getDiscussionFor(context)
62
63# Send notification e-mail
64manage_mails(context, context, 'report_abuse')
65
66# return to the discussable object.
67redirect_target = context.plone_utils.getDiscussionThread(tb)[0]
68view = redirect_target.getTypeInfo().getActionInfo('object/view',
69                                                   redirect_target)['url']
70
71portal_status_message=_(u'Your abuse report has been sent.')
72context.plone_utils.addPortalMessage(portal_status_message)
73target = '%s' % view
74return req.RESPONSE.redirect(target)
75
Note: See TracBrowser for help on using the repository browser.