{% load sph_extras %}
{% load sphboard_extras %}

{% for category in categories %}
  <tr class="{{ category.category_type }}">
    {% for test in level|sphrange %}
      <td width='5px'>&nbsp;</td>
    {% endfor %}
    <td width="20px"><img src="{{ STATIC_URL }}sphene/sphboard/icons/{% if category.has_new_posts %}new{% endif %}folder.gif" width='16px' height='16px' /></td>
    {% ifequal category.category_type "sphseparator" %}
      <td class="sphboard_categoryname" colspan="{{ maxDepth|sphminus:level|sph_plus:3 }}"><a href="{{ category.get_absolute_url }}">{{ category.name }}</a></td>
    {% else %}
      <td class="sphboard_categoryname" colspan='{{ maxDepth|sphminus:level }}'><a href="{{ category.get_absolute_url }}">{{ category.name }}</a><br/><small>{{ category.description }}</small></td>
      <td class="sphboard_threadcount">{{ category.threadCount }}</td>
      <td class="sphboard_postcount">{{ category.postCount }}</td>
      <td class="sphboard_latestpost">{% sphboard_latestPost category.latestPost %}</td>
    {% endifequal %}
  </tr>
  {% sphboard_displayCategories category.get_children maxDepth level %}
{% endfor %}
