Mercurial > farol > farol
comparison farol/templates/producttree/view_product.j2 @ 106:4ea7966dcc99
Show where a Product is referenced in the Document.
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Tue, 14 Oct 2014 16:52:55 +0200 |
parents | 09915cbdf549 |
children | 1feed9a3156e |
comparison
equal
deleted
inserted
replaced
105:09915cbdf549 | 106:4ea7966dcc99 |
---|---|
32 {% block content %} | 32 {% block content %} |
33 <div class="pull-right">{{ edit_button(url_for('.edit_product', productid=product._productid)) }}</div> | 33 <div class="pull-right">{{ edit_button(url_for('.edit_product', productid=product._productid)) }}</div> |
34 <div class='page-header'> | 34 <div class='page-header'> |
35 <h1>{{ product._name }}{% if product._cpe %} <small>{{ product._cpe }}</small>{% endif %}</h1> | 35 <h1>{{ product._name }}{% if product._cpe %} <small>{{ product._cpe }}</small>{% endif %}</h1> |
36 </div> | 36 </div> |
37 {% if product.isRoot() %} | 37 |
38 <p>This product is defined without relation to other elements</p> | 38 {% if product.isRelationship() %} |
39 {% elif product.isRelationship() %} | 39 <p>This product is defined by the following relationship:</p> |
40 <p>This product is part of the following relationship:</p> | |
41 {% set prodref = cvrf.getProductForID(product._parent._productreference) %} | 40 {% set prodref = cvrf.getProductForID(product._parent._productreference) %} |
42 {% set relatesto = cvrf.getProductForID(product._parent._relatestoproductreference) %} | 41 {% set relatesto = cvrf.getProductForID(product._parent._relatestoproductreference) %} |
43 <p><a href="{{ url_for('.view_product', productid=prodref._productid) }}">{{ prodref._name }}</a> as <em>{{ product._parent._relationtype | lower }}</em> <a href="{{ url_for('.view_product', productid=relatesto._productid) }}">{{ relatesto._name }}</a><p> | 42 <p><a href="{{ url_for('.view_product', productid=prodref._productid) }}">{{ prodref._name }}</a> as <em>{{ product._parent._relationtype | lower }}</em> <a href="{{ url_for('.view_product', productid=relatesto._productid) }}">{{ relatesto._name }}</a><p> |
44 {% else %} | 43 {% elif not product.isRoot() %} |
45 {% call panel(heading="Tree", title=3, collapsible=False) %} | 44 {% call panel(heading="Tree", title=3, collapsible=False) %} |
46 {% for type, name in product.getTree() %} | 45 {% for type, name in product.getTree() %} |
47 <ul><li>{{ type }}: <em>{{ name }}</em></li> | 46 <ul><li>{{ type }}: <em>{{ name }}</em></li> |
48 {% if loop.last %}{{ '</ul>' * loop.index }}{% endif %} | 47 {% if loop.last %}{{ '</ul>' * loop.index }}{% endif %} |
49 {% endfor %} | 48 {% endfor %} |
50 {% endcall %} | 49 {% endcall %} |
51 {% endif %} | 50 {% endif %} |
52 | 51 |
53 <div> | 52 {% call panel(heading="Relationships", title=3, collapsible=False) %} |
54 <p>This product belong to the following groups:</p> | 53 <p>This product is part of the following relationships:</p> |
55 <ul> | 54 <ul> |
56 {% for group in cvrf._producttree._groups if product._productid in group._productids %} | 55 {% for relationship in cvrf._producttree._relationships if product._productid in (relationship._productreference, relationship._relatestoproductreference) %} |
57 <li>{{ group.getTitle() }}</li> | 56 {% set prodref2 = cvrf.getProductForID(relationship._productreference) %} |
58 {% else %} | 57 {% set relatesto2 = cvrf.getProductForID(relationship._relatestoproductreference) %} |
59 <li><em>None</em></li> | 58 <li><a href="{{ url_for('.view_product', productid=prodref2._productid) }}">{{ prodref2._name }}</a> as <em>{{ relationship._relationtype | lower }}</em> <a href="{{ url_for('.view_product', productid=relatesto2._productid) }}">{{ relatesto2._name }}</a></li> |
60 {% endfor %} | 59 {% else %} |
61 </ul> | 60 <li><em>None</em></li> |
61 {% endfor %} | |
62 </ul> | |
63 {% endcall %} | |
64 | |
65 {% call panel(heading="Groups", title=3, collapsible=False) %} | |
66 <p>This product belong to the following groups:</p> | |
67 <ul> | |
68 {% for group in groups %} | |
69 <li>{{ group.getTitle() }}</li> | |
70 {% else %} | |
71 <li><em>None</em></li> | |
72 {% endfor %} | |
73 </ul> | |
74 {% endcall %} | |
75 | |
76 {% call panel(heading="Vulnerabilities", title="3", collapsible=False) %} | |
77 <p>The following Vulneralibities are mentionning this product:</p> | |
78 <ul> | |
79 {% for vulnerability in cvrf._vulnerabilities if ( | |
80 vulnerability.isMentioningProdId(product._productid) or | |
81 vulnerability.isMentioningGroupId(groups | map(attribute="_groupid") | list)) %} | |
82 <li> | |
83 <a href="{{ url_for('vulnerability.view', ordinal=vulnerability._ordinal) }}">{{ vulnerability.getTitle() }}</a> | |
84 {% set elements = vulnerability.mentionsProdId(product._productid) | list %} | |
85 {% for group in groups %} | |
86 {{ elements.extend(vulnerability.mentionsGroupId(group._groupid) | list) or '' }} | |
87 {% endfor %} | |
88 {% set comma = joiner(', ') %} | |
89 ( | |
90 {%- for grouper, list in elements | groupby('NAME') %}{{ comma() -}} | |
91 {{ grouper }}{% if list | length > 1 %}(x{{ list | length }}){% endif %} | |
92 {%- endfor -%} | |
93 ) | |
94 </li> | |
95 {% else %} | |
96 <li><em>None</em></li> | |
97 {% endfor %} | |
98 </ul> | |
99 {% endcall %} | |
100 <div class="pull-right"> | |
101 {% if cvrf.isProductOrphan(product._productid) %} | |
102 {{ delete_button(url_for('.del_product', productid=product._productid)) }} | |
103 {% else %} | |
104 <p class="text-danger"><small>This product cannot be deleted, as it is referenced in the document</small></p> | |
105 {% endif %} | |
62 </div> | 106 </div> |
63 <div class="pull-right">{{ delete_button(url_for('.del_product', productid=product._productid)) }}</div> | |
64 {% endblock %} | 107 {% endblock %} |