<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      lang="en"
      metal:use-macro="here/main_template/macros/master"
      i18n:domain="plone">

<head>

    <tal:comment replace="nothing">
    This template is deprecated, and will disappear in the next version of
    Plone. We use Smart Folders with Summary View instead now.
    -- Alexander Limi
    </tal:comment>

</head>

<body>
<div metal:fill-slot="main" id="content-news"
     tal:define="results python:container.portal_catalog(portal_type='News Item',sort_on='Date',sort_order='reverse',review_state='published');
                 Batch python:modules['Products.CMFPlone'].Batch;
                 b_start python:request.get('b_start',0);
                 portal_discussion nocall:here/portal_discussion;
                 isDiscussionAllowedFor nocall:portal_discussion/isDiscussionAllowedFor;
                 getDiscussionFor nocall:portal_discussion/getDiscussionFor;
                 home_url python: mtool.getHomeUrl;">


    <form name="searchresults" action="" method="post" tal:condition="results"
                      tal:define="batch python:Batch(results, 15, int(b_start), orphan=1)">

        <metal:block tal:repeat="result batch">

            <div class="newsItem"
                 metal:define-macro="listitem"
                 tal:define="resultObject result/getObject;
                             creator result/Creator;
                             resulturl resultObject/absolute_url | nothing;
                             has_body resultObject/CookedBody | nothing"
                 tal:condition="python:resultObject is not None">

                <h2>
                    <a href="/view" 
                       tal:attributes="href resulturl" 
                       tal:content="result/pretty_title_or_id">
                        News headline
                    </a>
                </h2>

                <div class="newsContent">

                    <p tal:content="result/Description">
                        Description
                    </p>
    
                    <ul class="newsAbout">
 
                        <li>
                            <span tal:omit-tag="" i18n:translate="posted_by">Posted by</span>
    
                            <span class="link-user">
                                <a href=""
                                   tal:attributes="href python: home_url(creator)" 
                                   tal:content="creator">
                                    Author
                                </a>
                            </span>
                        </li>
                        <li>
                            <span tal:omit-tag="" i18n:translate="label_published">Published</span>:
                            <span tal:replace="python:here.toLocalizedTime(result.Date)" />
                        </li>
                    </ul>

                    <ul class="newsFooter" tal:define="is_discussable python: isDiscussionAllowedFor(resultObject);">
                        <li>
                            <a href="/view" tal:condition="has_body" tal:attributes="href resulturl" i18n:translate="read_more">
                                Read More&hellip;</a>
                            <tal:tag condition="not:has_body" replace="structure string:&nbsp;" />
                        </li>

                        <tal:discussable condition="is_discussable">
                        <li tal:attributes="class python: test(has_replies, 'visualCommentAlign link-comment','visualCommentAlign');"
                            tal:define="talkback python: getDiscussionFor(resultObject);
                                        has_replies python: talkback.hasReplies(resultObject);">
                            <a href="" 
                               tal:define="reply_count python:talkback.replyCount(resultObject)"
                               tal:condition="reply_count"
                               tal:attributes="href string:${resulturl}#comments;">
                               (<span tal:replace="python: reply_count" />)</a>
                        </li>
                        </tal:discussable>
                    </ul>
                    
                </div>

            </div>

        </metal:block>

        <!-- Navigation -->
        <div metal:use-macro="here/batch_macros/macros/navigation" />

        </form>

    <p tal:condition="not: results" i18n:translate="no_new_news">
        No news has been posted.
    </p>

    <div tal:define="contentTypes here/getAllowedTypes" tal:omit-tag="python:1"
         tal:condition="python:'news' in portal.contentIds() and here==portal.news">
        <tal:add_button metal:use-macro="here/folder_contents/macros/add_button"/>
    </div>

  </div>

</body>
</html>
