{% extends "pub_base.html" %}
{% load seahub_tags avatar_tags i18n %}
{% load url from future %}

{% block cur_user %}tab-cur{% endblock %}

{% block left_panel %}{{block.super}}
{% if has_file_search %}
<form action="{% url "pubuser_search" %}" method="get" class="side-search-form">
    <input type="text" name="search" value="{{search}}" placeholder="{% trans "Search members..." %}" class="input" />
</form>
{% endif %}
{% endblock %}

{% block right_panel %}
{% if search %}
<h3 class="hd">{% trans "Search Results" %}</h3>
{% else %}
<div class="tabnav ovhd">
    <ul class="tabnav-tabs fleft">
        <li class="tabnav-tab {% if not ldap %}tabnav-tab-cur{%endif%}"><a href="{% url 'pubuser' %}">{% trans "Database" %}</a></li>
        {% if have_ldap_user %}
        <li class="tabnav-tab {% if ldap %}tabnav-tab-cur{%endif%}"><a href="{% url 'pubuser' %}?ldap=1">{% trans "LDAP" %}</a></li>
        {% endif %}
    </ul>
</div>
{% endif %}

{% if users %}
<ul class="user-list">
    {% for u in users %}
    {% with e=u.email id=u.email %}
    <li class="user ovhd">
    <a href="{% url 'user_profile' id %}" class="pic fleft">{% avatar e 48 %}</a>
    <div class="txt fright">
        <a class="name" href="{% url 'user_profile' id %}">{{ e|email2nickname }}</a>
        <p>{{ e }}</p>
    </div>
    </li>
    {% endwith %}
    {% endfor %}
</ul>
{% if show_paginator %}
<div id="paginator">
    {% if has_prev %}
    <a href="?page={{ current_page|add:"-1" }}{% if ldap %}&ldap=1{%endif%}">{% trans "Previous" %}</a>
    {% endif %}
    {% for pr in page_range %}
      {% if pr == current_page %}
      <span class="cur">{{ pr }}</span>
      {% else %}
      <a href="?page={{ pr }}{% if ldap %}&ldap=1{%endif%}" class="pg">{{ pr }}</a>
      {% endif %}
    {% endfor %}
    {% if has_next %}
    <a href="?page={{ current_page|add:"1" }}{% if ldap %}&ldap=1{%endif%}">{% trans "Next" %}</a>
    {% endif %}
</div>
{% endif %}

{% else %}
<p>{% trans "None"%}</p>
{% endif %}
{% endblock %}
