Changeset 133

Show
Ignore:
Timestamp:
12/28/05 11:47:38
Author:
mylan
Message:

Adjust configlet to Plone paradigm of design and behavior.

Files:

Legend:

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

    r132 r133  
    77<body> 
    88 
    9 <div metal:fill-slot="prefs_configlet_main"> 
     9<div metal:fill-slot="prefs_configlet_main" 
     10     tal:define="errors python:request.get('controller_state', None).getErrors();"> 
    1011 
    1112    <div metal:define-macro="main" i18n:domain="plone"> 
     
    2627              tal:define ="pp here/portal_properties; 
    2728                           ps_name python:modules['Products.qPloneComments.config'].PROPERTY_SHEET; 
    28                            props_sheet python:getattr(pp, ps_name)
     29                           props_sheet python:getattr(pp, ps_name);
    2930              tal:attributes="action string:${here/getId}/${template/getId}"> 
    3031 
    3132            <fieldset> 
    3233                <legend i18n:translate="legend_mailhost_details">qPloneComments configuration Details</legend> 
    33                 <table cellspacing="4" cellpadding="4" border="0" 
    34                        tal:define ="props_map python:props_sheet.propertyMap();" 
    35                        tal:condition="props_map"> 
     34 
     35                <div class="field" 
     36                     tal:define="property_id string:Email_of_discussion_manager; 
     37                                 email python:props_sheet.getProperty(property_id, ''); 
     38                                 error python:test(errors.has_key(property_id), errors.get(property_id), None);" 
     39                     tal:attributes="class python:test(error, 'field error', 'field')" 
     40                     tal:condition="python:props_sheet.hasProperty(property_id)"> 
     41         
     42                    <label i18n:translate="label_discussion-manager_email">E-mail of discussion manager</label> 
     43         
     44                    <div class="formHelp" id="smtp_server_help" 
     45                         i18n:translate="help_discussion-manager_email"> 
     46                        The e-mail address where notifications about adding new comments will be sent. 
     47                    </div> 
    3648                     
    37                     <tr class="list-header">  
    38                         <td align="left" valign="top" width="150">  
    39                             <div class="form-label" ><span i18n:translate="Name"> Name </span> </div> 
    40                         </td> 
    41                         <td align="left" valign="top" width="400">  
    42                             <div class="form-label"> <span i18n:translate="Value"> Value </span> </div> 
    43                         </td> 
    44                     </tr> 
    45                     <tr tal:repeat="item props_map"> 
    46                         <div tal:define="id python:item['id']; 
    47                                          type python:item['type']; 
    48                                          mode python:item.get('mode', 'awd');" 
    49                              tal:condition="python:not id=='title'"> 
    50                             <td align="left" valign="top" width="200"> 
    51                                 <div class="form-label"> 
    52                                     <b><label i18n:translate="" 
    53                                               tal:content="python:id.replace('_',' ')"> 
    54                                          Label of property 
    55                                     </label></b> 
    56                                 </div> 
    57                             </td> 
    58                             <td align="left" valign="top" width="400"> 
    59                                 <input type="text" name="" value="" size="40" 
    60                                        tal:attributes="value python:props_sheet.getProperty(id); 
    61                                                        name string:${id}" 
    62                                        tal:condition="python:type=='string' and 'w' in mode"/> 
    63                                 <input type="checkbox" name="" value="" 
    64                                        tal:attributes="value python:props_sheet.getProperty(id); 
    65                                                        checked python:test(props_sheet.getProperty(id), 'True', ''); 
    66                                                        name string:${id}" 
    67                                        tal:condition="python:type=='boolean' and 'w' in mode"/> 
    68                             </td> 
    69                         </div> 
    70                     </tr> 
    71                     <tr> 
    72                         <input type="hidden" name="form.submitted" value=1 /> 
    73                         <td align="left" valign="top" colspan=2> 
    74                             <div class="field"> 
    75                                 <input class=context  
    76                                     type="submit" 
    77                                     name="form.button.form_submit" 
    78                                     i18n:attributes="value" 
    79                                     value="Save" /> 
    80                             </div> 
    81                         </td> 
    82                     </tr> 
    83                 </table> 
     49                    <div tal:content="error">Validation error output</div> 
     50 
     51                    <input name="email_discussion-manager" 
     52                           value="" 
     53                           size="40" 
     54                           tabindex="" 
     55                           tal:attributes="name property_id; 
     56                                           value email; 
     57                                           tabindex tabindex/next;" /> 
     58                </div> 
     59 
     60                <div class="field" 
     61                     tal:define="property_id string:Turning_on/off_notification; 
     62                                 isEnabledNotification python:props_sheet.getProperty(property_id, False);" 
     63                     tal:condition="python:props_sheet.hasProperty(property_id)"> 
     64 
     65                    <input type="checkbox"  
     66                           class="noborder" 
     67                           name="isEnabledNotification" 
     68                           id="isEnabledNotification" 
     69                           tabindex ="" 
     70                           tal:attributes="name property_id; 
     71                                           value isEnabledNotification; 
     72                                           checked python:test(isEnabledNotification, 'True', ''); 
     73                                           tabindex tabindex/next;"/> 
     74 
     75                    <label i18n:translate="label_enable_notification"  
     76                           for="isEnabledNotification">Enable e-mail notification about comments adding.</label> 
     77                     
     78                    <div class="formHelp" i18n:translate="help_enable_notification"> 
     79                        If checked, notification will be sent to discussion manager's e-mail. 
     80                    </div> 
     81                </div> 
     82 
     83                <div class="field" 
     84                     tal:define="property_id string:Turning_on/off_Moderation; 
     85                                 isEnabledModeration python:props_sheet.getProperty(property_id, False);" 
     86                     tal:condition="python:props_sheet.hasProperty(property_id)"> 
     87 
     88                    <input type="checkbox"  
     89                           class="noborder" 
     90                           name="isEnabledModeration" 
     91                           id="isEnabledModeration" 
     92                           tabindex ="" 
     93                           tal:attributes="name property_id; 
     94                                           value isEnabledModeration; 
     95                                           checked python:test(isEnabledModeration, 'True', ''); 
     96                                           tabindex tabindex/next;"/> 
     97 
     98                    <label i18n:translate="label_enable_moderation"  
     99                           for="isEnabledModeration">Enable moderation.</label> 
     100                     
     101                    <div class="formHelp" i18n:translate="help_enable_moderation"> 
     102                        If checked, moderation for new comments will be activated. 
     103                    </div> 
     104                </div> 
     105 
     106                <div class="field" 
     107                     tal:define="property_id string:Turning_on/off_Anonymous_Commenting; 
     108                                 isEnabledAnonymousCommenting python:props_sheet.getProperty(property_id, False);" 
     109                     tal:condition="python:props_sheet.hasProperty(property_id)"> 
     110 
     111                    <input type="checkbox"  
     112                           class="noborder" 
     113                           name="isEnabledAnonymousCommenting" 
     114                           id="isEnabledAnonymousCommenting" 
     115                           tabindex ="" 
     116                           tal:attributes="name property_id; 
     117                                           value isEnabledAnonymousCommenting; 
     118                                           checked python:test(isEnabledAnonymousCommenting, 'True', ''); 
     119                                           tabindex tabindex/next;"/> 
     120 
     121                    <label i18n:translate="label_anonymous_commenting"  
     122                           for="isEnabledAnonymousCommenting">Enable commenting for anonymous users.</label> 
     123                     
     124                    <div class="formHelp" i18n:translate="help_anonymous_commenting"> 
     125                        If checked, anonymous users will be able to add comments and sign them. 
     126                    </div> 
     127                </div> 
     128 
     129                <div class="formControls"> 
     130                    <input type="hidden" name="form.submitted" value="1" /> 
     131 
     132                    <input class="context" 
     133                           tabindex="" 
     134                           type="submit" 
     135                           name="form.button.form_submit" 
     136                           value="Save" 
     137                           i18n:attributes="value" 
     138                           tal:attributes="tabindex tabindex/next;" 
     139                           /> 
     140                </div> 
    84141            </fieldset>   
    85142        </form> 
  • qPloneComments/trunk/skins/qplonecomments/validate_config.vpy

    r132 r133  
    1313form = context.REQUEST.form 
    1414email_key = 'Email_of_discussion_manager' 
    15 error_str = '' 
    1615 
    1716if email_key in form: 
     
    1918    pu = getToolByName(context, 'plone_utils') 
    2019    if not pu.validateEmailAddresses(email): 
    21         error_str += "Please submit a valid email address for 'Email of discussion manager' field." 
     20        state.setError(email_key, 'Please submit a valid e-mail address.') 
    2221 
    23 if len(error_str): 
    24     return state.set(status='failure', portal_status_message=error_str
     22if state.getErrors(): 
     23    return state.set(status='failure', portal_status_message='Please correct the indicated errors.'
    2524else: 
    2625    return state 
     26