Changeset 627

Show
Ignore:
Timestamp:
11/16/06 08:21:58
Author:
crchemist
Message:

Added anonym user email validation.

Files:

Legend:

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

    r626 r627  
    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); 
     
    5356                    This is the body text of the comment. 
    5457               </div> 
    55            </div>     
    56                   
     58           </div> 
     59 
    5760        </tal:block> 
    5861    </tal:thread> 
     
    6568 
    6669        <fieldset> 
     70            <input type="hidden" name="require_email" value="" 
     71            tal:attributes="value require_email"/> 
    6772 
    6873            <legend i18n:translate="legend_add_comment">Add comment</legend> 
     
    112117 
    113118                <div class="field" 
    114                      tal:define="property_id string:require_email; 
    115                                  props_sheet here/portal_properties/qPloneComments" 
    116                      tal:condition="python:props_sheet.getProperty(property_id) and isAnon"> 
    117  
    118                     <label for="user_email" i18n:translate="label_discussion-manager_email">Please enter your email:</label> 
     119                     tal:define="error errors/email|nothing;" 
     120                     tal:attributes="class python:test(error, 'field error', 'field')" 
     121                     tal:condition="python:require_email and isAnon"> 
     122 
     123 
     124                    <label for="email" i18n:translate="label_discussion-manager_email">Please enter your email:</label> 
    119125                    <span class="fieldRequired" title="Required" 
    120126                          i18n:attributes="title title_required;" 
    121127                          i18n:translate="label_required">(Required) 
    122128                    </span> 
    123                     <div tal:content="string:">Validation error output</div> 
    124  
    125                     <input name="user_email" 
     129                    <div tal:content="error">Validation error output</div> 
     130 
     131                    <input name="email" 
    126132                           value="" 
    127133                           size="40" 
  • qPloneComments/trunk/skins/qplonecomments/2.5/validate_talkback.vpy

    r626 r627  
    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 
    1010from Products.CMFCore.utils import getToolByName 
     
    2525    state.setError('body_text', 'Please submit a body.', 'body_required') 
    2626 
     27if require_email: 
     28    if not (email and context.portal_registration.isValidEmail(email)): 
     29        state.setError('email', 'Please submit email.', 'email_required') 
     30 
    2731pp = getToolByName(context, 'portal_properties') 
    2832isForAnonymous = pp['qPloneComments'].getProperty('enable_anonymous_commenting', None)