Changeset 632

Show
Ignore:
Timestamp:
11/17/06 11:34:49
Author:
crchemist
Message:

Added qPloneCaptchas support in Plone-2.0.5.

Files:

Legend:

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

    r631 r632  
    99 
    1010<div metal:fill-slot="main" 
    11      tal:define="errors options/state/getErrors;"> 
     11     tal:define="errors options/state/getErrors; 
     12                 property_id string:require_email; 
     13                 props_sheet here/portal_properties/qPloneComments; 
     14                 require_email python:props_sheet.getProperty(property_id)"> 
    1215 
    1316    <h1 i18n:translate="heading_add_comment">Add Comment</h1> 
     
    2326          tal:define="isForAnonymous python:here.portal_properties.qPloneComments.getProperty('enable_anonymous_commenting', 0)"> 
    2427        <fieldset> 
     28            <input type="hidden" name="require_email" value="" 
     29                    tal:attributes="value python:bool(require_email and isAnon)"/> 
     30 
    2531            <legend i18n:translate="legend_comment_details">Comment Details</legend> 
    2632 
     
    6369 
    6470                    </div> 
    65  
    66                     <div class="field
    67                          tal:define="property_id string:require_email; 
    68                                      props_sheet here/portal_properties/qPloneComments" 
    69                          tal:condition="python:props_sheet.getProperty(property_id) and isAnon"> 
    70  
    71                         <label for="user_email" i18n:translate="label_discussion-manager_email">Please enter your email:</label> 
    72                         <span class="fieldRequired" title="Required" 
    73                               i18n:attributes="title title_required;" 
    74                               i18n:translate="label_required">(Required) 
    75                         </span> 
    76                         <div tal:content="string:">Validation error output</div> 
    77  
    78                         <input name="user_email" 
    79                                value="" 
    80                                size="40" 
    81                                tabindex="" 
    82                                tal:attributes="tabindex tabindex/next;" /> 
    83                     </div> 
     71                <div class="field" 
     72                    tal:define="error errors/email|nothing;
     73                     tal:attributes="class python:test(error, 'field error', 'field')" 
     74                     tal:condition="python:require_email and isAnon"> 
     75 
     76 
     77                    <label for="email" i18n:translate="label_discussion-manager_email">Please enter your email:</label> 
     78                    <span class="fieldRequired" title="Required" 
     79                          i18n:attributes="title title_required;" 
     80                          i18n:translate="label_required">(Required) 
     81                    </span> 
     82                    <div tal:content="error">Validation error output</div> 
     83 
     84                    <input name="email" 
     85                           value="" 
     86                           size="40" 
     87                           tabindex="" 
     88                           tal:attributes="tabindex tabindex/next;" /> 
     89                </div> 
    8490 
    8591                </div> 
     
    184190            </div> 
    185191 
     192            <div tal:condition="here/captcha_widget|nothing" 
     193                 tal:omit-tag=""> 
     194                <div metal:use-macro="here/captcha_widget/macros/captcha" /> 
     195            </div> 
     196 
    186197            <div class="formControls"> 
    187198 
  • qPloneComments/trunk/skins/qplonecomments/2.0.5/validate_talkback.vpy

    r631 r632  
    66##bind state=state 
    77##bind subpath=traverse_subpath 
    8 ##parameters=subject='',body_text='' 
     8##parameters=subject='',body_text='', email='', require_email 
    99##title=validates a discussion entry 
    1010## 
     
    1717    state.setError('body_text', 'Please submit a body.', 'body_required') 
    1818 
     19if require_email != 'False': 
     20    if not (email and context.portal_registration.isValidEmail(email)): 
     21        state.setError('email', 'Please submit email.', 'email_required') 
     22             
     23if hasattr(context, 'captcha_validator'): 
     24    context.captcha_validator() 
     25                 
    1926pp = getToolByName(context, 'portal_properties') 
    2027isForAnonymous = pp['qPloneComments'].getProperty('enable_anonymous_commenting', None) 
  • qPloneComments/trunk/skins/qplonecomments/2.1/discussion_reply_form.cpt

    r631 r632  
    223223 
    224224            </div> 
    225              
     225 
    226226        <div tal:condition="here/captcha_widget|nothing" 
    227227             tal:omit-tag=""> 
    228            <div metal:use-macro="here/captcha_widget/macros/captcha" /> 
     228             <div metal:use-macro="here/captcha_widget/macros/captcha" /> 
    229229        </div> 
    230230