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

<metal:block fill-slot="top_slot"
             tal:define="dummy python:request.set('disable_border',1)" />

<metal:main fill-slot="main"
       tal:define="search_view here/@@pas_search;
                   listing_allowed python: checkPermission('List portal members', here);
                   results python:listing_allowed and search_view.searchUsersByRequest(request, sort_by='fullname') or [];
                   Batch python:modules['Products.CMFPlone'].Batch;
                   DateTime python:modules['DateTime'].DateTime;
                   b_size python:12;b_start python:0;b_start request/b_start | b_start;">

    <h1 class="documentFirstHeading"
        i18n:translate="heading_search_results">Search results</h1>

    <div id="content-core">
        <p tal:condition="not: listing_allowed"
            i18n:translate="member_listing_not_allowed">
          You are not allowed to list portal members.
        </p>
        <div tal:condition="results"
              tal:define="batch python:Batch(results, b_size, int(b_start), orphan=1)">

            <strong i18n:translate="batch_x_items_matching_your_criteria">
                <span i18n:name="number" tal:omit-tag="" tal:content="python:len(results)">234</span> items matching your search terms
            </strong>

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

            <div tal:define="pm context/@@plone_tools/membership;
                             portal_url context/@@plone_portal_state/portal_url">
             <metal:block tal:repeat="result batch">
                <div class="card" tal:define="userid result/userid | nothing;
                                              personal_info python:pm.getMemberInfo(userid) or {};
                                              home python:pm.getHomeUrl(userid, verifyPermission=1);
                                              portrait python:pm.getPersonalPortrait(userid);">

                        <a href="#"
                           tal:attributes="href python:home or '%s/author/%s' % (portal_url, userid)">
                            <img src="defaultUser.png"
                                 alt=""
                                 border="0"
                                 width="75"
                                 height="100"
                                 tal:attributes="src portrait/absolute_url" />
                            <br />
                            <span tal:content="python:personal_info.get('fullname', userid)">user id</span>
                        </a>

                </div>
             </metal:block>
            </div>

            <div class="visualClear" id="clear-space-before-navigation"><!-- --></div>

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

            <div class="visualClear" id="clear-space-after-navigation"><!-- --></div>

        </div>

        <div tal:condition="not: results">
            <p><strong i18n:translate="description_no_results_found">No results were found.</strong></p>
        </div>
    </div>

</metal:main>

</html>
