{% extends "template.html" %}
{% block content %}
<ul class="object-tools">
    <LI><A HREF="{% url kb:kbentry:add %}" class="addlink">Add KB Entry</A></LI>
</ul>

<h1>Knowledge Base</h1>
<!--
<FORM>
    <B>Search:</B> 
</FORM>
-->
<STYLE>
#tabs {
    padding: .2em;
}

#tabs-nav {
    border-bottom: 1px solid #FFFFFF;
    cursor: pointer;
    background-color: #999999;
    padding: 4px 0px 0px 4px;
}

.selected-tab {
    background-color: #FFFFFF;
}

.unselected-tab {
    background-color: #999999;
}

.selected-tab A {
    color: #999999;
    padding: 8px;
    font-weight: bold;
}

.unselected-tab A {
    color: #FFFFFF;
    padding: 8px;
    font-weight: bold;
}
</STYLE>

<DIV ID="tabs">
<DIV ID="tabs-nav">
    {% for t,n in tabs %}
        <SPAN CLASS='{% ifequal tab t %}selected-tab{%else%}unselected-tab{%endifequal%}'>
            <A HREF="{% url kb:index:tab t %}">{{n}}</A>
        </SPAN>
    {% endfor %}
</DIV>
{% ifequal tab "categories" %}
<TABLE BORDER="0">
{% for e in entries %}
<TR CLASS="{% cycle 'row1' 'row2' %}"><td><a href="{% url kb:index:category e.id %}">{{e.name}}</a></td></tr>
{% endfor %}
</TABLE>
{%else%}
<TABLE BORDER="0">
    <TR><TH>#</TH><TH>Subject</TH><TH>Views</TH><TH>Modified</TH><TH>Modified by</TH></TR>
    {% for e in entries %}
    <TR CLASS="{% cycle 'row1' 'row2' %}">
        <TD ALIGN="right"><A HREF="{% url kb:view:view e.id %}">KB{{e.id}}</A></TD>
        <TD>{{e.subject}}</TD>
        <TD>{{e.preview_count}}</TD>
        <TD>{{e.last_history.timestamp|date}} {{e.last_history.timestamp|time}}</TD>
        <TD>{{e.last_history.user}}</TD>
    </TR>
    {% endfor %}
</TABLE>
{%endifequal%}
</DIV>
{% endblock %}
