view farol/templates/document/view.j2 @ 132:812e613cbbb4

Add possibility to delete the current document.
author Benoît Allard <benoit.allard@greenbone.net>
date Fri, 24 Oct 2014 12:59:35 +0200
parents 09915cbdf549
children
line wrap: on
line source
{#
# Description:
# Web Template used in Farol Design
#
# Authors:
# BenoƮt Allard <benoit.allard@greenbone.net>
#
# Copyright:
# Copyright (C) 2014 Greenbone Networks GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#}

{% extends "base.j2" %}
{% from "macros.j2" import panel, label_value, add_button, edit_button, delete_button %}
{% block title %}Document{% endblock %}

{% set active='document' %}

{% block content %}
<div class='clearfix page-header'>
  <h1>{{ cvrf._title }} <small>({{ cvrf._type }})</small></h1>
  <div class="pull-right">{{ edit_button(url_for('.edit_title'), "edit title") }}</div>
</div>
{% call panel(heading="Publisher", title=3, collapsible=False) %}
  <div class="pull-right">{{ edit_button(url_for('.edit_publisher')) }}</div>
  <div class="form-horizontal">
    {% for label, value in [("Type", cvrf._publisher._type),
                            ("VendorID", cvrf._publisher._vendorid or ''),
                            ("Contact Details", (cvrf._publisher._contact or '') | replace('\n', '<br>')),
                            ("Issuing Authority", (cvrf._publisher._authority or '') | replace('\n', '<br>'))] %}
      {{ label_value(label, value, right=8) }} {# 8: so that we reserve place for the floating 'edit'#}
    {% endfor %}
  </div>
{% endcall %}
{% call panel(heading="Document Tracking", title=3, collapsible=False) %}
  <div class="pull-right">{{ edit_button(url_for('.edit_tracking')) }}</div>
  <div class="form-horizontal">
    {% for label, value in [("Identification", cvrf._tracking._identification),
                            ("Status", cvrf._tracking._status),
                            ("Version", cvrf._tracking._version | join('.'))] %}
      {{ label_value(label, value, right=8) }}
    {% endfor %}
  </div>
  <ul class="list-group">
    <li class="list-group-item"><a class="a-block" data-toggle="collapse" href="#history">Revision History <span class="pull-right badge">{{ cvrf._tracking._history | length }}</span></li>
    <div id="history" class="collapse">
    {% for revision in cvrf._tracking._history %}
      <li class="list-group-item">
        <div class="form-horizontal">
          <div class="pull-right">
            {{ edit_button(url_for('.edit_revision', index=loop.index0)) }}
            {{ delete_button(url_for('.del_revision', index=loop.index0)) }}
          </div>
          {{ label_value('Number', revision._number | join('.'), right=8) }}
          {{ label_value('Date', revision._date) }}
          {{ label_value('Description', revision._description) }}
        </div>
      </li>
    {% endfor %}
    <li class="list-group-item clearfix">
      <div class="pull-right">{{ add_button(url_for('.add_revision'), "add revision") }}</div>
    </li>
    </div>
  </ul>
  <div class="form-horizontal">
    {% for label, value in [("Initial Release Date", cvrf._tracking._initialDate),
                            ("Current Release Date", cvrf._tracking._currentDate)] %}
      {{ label_value(label, value) }}
    {% endfor %}
  </div>
  {% if cvrf._tracking._generator %}
    {% call panel(heading="Generator", title=4, collapsible=False) %}
      <div class="form-horizontal">
        {% if cvrf._tracking._generator._engine %}{{ label_value('Engine', cvrf._tracking._generator._engine) }}{% endif %}
        {% if cvrf._tracking._generator._date %}{{ label_value('Date', cvrf._tracking._generator._date) }}{% endif %}
      </div>
    {% endcall %}
  {% endif %}
{% endcall %}
{% call panel(heading="Distribution", title=3, collapsible=False) %}
  <div class="pull-right">{{ edit_button(url_for('.edit_distribution')) }}</div>
  <p>{{ (cvrf._distribution or '') | replace('\n', '<br>') }}</p>
{% endcall %}
{% call panel(heading="Aggregate Severity", title=3, collapsible=False) %}
  <div class="form-horizontal">
  <div class="pull-right">{{ edit_button(url_for('.edit_severity')) }}</div>
  {% if cvrf._aggregateseverity %}
    {{ label_value('Namespace', (cvrf._aggregateseverity._namespace or '') | urlize, right=8) }}
    {{ label_value('Severity', cvrf._aggregateseverity._severity) }}
  {% endif %}
  </div>
{% endcall %}
<div class="clearfix">
  <div class="col-sm-4">
    {% call panel(type="success", heading="Notes", badge=cvrf._notes | length , title=3) %}
    <ul>
    {% for note in cvrf._notes %}
      <li><a href="{{ url_for('.view_note', ordinal=note._ordinal) }}">{{ note.getTitle() }}</a></li>
    {% endfor %}
    </ul>
    <div class="pull-right">{{ add_button(url_for('.add_note')) }}</div>
    {% endcall %}
  </div>
  <div class="col-sm-4">
    {% call panel(type="warning", heading="References", badge=cvrf._references | length, title=3) %}
    <ul>
    {% for reference in cvrf._references %}
      <li>
        <a href="{{ reference._url }}" target="_blank">
          {{ reference._description }}{% if reference._type %} ({{ reference._type }}){% endif %}
        </a>
        {{ edit_button(url_for('.edit_reference', index=loop.index0)) }}
        {{ delete_button(url_for('.del_reference', index=loop.index0)) }}
      </li>
    {% endfor %}
    </ul>
    <div class="pull-right">{{ add_button(url_for('.add_reference')) }}</div>
    {% endcall %}
  </div>
  <div class="col-sm-4">
    {% call panel(type="info", heading="Acknowledgments", badge=cvrf._acknowledgments | length, title=3) %}
    <ul>
    {% for ack in cvrf._acknowledgments %}
      <li><a href="{{ url_for('.view_acknowledgment', index=loop.index0) }}">{{ ack.getTitle() }}</a></li>
    {% endfor %}
    </ul>
    <div class="pull-right">{{ add_button(url_for('.add_acknowledgment')) }}</div>
    {% endcall %}
  </div>
</div>


<div class="clearfix">
  <div class="col-md-6">
    {% call panel(type="danger", heading="Product Tree", title=3, collapsible=False) %}
      {% if cvrf._producttree %}
        <p>{{ cvrf._producttree._products | length }} Products defined</p>
        <a href="{{ url_for('producttree.view') }}">View</a>
      {% else %}
        <em>No Product tree present</em>
        <form action="{{ url_for('producttree.create') }}" method="POST" name="createProdTree">
          <a href="#" onclick="createProdTree.submit()" class="pull-right">create</a>
        </form>
      {% endif %}
    {% endcall %}
  </div>

  <div class="col-md-6">
    {% call panel(type="primary", heading="Vulnerabilities", badge=cvrf._vulnerabilities | length, title=3) %}
    <ul>
      {% for vulnerability in cvrf._vulnerabilities %}
        <li><a href="{{ url_for('vulnerability.view', ordinal=vulnerability._ordinal) }}">{{ vulnerability.getTitle() }}</a></li>
      {% endfor %}
    </ul>
    <div class="pull-right">{{ add_button(url_for('vulnerability.add')) }}</div>
    {% endcall %}
  </div>
</div>
<div class="pull-right"><a href="#delete_modal" data-toggle="modal" class="btn btn-danger btn-xs" role="btn">delete</a></div>
{% call modal('delete_modal', 'Delete document') %}
  <p>This will delete the document <strong>{{ current_id }}</strong>.</p>
  <p>Are you sure ?</p>
</div>
<div class="modal-footer">
  <button type="button" class="btn btn-link" data-dismiss="modal">Cancel</button>
  {{ POST_button(url_for('.delete'), text="Delete " + cvrf.getDocId(), style="btn-danger") }}
{% endcall %}
{% endblock %}

http://farol.wald.intevation.org