comparison farol/templates/document/view.j2 @ 7:8f41bb7f4681

Move the Document management routines to a document Blueprint
author Benoît Allard <benoit.allard@greenbone.net>
date Thu, 25 Sep 2014 17:03:35 +0200
parents farol/templates/doc.j2@4a9f23230eba
children 79b76911444e
comparison
equal deleted inserted replaced
6:bb7334ff114a 7:8f41bb7f4681
1 {#
2 # Description:
3 # Web Template used in Farol Design
4 #
5 # Authors:
6 # BenoƮt Allard <benoit.allard@greenbone.net>
7 #
8 # Copyright:
9 # Copyright (C) 2014 Greenbone Networks GmbH
10 #
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License
13 # as published by the Free Software Foundation; either version 2
14 # of the License, or (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24 -#}
25
26 {% extends "base.j2" %}
27 {% from "macros.j2" import panel, label_value %}
28 {% block title %}Document{% endblock %}
29
30 {% set active='document' %}
31
32 {% block content %}
33 <div class='clearfix page-header'>
34 <h1>{{ cvrf._title }} <small>({{ cvrf._type }})</small></h1>
35 <a class="pull-right" href="{{ url_for('.edit_title') }}">edit title</a>
36 </div>
37 {% call panel(heading="Publisher", title=3, collapsible=False) %}
38 <a class="pull-right" href="{{ url_for('.edit_publisher') }}">edit</a>
39 <div class="form-horizontal">
40 {% for label, value in [("Type", cvrf._publisher._type),
41 ("VendorID", cvrf._publisher._vendorid or ''),
42 ("Contact Details", (cvrf._publisher._contact or '') | replace('\n', '<br>')),
43 ("Issuing Authority", (cvrf._publisher._authority or '') | replace('\n', '<br>'))] %}
44 {{ label_value(label, value, right=8) }} {# 8: so that we reserve place for the floating 'edit'#}
45 {% endfor %}
46 </div>
47 {% endcall %}
48 {% call panel(heading="Document Tracking", title=3, collapsible=False) %}
49 <a class="pull-right" href="{{ url_for('.edit_tracking') }}">edit</a>
50 <div class="form-horizontal">
51 {% for label, value in [("Identification", cvrf._tracking._identification),
52 ("Status", cvrf._tracking._status),
53 ("Version", cvrf._tracking._version | join('.'))] %}
54 {{ label_value(label, value, right=8) }}
55 {% endfor %}
56 </div>
57 {% call panel(heading="Revision History (%d)" % cvrf._tracking._history | length, title=4) %}
58 {% for revision in cvrf._tracking._history %}
59 {% call panel() %}
60 <div class="form-horizontal">
61 <a class="pull-right" href="{{ url_for('.edit_revision', index=loop.index0) }}">edit revision</a>
62 {{ label_value('Number', revision._number | join('.'), right=8) }}
63 {{ label_value('Date', revision._date) }}
64 {{ label_value('Description', revision._description) }}
65 </div>
66 {% endcall %}
67 {% endfor %}
68 <a class="pull-right" href="{{ url_for('.add_revision') }}">add revision</a>
69 {% endcall %}
70 <div class="form-horizontal">
71 {% for label, value in [("Initial Release Date", cvrf._tracking._initialDate),
72 ("Current Release Date", cvrf._tracking._currentDate)] %}
73 {{ label_value(label, value) }}
74 {% endfor %}
75 </div>
76 {% if cvrf._tracking._generator %}
77 {% call panel(heading="Generator", title=4, collapsible=False) %}
78 <div class="form-horizontal">
79 {% if cvrf._tracking._generator._engine %}{{ label_value('Engine', cvrf._tracking._generator._engine) }}{% endif %}
80 {% if cvrf._tracking._generator._date %}{{ label_value('Date', cvrf._tracking._generator._date) }}{% endif %}
81 </div>
82 {% endcall %}
83 {% endif %}
84 {% endcall %}
85 {% call panel(heading="Distribution", title=3, collapsible=False) %}
86 <a class="pull-right" href="{{ url_for('.edit_distribution') }}">edit</a>
87 <p>{{ (cvrf._distribution or '') | replace('\n', '<br>') }}</p>
88 {% endcall %}
89 {% call panel(heading="Aggregate Severity", title=3, collapsible=False) %}
90 <div class="form-horizontal">
91 <a class="pull-right" href="{{ url_for('.edit_severity') }}">edit</a>
92 {% if cvrf._aggregateseverity %}
93 {{ label_value('Namespace', (cvrf._aggregateseverity._namespace or '') | urlize, right=8) }}
94 {{ label_value('Severity', cvrf._aggregateseverity._severity) }}
95 {% endif %}
96 </div>
97 {% endcall %}
98 <div class="clearfix">
99 <div class="col-sm-4">
100 {% call panel(type="success", heading="Notes (%d)" % cvrf._notes | length , title=3) %}
101 <ul>
102 {% for note in cvrf._notes %}
103 <li><a href="{{ url_for('.view_note', ordinal=note._ordinal) }}">{{ note.getTitle() }}</a></li>
104 {% endfor %}
105 </ul>
106 <a class="pull-right" href="{{ url_for('.add_note') }}">add</a>
107 {% endcall %}
108 </div>
109 <div class="col-sm-4">
110 {% call panel(type="warning", heading="References (%d)" % cvrf._references | length, title=3) %}
111 <ul>
112 {% for reference in cvrf._references %}
113 <li><a href="{{ reference._url }}" target="_blank">{{ reference._description }}{% if reference._type %} ({{ reference._type }}){% endif %}</a> (<a href="{{ url_for('.edit_reference', index=loop.index0) }}">edit</a>)</li>
114 {% endfor %}
115 </ul>
116 <a class="pull-right" href="{{ url_for('.add_reference') }}">add</a>
117 {% endcall %}
118 </div>
119 <div class="col-sm-4">
120 {% call panel(type="info", heading="Acknowledgments (%d)" % cvrf._acknowledgments | length, title=3) %}
121 <ul>
122 {% for ack in cvrf._acknowledgments %}
123 <li><a href="{{ url_for('.view_acknowledgment', index=loop.index0) }}">{{ ack.getTitle() }}</a></li>
124 {% endfor %}
125 </ul>
126 <a class="pull-right" href="{{ url_for('.add_acknowledgment') }}">add</a>
127 {% endcall %}
128 </div>
129 </div>
130
131
132 <div class="clearfix">
133 <div class="col-md-6">
134 {% call panel(type="danger", heading="Product Tree", title=3) %}
135 {% if cvrf._producttree %}
136 {% call panel(heading="Branches (%d)" % cvrf._producttree._branches | length, title=4, extended=True) %}
137 {% for branch in cvrf._producttree._branches recursive %}
138 {% call panel() %}
139 <p>{{ branch._type}}: <em>{{ branch._name }}</em> (<a href="{{ url_for('producttree.edit_branch', path=branch.getPath() | join('/')) }}">edit</a>)</p>
140 {% if branch._product %}
141 <strong><a href="{{ url_for('producttree.view_product', productid=branch._product._productid) }}">{{ branch._product._name }}</a></strong> (<a href="{{ url_for('producttree.edit_product', productid=branch._product._productid) }}">edit</a>)
142 {% else %}
143 {{ loop(branch._childs) }}
144 {% endif %}
145 {% if branch.isOrphaned() %}
146 <p class="text-danger">This branch is <em>orphaned</em>. A <a href="{{ url_for('producttree.add_product') }}">product</a> or a new <a href="{{ url_for('producttree.add_branch') }}">branch</a> should be created as child of this one.</p>
147 {% endif %}
148 {% endcall %}
149 {% endfor %}
150 <a href="{{ url_for('producttree.add_branch') }}" class="pull-right">add branch</a>
151 {% endcall %}
152 {% call panel(heading="Products (%d)" % cvrf._producttree.nbProducts(), title=4) %}
153 {% for product in cvrf._producttree._products if product._parent is sameas cvrf._producttree %}
154 <p><strong><a href="{{ url_for('producttree.view_product', productid=product._productid) }}">{{ product._name }}</a></strong> (<a href="{{ url_for('producttree.edit_product', productid=product._productid) }}">edit</a>)</p>
155 {% endfor %}
156 <a href="{{ url_for('producttree.add_product') }}" class="pull-right">add product</a>
157 {% endcall %}
158 {% call panel(heading="Relationships (%d)" % cvrf._producttree._relationships | length, title=4) %}
159 {% for relationship in cvrf._producttree._relationships %}
160 {% call panel() %}
161 <p><em>{{ cvrf.getProductForID(relationship._productreference)._name }}</em> as {{ relationship._relationtype | lower }} <em>{{ cvrf.getProductForID(relationship._relatestoproductreference)._name }}</em> (<a href="{{ url_for('producttree.edit_relationship', index=loop.index0) }}">edit</a>)</p>
162 {% if relationship._product %}<p><strong><a href="{{ url_for('producttree.view_product', productid=relationship._product._productid) }}">{{ relationship._product._name }}</a></strong> (<a href="{{ url_for('producttree.edit_product', productid=relationship._product._productid) }}">edit</a>)</p>{% endif %}
163 {% if relationship.isOrphaned() %}
164 <p class="text-danger">This relationship is <em>orphaned</em>. A product should be <a href="{{ url_for('producttree.add_product') }}">created</a> as child of this one.</p>
165 {% endif %}
166 {% endcall %}
167 {% endfor %}
168 <a href="{{ url_for('producttree.add_relationship') }}" class="pull-right">add</a>
169 {% endcall %}
170 {% call panel(heading="Groups (%d)" % cvrf._producttree._groups | length, title=4) %}
171 {% for group in cvrf._producttree._groups %}
172 {% call panel() %}
173 <a href="{{ url_for('producttree.edit_group', groupid=group._groupid) }}" class="pull-right">edit</a>
174 <ul>
175 {% for productid in group._productids %}
176 {% with product = cvrf.getProductForID(productid) %}
177 <li><a href="{{ url_for('producttree.view_product', productid=product._productid) }}">{{ product._name }}</a></li>
178 {% endwith %}
179 {% endfor %}
180 </ul>
181 {% if group._description %}<p class="small">{{ group._description }}</p>{% endif %}
182 {% endcall %}
183 {% endfor %}
184 <a href="{{ url_for('producttree.add_group') }}" class="pull-right">add</a>
185 {% endcall %}
186 {% else %}
187 <em>No Product tree present</em>
188 <form action="{{ url_for('producttree.create') }}" method="POST" name="createProdTree">
189 <a href="#" onclick="createProdTree.submit()" class="pull-right">create</a>
190 </form>
191 {% endif %}
192 {% endcall %}
193 </div>
194
195 <div class="col-md-6">
196 {% call panel(type="primary", heading="Vulnerabilities (%d)" % cvrf._vulnerabilities | length, title=3) %}
197 <ul>
198 {% for vulnerability in cvrf._vulnerabilities %}
199 <li><a href="{{ url_for('vulnerability.view', ordinal=vulnerability._ordinal) }}">{{ vulnerability.getTitle() }}</a></li>
200 {% endfor %}
201 </ul>
202 <a href="{{ url_for('vulnerability.add') }}" class="pull-right">add</a>
203 {% endcall %}
204 </div>
205 </div>
206 {% endblock %}

http://farol.wald.intevation.org