{% extends 'layouts/master-page' %}
{% block title %}Weakness browsing{% endblock %}
{% block content %}
  {% if capec != None %}
    <!-- breadcrumb -->
    <ol class="breadcrumb">
      <li><a href="/cwe">CWE Types</a></li>
      <li class="active">Weaknesses related to CWE-{{cwe}}</li>
    </ol>
  {% endif %}
  <div>
    <table class="table table-hover table-striped">
      <tbody>
        <tr>
          {% if capec == None %}
            <td class="warning">CWE ID</td> <td class="warning">Description</td>
          {% else %}
            <td class="warning">CAPEC</td>  <td class="warning">Related Weakness</td>
          {% endif %}
        </tr>
        {% if capec == None %}
          {% for c in cwes %}
            <tr> <td><a href="/cwe/{{c.id}}">CWE-{{c.id}}</a></td> <td>{{c.name}}</td> </tr>
          {% endfor %}
        {% else %}
          {% for c in capec %}
            <tr>
              <td width="20%"><a href="/capec/{{c.id}}">{{c.name}}</a></td>
              <td><div class="semiCollapsed colfield">
                <table class="block">{% for r in c.related_weakness|sortIntLikeStr %}
                  <tr><td width="75px"><a href="/cwe/{{r}}">CWE-{{r}}</a></td><td>{{cwes[r]}}</td></tr>{% endfor %}
                </table>
              </div></td>
            </tr>
          {% endfor %}
        {% endif %}
      </tbody>
    </table>
  </div>
{% endblock %}
