Changeset 631

Show
Ignore:
Timestamp:
11/17/06 09:57:27
Author:
crchemist
Message:

Added qPloneCaptchas support.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qPloneComments/trunk/skins/qplonecomments/2.1/discussion_reply_form.cpt

    r630 r631  
    1414                 thread python:putils.getDiscussionThread(here); 
    1515                 discussable python:thread[0]; 
    16                  replies python:thread[1:]"> 
     16                 replies python:thread[1:]; 
     17                 property_id string:require_email; 
     18                 props_sheet here/portal_properties/qPloneComments; 
     19                 require_email python:props_sheet.getProperty(property_id)"> 
    1720 
    1821    <tal:discussable define="template python:getattr(here, discussable.getLayout(), None); 
     
    2023                             main_macro macros/main | nothing; 
    2124                             showDiscussable python:main_macro; 
    22                              template template_id" 
    23                      > 
     25                             template template_id"> 
    2426 
    2527        <div class="comment"  
     
    6567 
    6668        <fieldset> 
     69             <input type="hidden" name="require_email" value="" 
     70                    tal:attributes="value python:bool(require_email and isAnon)"/> 
    6771 
    6872            <legend i18n:translate="legend_add_comment">Add comment</legend> 
     
    110114                    </div> 
    111115                </div> 
    112               <div class="field" 
    113                      tal:define="property_id string:require_email; 
    114                                  props_sheet here/portal_properties/qPloneComments" 
    115                      tal:condition="python:props_sheet.getProperty(property_id) and isAnon"> 
    116  
    117                     <label for="user_email" i18n:translate="label_discussion-manager_email">Please enter your email:</label> 
     116                <div class="field" 
     117                     tal:define="error errors/email|nothing;" 
     118                     tal:attributes="class python:test(error, 'field error', 'field')" 
     119                     tal:condition="python:require_email and isAnon"> 
     120 
     121 
     122                    <label for="email" i18n:translate="label_discussion-manager_email">Please enter your email:</label> 
    118123                    <span class="fieldRequired" title="Required" 
    119124                          i18n:attributes="title title_required;" 
    120125                          i18n:translate="label_required">(Required) 
    121126                    </span> 
    122                     <div tal:content="string:">Validation error output</div> 
    123  
    124                     <input name="user_email" 
     127                    <div tal:content="error">Validation error output</div> 
     128 
     129                    <input name="email" 
    125130                           value="" 
    126131                           size="40" 
     
    218223 
    219224            </div> 
     225             
     226        <div tal:condition="here/captcha_widget|nothing" 
     227             tal:omit-tag=""> 
     228            <div metal:use-macro="here/captcha_widget/macros/captcha" /> 
     229        </div> 
    220230 
    221231            <div class="formControls"> 
  • qPloneComments/trunk/skins/qplonecomments/2.1/validate_talkback.vpy

    r630 r631  
    66##bind state=state 
    77##bind subpath=traverse_subpath 
    8 ##parameters=subject='',body_text='' 
     8##parameters=subject='',body_text='',require_email, email='' 
    99##title=validates a discussion entry 
    1010## 
     
    2424if not body_text: 
    2525    state.setError('body_text', 'Please submit a body.', 'body_required') 
     26     
     27if require_email != 'False': 
     28    if not (email and context.portal_registration.isValidEmail(email)): 
     29        state.setError('email', 'Please submit email.', 'email_required') 
     30 
     31if hasattr(context, 'captcha_validator'): 
     32    context.captcha_validator() 
    2633 
    2734pp = getToolByName(context, 'portal_properties') 
  • qPloneComments/trunk/skins/qplonecomments/2.5/discussion_reply_form.cpt

    r630 r631  
    224224            </div> 
    225225 
     226             <div tal:condition="here/captcha_widget|nothing" 
     227                  tal:omit-tag=""> 
     228                <div metal:use-macro="here/captcha_widget/macros/captcha" /> 
     229             </div> 
     230 
    226231            <div class="formControls"> 
    227232 
  • qPloneComments/trunk/skins/qplonecomments/2.5/validate_talkback.vpy

    r630 r631  
    1010from Products.CMFCore.utils import getToolByName 
    1111from Products.CMFPlone import PloneMessageFactory as _ 
    12  
    1312dtool = context.portal_discussion 
    1413try: 
     
    1615except AttributeError: 
    1716    content = context 
     17 
    1818if not dtool.isDiscussionAllowedFor(content): 
    1919    raise Exception, "Discussion not allowed." 
     
    2828    if not (email and context.portal_registration.isValidEmail(email)): 
    2929        state.setError('email', 'Please submit email.', 'email_required') 
     30 
     31if hasattr(context, 'captcha_validator'): 
     32    context.captcha_validator() 
    3033 
    3134pp = getToolByName(context, 'portal_properties') 
  • qPloneComments/trunk/skins/qplonecomments/validate_reply.vpy

    r630 r631  
    1313 
    1414return state 
     15     
  • qPloneComments/trunk/version.txt

    r630 r631  
    1 2.2.0-RC1 
     12.2.0