Changeset 1956


Ignore:
Timestamp:
08/20/07 12:50:09 (12 years ago)
Author:
jukka
Message:

Fixed #1494. Anonymous users can view discussions, but are asked to join to reply to them. When anonymous views an empty discussion, it doesn't cause creation of discussion post.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/BlogPost.py

    r1921 r1956  
    5252        name="is_discussion", 
    5353        default=False, 
     54        index='FieldIndex:schema', 
    5455        widget=ComputedWidget( 
    5556            visible={'edit':'invisible', 'view':'invisible'} 
  • trunk/Resources.py

    r1930 r1956  
    10001000        # If discussion exists, find it 
    10011001        reftool= getToolByName(self, 'reference_catalog') 
     1002        mtool=getToolByName(self, 'portal_membership') 
    10021003        obj_uid = self.UID() 
    10031004        found = [] 
     
    10111012        if found: 
    10121013            return found[0] 
    1013         elif not do_create: 
     1014        elif not do_create or mtool.isAnonymousUser(): 
    10141015            return None             
    10151016        # If no discussion found and we do_create, then we create one 
    1016         group=self.getGroupEditing() 
     1017        group=None 
     1018        if hasattr(self, 'getGroupEditing'): 
     1019            group= self.getGroupEditing() 
    10171020        if not group: 
    10181021            group=self.community.unassigned_discussions 
  • trunk/skins/lemill/discussion.pt

    r1924 r1956  
    77<body> 
    88 
    9 <div metal:fill-slot="main" tal:define="post here/getDiscussion"> 
     9<div metal:fill-slot="main"  
     10    tal:define="post here/getDiscussion; 
     11        postbody post/getBodyText | nothing; 
     12        original python:here.defaultDiscussionMessage(postbody);"> 
    1013<metal:main_macro define-macro="main">  
    1114        <!-- header, H1 with title in it --> 
    1215        <metal:header define-macro="header"> 
    13         <h1 tal:content="post/Title" class="documentFirstHeading"> 
     16        <h1 tal:condition="original" class="documentFirstHeading" i18n:translate="title_discussion_page"> 
     17            Discussion about <a i18n:name="resource_name" tal:attributes="href string:${context/absolute_url}/view" href="" tal:content="context/Title">title</a> 
     18        </h1> 
     19        <h1 tal:condition="not:original" tal:content="post/Title" class="documentFirstHeading"> 
    1420            PLACEHOLDER 
    1521        </h1> 
     
    2430        <!-- body macro where all the fields are --> 
    2531        <metal:body define-macro="body"> 
    26     <p tal:condition="python:here.defaultDiscussionMessage(post.getBodyText())" i18n:translate="discussion_explanation">Here you can discuss about <a i18n:name="resource_name" tal:attributes="href string:${context/absolute_url}/view" href="" tal:content="context/Title">title</a>.</p> 
    27     <p tal:condition="python:not here.defaultDiscussionMessage(post.getBodyText())"> 
     32    <p tal:condition="python:here.defaultDiscussionMessage(postbody)" i18n:translate="discussion_explanation">Here you can discuss about <a i18n:name="resource_name" tal:attributes="href string:${context/absolute_url}/view" href="" tal:content="context/Title">title</a>.</p> 
     33    <p tal:condition="python:not here.defaultDiscussionMessage(postbody)"> 
    2834        <metal:fieldMacro use-macro="python:post.widget('bodyText',mode='view')"/> 
    2935    </p> 
    3036     
    3137 
     38    <tal:post_is_real condition="post">  
    3239 
    3340    <div class="discussion" 
     
    114121            </div> 
    115122        </div> 
     123 
     124        </tal:post_is_real> 
     125 
     126        <tal:post_is_not_real condition="not:post"> 
     127 
     128            <form tal:condition="isAnon" 
     129                    tal:define="pss modules/Products/PythonScripts/standard" 
     130                    tal:attributes="action python:'%s/login_form?came_from=%s' % 
     131                                                (here.portal_url(), 
     132                                                pss.url_quote(request['URL']))"> 
     133                <input class="standalone" 
     134                        style="margin-bottom: 1.25em;" 
     135                        type="submit" 
     136                        value="Log in to write a reply" 
     137                        i18n:attributes="value label_login_to_add_replies;" 
     138                        /> 
     139            </form> 
     140 
     141        </tal:post_is_not_real> 
     142 
     143 
     144 
    116145        </metal:body> 
    117146                 
Note: See TracChangeset for help on using the changeset viewer.