Ignore:
Timestamp:
Jun 3, 2010 10:42:09 AM (14 years ago)
Author:
mylan
Message:

#194: Fixed discussion form for plone-4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonecaptchas/branches/plone4/quintagroup/plonecaptchas/skins/captchas_discussion/discussion_reply_form.cpt

    r1874 r2453  
    33      xmlns:metal="http://xml.zope.org/namespaces/metal" 
    44      xmlns:i18n="http://xml.zope.org/namespaces/i18n" 
    5       metal:use-macro="here/main_template/macros/master" 
     5      metal:use-macro="context/main_template/macros/master" 
    66      i18n:domain="plone"> 
    77<body> 
     
    1010             tal:define="dummy python:request.set('disable_border',1)" /> 
    1111 
    12 <metal:block fill-slot="sub" /> 
     12<metal:main fill-slot="main" 
     13     tal:define="portal context/@@plone_portal_state/portal; 
     14                 errors options/state/getErrors; 
     15                 thread python:context.plone_utils.getDiscussionThread(here); 
     16                 discussable python:thread[0]; 
     17                 replies python:thread[1:]; 
     18                 toLocalizedTime nocall: context/@@plone/toLocalizedTime;"> 
    1319 
    14 <div metal:fill-slot="main" 
    15      tal:define="errors options/state/getErrors; 
    16                  thread python:putils.getDiscussionThread(here); 
    17                  discussable python:thread[0]; 
    18                  replies python:thread[1:]"> 
     20    <div id="content-core"> 
     21        <tal:discussable define="object_title context/Title; 
     22                                 object_description context/Description; 
     23                                 view_template python:getattr(here, discussable.getLayout(), None); 
     24                                 view_macros view_template/macros | nothing; 
     25                                 view_macro view_macros/content-core | nothing; 
     26                                 showDiscussable python:object_title or object_description or view_macro;"> 
     27             <div class="comment"  
     28                  tal:condition="showDiscussable" 
     29                  tal:define="here python:discussable; 
     30                              context python:discussable"> 
     31                 <h1 class="documentDescription" tal:content="object_title">Title</h1> 
     32                 <div class="documentDescription" tal:content="object_description"> 
     33                     Description 
     34                 </div> 
     35                 <tal:block tal:condition="view_macro"> 
     36                     <div metal:use-macro="view_macro"/> 
     37                 </tal:block> 
     38             </div> 
     39        </tal:discussable> 
    1940 
    20     <tal:discussable define="template python:getattr(here, discussable.getLayout(), None); 
    21                              macros template/macros | nothing; 
    22                              main_macro macros/main | nothing; 
    23                              showDiscussable python:main_macro;"> 
     41        <tal:thread tal:repeat="reply replies"> 
     42            <tal:block tal:define="level repeat/reply/index"> 
     43                <div class="comment" 
     44                     tal:attributes="style python:'margin-left:'+str((int(level)+1)*2)+'em'"> 
     45                   <h3> 
     46                       <tal:block replace="structure portal/discussionitem_icon.png"/> 
     47                       <span tal:replace="reply/pretty_title_or_id">Comment title</span> 
     48                   </h3> 
     49                   <div class="documentByLine" 
     50                        tal:define="anonymous_creator python:reply.Creator()=='Anonymous User'"> 
     51                       <span i18n:translate="label_comment_by">Posted by</span> 
     52                       <span tal:content="reply/Creator" 
     53                             tal:condition="not:anonymous_creator">Poster Name</span> 
     54                       <span i18n:translate="label_anonymous_user" 
     55                             tal:condition="anonymous_creator">Anonymous User</span> 
     56                       <span i18n:translate="label_commented_at">at</span>  
     57                       <span tal:replace="python:toLocalizedTime(reply.ModificationDate(), 
     58                                          long_format=1)">8/23/2001 12:40:44 PM</span> 
     59                   </div> 
     60                   <div class="commentBody" 
     61                        tal:content="structure reply/CookedBody"> 
     62                        This is the body text of the comment. 
     63                   </div> 
     64               </div>     
     65                  
     66            </tal:block> 
     67        </tal:thread> 
    2468 
    25         <div class="comment"  
    26              tal:condition="showDiscussable" 
    27              tal:define="here python:discussable; 
    28                          context python:discussable"> 
    29             <div metal:use-macro="main_macro"/> 
    30         </div> 
    31     </tal:discussable> 
     69        <form name="edit_form" 
     70              class="enableAutoFocus" 
     71              method="post" 
     72              action="talkback" 
     73              tal:attributes="action string:${context/@@plone_context_state/object_url}/${template/getId}" 
     74              tal:define="isAnon context/@@plone_portal_state/anonymous;"> 
    3275 
    33     <tal:thread tal:repeat="reply replies"> 
    34         <tal:block tal:define="level repeat/reply/index"> 
    35             <div class="comment" 
    36                  tal:attributes="style python:'margin-left:'+str((int(level)+1)*2)+'em'"> 
    37                <h3> 
    38                    <tal:block replace="structure portal/discussionitem_icon.gif"/> 
    39                    <span tal:replace="reply/pretty_title_or_id">Comment title</span> 
    40                </h3> 
    41                <div class="documentByLine" 
    42                     tal:define="anonymous_creator python:reply.Creator()=='Anonymous User'"> 
    43                    <span i18n:translate="label_comment_by">Posted by</span> 
    44                    <span tal:content="reply/Creator" 
    45                          tal:condition="not:anonymous_creator">Poster Name</span> 
    46                    <span i18n:translate="label_anonymous_user" 
    47                          tal:condition="anonymous_creator">Anonymous User</span> 
    48                    <span i18n:translate="label_commented_at">at</span>  
    49                    <span tal:replace="python:toLocalizedTime(reply.ModificationDate(), 
    50                                       long_format=1)">8/23/2001 12:40:44 PM</span> 
    51                </div> 
    52                <div class="commentBody" 
    53                     tal:content="structure reply/CookedBody"> 
    54                     This is the body text of the comment. 
    55                </div> 
    56            </div>     
    57                   
    58         </tal:block> 
    59     </tal:thread> 
     76            <fieldset> 
    6077 
    61     <form name="edit_form" 
    62           class="enableAutoFocus" 
    63           method="post" 
    64           action="talkback" 
    65           tal:attributes="action string:$here_url/$template_id"> 
     78                <legend i18n:translate="legend_add_comment">Add comment</legend> 
     79                <p i18n:translate="description_add_comment"> 
     80                    You can add a comment by filling out the form below. Plain text 
     81                    formatting. 
     82                </p> 
    6683 
    67         <fieldset> 
     84                <input type="hidden" name="Creator" value="" 
     85                       tal:define="member context/@@plone_portal_state/member;" 
     86                       tal:attributes="value member/getUserName" /> 
    6887 
    69             <legend i18n:translate="legend_add_comment">Add comment</legend> 
    70             <p i18n:translate="description_add_comment"> 
    71                 You can add a comment by filling out the form below. Plain text 
    72                 formatting. 
    73             </p> 
     88                <div tal:condition="isAnon"> 
     89                    <dl class="portalMessage warning"> 
     90                        <dt i18n:translate=""> 
     91                            Info 
     92                        </dt> 
     93                        <dd i18n:translate="legend_note_reply_anonymous"> 
     94                            You are not logged in. You may optionally enter your 
     95                            username and password below. If you don't enter anything, 
     96                            this comment will be posted as 'Anonymous User'. 
     97                        </dd> 
     98                    </dl> 
    7499 
    75             <input type="hidden" name="Creator" value="" 
    76                    tal:attributes="value member/getUserName" /> 
     100                    <div class="field"> 
    77101 
    78             <div tal:condition="isAnon"> 
    79                 <dl class="portalMessage warning"> 
    80                     <dt i18n:translate=""> 
    81                         Info 
    82                     </dt> 
    83                     <dd i18n:translate="legend_note_reply_anonymous"> 
    84                         You are not logged in. You may optionally enter your 
    85                         username and password below. If you don't enter anything, 
    86                         this comment will be posted as 'Anonymous User'. 
    87                     </dd> 
    88                 </dl> 
     102                        <label for="username" i18n:translate="label_name">Name</label> 
    89103 
    90                 <div class="field"> 
     104                        <input name="username" 
     105                               id="username" 
     106                               value="" alt="Username" title="Name" 
     107                               size="40" 
     108                               i18n:attributes="title label_name; alt label_username;" /> 
    91109 
    92                     <label for="username" i18n:translate="label_name">Name</label> 
     110                    </div> 
    93111 
    94                     <input name="username" 
    95                            id="username" 
    96                            value="" alt="Username" title="Name" 
    97                            size="40" 
    98                            i18n:attributes="title label_name; alt label_username;" /> 
     112                    <div class="field"> 
     113 
     114                        <label for="password" i18n:translate="label_password">Password</label> 
     115 
     116                        <input type="password" 
     117                               id="password" 
     118                               name="password" 
     119                               value="" alt="Password" title="Password" 
     120                               size="40" 
     121                               i18n:attributes="title label_password; alt label_password;" /> 
     122 
     123                    </div> 
    99124 
    100125                </div> 
    101126 
    102                 <div class="field"> 
    103127 
    104                     <label for="password" i18n:translate="label_password">Password</label> 
     128            <div class="field" 
     129            tal:define="error errors/subject|nothing;" 
     130            tal:attributes="class python:test(error, 'field error', 'field')"> 
    105131 
    106                     <input type="password" 
    107                            id="password" 
    108                            name="password" 
    109                            value="" alt="Password" title="Password" 
     132                    <label for="subject" i18n:translate="label_subject">Subject</label> 
     133 
     134            <span class="fieldRequired" title="Required" 
     135                  i18n:attributes="title title_required;" 
     136                  i18n:translate="label_required">(Required)</span> 
     137 
     138                <div tal:content="error">Validation error output</div> 
     139 
     140                    <input name="subject" 
     141                           id="subject" 
     142                           value="" 
    110143                           size="40" 
    111                            i18n:attributes="title label_password; alt label_password;" /> 
     144                           tal:attributes="value request/subject|request/title_override|nothing;" /> 
    112145 
    113146                </div> 
    114147 
    115             </div> 
     148            <div class="field" 
     149            tal:define="error errors/body_text|nothing;" 
     150            tal:attributes="class python:test(error, 'field error', 'field')"> 
    116151 
     152              <label for="body_text" i18n:translate="label_comment">Comment</label> 
    117153 
    118         <div class="field" 
    119         tal:define="error errors/subject|nothing;" 
    120         tal:attributes="class python:test(error, 'field error', 'field')"> 
     154            <span class="fieldRequired" title="Required" 
     155                  i18n:attributes="title title_required;" 
     156                  i18n:translate="label_required">(Required)</span> 
    121157 
    122                 <label for="subject" i18n:translate="label_subject">Subject</label> 
     158                <div tal:content="error">Validation error output</div> 
    123159 
    124         <span class="fieldRequired" title="Required" 
    125               i18n:attributes="title title_required;" 
    126               i18n:translate="label_required">(Required)</span> 
     160                    <textarea name="body_text" 
     161                              id="body_text" 
     162                              cols="40" 
     163                              rows="8" 
     164                              tal:content="request/body_text|request/text_override | nothing" 
     165                            ></textarea> 
    127166 
    128             <div tal:content="error">Validation error output</div> 
     167                </div> 
    129168 
    130                 <input name="subject" 
    131                        id="subject" 
    132                        value="" 
    133                        size="40" 
    134                        tal:attributes="value request/subject|request/title_override|nothing;" /> 
     169                <div metal:use-macro="here/captcha_widget/macros/captcha"></div> 
    135170 
    136             </div> 
     171                <div class="formControls"> 
    137172 
    138         <div class="field" 
    139         tal:define="error errors/body_text|nothing;" 
    140         tal:attributes="class python:test(error, 'field error', 'field')"> 
     173                    <input class="context" 
     174                           type="submit" 
     175                           value="Save" 
     176                           name="form.button.Save" 
     177                           i18n:attributes="value label_save;" 
     178                           tal:attributes="name string:discussion_reply:method;" /> 
    141179 
    142           <label for="body_text" i18n:translate="label_comment">Comment</label> 
     180                </div> 
     181              <input type="hidden" name="form.submitted" value="1" /> 
    143182 
    144         <span class="fieldRequired" title="Required" 
    145               i18n:attributes="title title_required;" 
    146               i18n:translate="label_required">(Required)</span> 
     183            </fieldset> 
    147184 
    148             <div tal:content="error">Validation error output</div> 
     185        </form> 
     186    </div> 
    149187 
    150                 <textarea name="body_text" 
    151                           id="body_text" 
    152                           cols="40" 
    153                           rows="8" 
    154                           tal:content="request/body_text|request/text_override | nothing" 
    155                         ></textarea> 
    156  
    157             </div> 
    158             <div metal:use-macro="here/captcha_widget/macros/captcha"></div> 
    159             <div class="formControls"> 
    160  
    161                 <input class="context" 
    162                        type="submit" 
    163                        value="Save" 
    164                        name="form.button.Save" 
    165                        i18n:attributes="value label_save;" 
    166                        tal:attributes="name string:discussion_reply:method;" /> 
    167  
    168             </div> 
    169           <input type="hidden" name="form.submitted" value="1" /> 
    170  
    171         </fieldset> 
    172  
    173     </form> 
    174  
    175 </div> 
     188</metal:main> 
    176189 
    177190</body> 
Note: See TracChangeset for help on using the changeset viewer.