comparison farol/templates/doc.j2 @ 0:4a9f23230eba

Initial Release
author Benoît Allard <benoit.allard@greenbone.net>
date Wed, 24 Sep 2014 10:07:49 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4a9f23230eba
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 {% block content %}
31 <div class='clearfix page-header'>
32 <h1>{{ cvrf._title }} <small>({{ cvrf._type }})</small></h1>
33 <a class="pull-right" href="{{ url_for('edit_title') }}">edit title</a>
34 </div>
35 {% call panel(heading="Publisher", title=3, collapsible=False) %}
36 <a class="pull-right" href="{{ url_for('edit_publisher') }}">edit</a>
37 <div class="form-horizontal">
38 {% for label, value in [("Type", cvrf._publisher._type),
39 ("VendorID", cvrf._publisher._vendorid or ''),
40 ("Contact Details", (cvrf._publisher._contact or '') | replace('\n', '<br>')),
41 ("Issuing Authority", (cvrf._publisher._authority or '') | replace('\n', '<br>'))] %}
42 {{ label_value(label, value, right=8) }} {# 8: so that we reserve place for the floating 'edit'#}
43 {% endfor %}
44 </div>
45 {% endcall %}
46 {% call panel(heading="Document Tracking", title=3, collapsible=False) %}
47 <a class="pull-right" href="{{ url_for('edit_tracking') }}">edit</a>
48 <div class="form-horizontal">
49 {% for label, value in [("Identification", cvrf._tracking._identification),
50 ("Status", cvrf._tracking._status),
51 ("Version", cvrf._tracking._version | join('.'))] %}
52 {{ label_value(label, value, right=8) }}
53 {% endfor %}
54 </div>
55 {% call panel(heading="Revision History (%d)" % cvrf._tracking._history | length, title=4) %}
56 {% for revision in cvrf._tracking._history %}
57 {% call panel() %}
58 <div class="form-horizontal">
59 <a class="pull-right" href="{{ url_for('edit_revision', index=loop.index0) }}">edit revision</a>
60 {{ label_value('Number', revision._number | join('.'), right=8) }}
61 {{ label_value('Date', revision._date) }}
62 {{ label_value('Description', revision._description) }}
63 </div>
64 {% endcall %}
65 {% endfor %}
66 <a class="pull-right" href="{{ url_for('add_revision') }}">add revision</a>
67 {% endcall %}
68 <div class="form-horizontal">
69 {% for label, value in [("Initial Release Date", cvrf._tracking._initialDate),
70 ("Current Release Date", cvrf._tracking._currentDate)] %}
71 {{ label_value(label, value) }}
72 {% endfor %}
73 </div>
74 {% if cvrf._tracking._generator %}
75 {% call panel(heading="Generator", title=4, collapsible=False) %}
76 <div class="form-horizontal">
77 {% if cvrf._tracking._generator._engine %}{{ label_value('Engine', cvrf._tracking._generator._engine) }}{% endif %}
78 {% if cvrf._tracking._generator._date %}{{ label_value('Date', cvrf._tracking._generator._date) }}{% endif %}
79 </div>
80 {% endcall %}
81 {% endif %}
82 {% endcall %}
83 {% call panel(heading="Distribution", title=3, collapsible=False) %}
84 <a class="pull-right" href="{{ url_for('edit_distribution') }}">edit</a>
85 <p>{{ (cvrf._distribution or '') | replace('\n', '<br>') }}</p>
86 {% endcall %}
87 {% call panel(heading="Aggregate Severity", title=3, collapsible=False) %}
88 <div class="form-horizontal">
89 <a class="pull-right" href="{{ url_for('edit_severity') }}">edit</a>
90 {% if cvrf._aggregateseverity %}
91 {{ label_value('Namespace', (cvrf._aggregateseverity._namespace or '') | urlize, right=8) }}
92 {{ label_value('Severity', cvrf._aggregateseverity._severity) }}
93 {% endif %}
94 </div>
95 {% endcall %}
96 <div class="clearfix">
97 <div class="col-sm-4">
98 {% call panel(type="success", heading="Notes (%d)" % cvrf._notes | length , title=3) %}
99 <ul>
100 {% for note in cvrf._notes %}
101 <li><a href="{{ url_for('view_note', ordinal=note._ordinal) }}">{{ note.getTitle() }}</a></li>
102 {% endfor %}
103 </ul>
104 <a class="pull-right" href="{{ url_for('add_note') }}">add</a>
105 {% endcall %}
106 </div>
107 <div class="col-sm-4">
108 {% call panel(type="warning", heading="References (%d)" % cvrf._references | length, title=3) %}
109 <ul>
110 {% for reference in cvrf._references %}
111 <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>
112 {% endfor %}
113 </ul>
114 <a class="pull-right" href="{{ url_for('add_reference') }}">add</a>
115 {% endcall %}
116 </div>
117 <div class="col-sm-4">
118 {% call panel(type="info", heading="Acknowledgments (%d)" % cvrf._acknowledgments | length, title=3) %}
119 <ul>
120 {% for ack in cvrf._acknowledgments %}
121 <li><a href="{{ url_for('view_acknowledgment', index=loop.index0) }}">{{ ack.getTitle() }}</a></li>
122 {% endfor %}
123 </ul>
124 <a class="pull-right" href="{{ url_for('add_acknowledgment') }}">add</a>
125 {% endcall %}
126 </div>
127 </div>
128
129
130 <div class="clearfix">
131 <div class="col-md-6">
132 {% call panel(type="danger", heading="Product Tree", title=3) %}
133 {% if cvrf._producttree %}
134 {% call panel(heading="Branches (%d)" % cvrf._producttree._branches | length, title=4, extended=True) %}
135 {% for branch in cvrf._producttree._branches recursive %}
136 {% call panel() %}
137 <p>{{ branch._type}}: <em>{{ branch._name }}</em> (<a href="{{ url_for('producttree.edit_branch', path=branch.getPath() | join('/')) }}">edit</a>)</p>
138 {% if branch._product %}
139 <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>)
140 {% else %}
141 {{ loop(branch._childs) }}
142 {% endif %}
143 {% if branch.isOrphaned() %}
144 <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>
145 {% endif %}
146 {% endcall %}
147 {% endfor %}
148 <a href="{{ url_for('producttree.add_branch') }}" class="pull-right">add branch</a>
149 {% endcall %}
150 {% call panel(heading="Products (%d)" % cvrf._producttree.nbProducts(), title=4) %}
151 {% for product in cvrf._producttree._products if product._parent is sameas cvrf._producttree %}
152 <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>
153 {% endfor %}
154 <a href="{{ url_for('producttree.add_product') }}" class="pull-right">add product</a>
155 {% endcall %}
156 {% call panel(heading="Relationships (%d)" % cvrf._producttree._relationships | length, title=4) %}
157 {% for relationship in cvrf._producttree._relationships %}
158 {% call panel() %}
159 <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>
160 {% 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 %}
161 {% if relationship.isOrphaned() %}
162 <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>
163 {% endif %}
164 {% endcall %}
165 {% endfor %}
166 <a href="{{ url_for('producttree.add_relationship') }}" class="pull-right">add</a>
167 {% endcall %}
168 {% call panel(heading="Groups (%d)" % cvrf._producttree._groups | length, title=4) %}
169 {% for group in cvrf._producttree._groups %}
170 {% call panel() %}
171 <a href="{{ url_for('producttree.edit_group', groupid=group._groupid) }}" class="pull-right">edit</a>
172 <ul>
173 {% for productid in group._productids %}
174 {% with product = cvrf.getProductForID(productid) %}
175 <li><a href="{{ url_for('producttree.view_product', productid=product._productid) }}">{{ product._name }}</a></li>
176 {% endwith %}
177 {% endfor %}
178 </ul>
179 {% if group._description %}<p class="small">{{ group._description }}</p>{% endif %}
180 {% endcall %}
181 {% endfor %}
182 <a href="{{ url_for('producttree.add_group') }}" class="pull-right">add</a>
183 {% endcall %}
184 {% else %}
185 <em>No Product tree present</em>
186 <form action="{{ url_for('producttree.create') }}" method="POST" name="createProdTree">
187 <a href="#" onclick="createProdTree.submit()" class="pull-right">create</a>
188 </form>
189 {% endif %}
190 {% endcall %}
191 </div>
192
193 <div class="col-md-6">
194 {% call panel(type="primary", heading="Vulnerabilities (%d)" % cvrf._vulnerabilities | length, title=3) %}
195 <ul>
196 {% for vulnerability in cvrf._vulnerabilities %}
197 <li><a href="{{ url_for('vulnerability.view', ordinal=vulnerability._ordinal) }}">{{ vulnerability.getTitle() }}</a></li>
198 {% endfor %}
199 </ul>
200 <a href="{{ url_for('vulnerability.add') }}" class="pull-right">add</a>
201 {% endcall %}
202 </div>
203 </div>
204 {% endblock %}

http://farol.wald.intevation.org