Mercurial > farol > farol
annotate 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 |
rev | line source |
---|---|
0 | 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" %} | |
105
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
27 {% from "macros.j2" import panel, label_value, add_button, edit_button, delete_button %} |
0 | 28 {% block title %}Document{% endblock %} |
29 | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
30 {% set active='document' %} |
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
31 |
0 | 32 {% block content %} |
33 <div class='clearfix page-header'> | |
34 <h1>{{ cvrf._title }} <small>({{ cvrf._type }})</small></h1> | |
105
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
35 <div class="pull-right">{{ edit_button(url_for('.edit_title'), "edit title") }}</div> |
0 | 36 </div> |
37 {% call panel(heading="Publisher", title=3, collapsible=False) %} | |
105
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
38 <div class="pull-right">{{ edit_button(url_for('.edit_publisher')) }}</div> |
0 | 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) %} | |
105
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
49 <div class="pull-right">{{ edit_button(url_for('.edit_tracking')) }}</div> |
0 | 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> | |
31
79b76911444e
Improve the display of the history
Benoît Allard <benoit.allard@greenbone.net>
parents:
7
diff
changeset
|
57 <ul class="list-group"> |
79b76911444e
Improve the display of the history
Benoît Allard <benoit.allard@greenbone.net>
parents:
7
diff
changeset
|
58 <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> |
79b76911444e
Improve the display of the history
Benoît Allard <benoit.allard@greenbone.net>
parents:
7
diff
changeset
|
59 <div id="history" class="collapse"> |
0 | 60 {% for revision in cvrf._tracking._history %} |
31
79b76911444e
Improve the display of the history
Benoît Allard <benoit.allard@greenbone.net>
parents:
7
diff
changeset
|
61 <li class="list-group-item"> |
0 | 62 <div class="form-horizontal"> |
67
023080ffd995
Allow deletion of revisions
Benoît Allard <benoit.allard@greenbone.net>
parents:
45
diff
changeset
|
63 <div class="pull-right"> |
105
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
64 {{ edit_button(url_for('.edit_revision', index=loop.index0)) }} |
73 | 65 {{ delete_button(url_for('.del_revision', index=loop.index0)) }} |
67
023080ffd995
Allow deletion of revisions
Benoît Allard <benoit.allard@greenbone.net>
parents:
45
diff
changeset
|
66 </div> |
0 | 67 {{ label_value('Number', revision._number | join('.'), right=8) }} |
68 {{ label_value('Date', revision._date) }} | |
69 {{ label_value('Description', revision._description) }} | |
70 </div> | |
31
79b76911444e
Improve the display of the history
Benoît Allard <benoit.allard@greenbone.net>
parents:
7
diff
changeset
|
71 </li> |
0 | 72 {% endfor %} |
31
79b76911444e
Improve the display of the history
Benoît Allard <benoit.allard@greenbone.net>
parents:
7
diff
changeset
|
73 <li class="list-group-item clearfix"> |
105
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
74 <div class="pull-right">{{ add_button(url_for('.add_revision'), "add revision") }}</div> |
31
79b76911444e
Improve the display of the history
Benoît Allard <benoit.allard@greenbone.net>
parents:
7
diff
changeset
|
75 </li> |
79b76911444e
Improve the display of the history
Benoît Allard <benoit.allard@greenbone.net>
parents:
7
diff
changeset
|
76 </div> |
79b76911444e
Improve the display of the history
Benoît Allard <benoit.allard@greenbone.net>
parents:
7
diff
changeset
|
77 </ul> |
0 | 78 <div class="form-horizontal"> |
79 {% for label, value in [("Initial Release Date", cvrf._tracking._initialDate), | |
80 ("Current Release Date", cvrf._tracking._currentDate)] %} | |
81 {{ label_value(label, value) }} | |
82 {% endfor %} | |
83 </div> | |
84 {% if cvrf._tracking._generator %} | |
85 {% call panel(heading="Generator", title=4, collapsible=False) %} | |
86 <div class="form-horizontal"> | |
87 {% if cvrf._tracking._generator._engine %}{{ label_value('Engine', cvrf._tracking._generator._engine) }}{% endif %} | |
88 {% if cvrf._tracking._generator._date %}{{ label_value('Date', cvrf._tracking._generator._date) }}{% endif %} | |
89 </div> | |
90 {% endcall %} | |
91 {% endif %} | |
92 {% endcall %} | |
93 {% call panel(heading="Distribution", title=3, collapsible=False) %} | |
105
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
94 <div class="pull-right">{{ edit_button(url_for('.edit_distribution')) }}</div> |
0 | 95 <p>{{ (cvrf._distribution or '') | replace('\n', '<br>') }}</p> |
96 {% endcall %} | |
97 {% call panel(heading="Aggregate Severity", title=3, collapsible=False) %} | |
98 <div class="form-horizontal"> | |
105
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
99 <div class="pull-right">{{ edit_button(url_for('.edit_severity')) }}</div> |
0 | 100 {% if cvrf._aggregateseverity %} |
101 {{ label_value('Namespace', (cvrf._aggregateseverity._namespace or '') | urlize, right=8) }} | |
102 {{ label_value('Severity', cvrf._aggregateseverity._severity) }} | |
103 {% endif %} | |
104 </div> | |
105 {% endcall %} | |
106 <div class="clearfix"> | |
107 <div class="col-sm-4"> | |
32
9b0fb5ca7eff
Replace the (%d)s with badges
Benoît Allard <benoit.allard@greenbone.net>
parents:
31
diff
changeset
|
108 {% call panel(type="success", heading="Notes", badge=cvrf._notes | length , title=3) %} |
0 | 109 <ul> |
110 {% for note in cvrf._notes %} | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
111 <li><a href="{{ url_for('.view_note', ordinal=note._ordinal) }}">{{ note.getTitle() }}</a></li> |
0 | 112 {% endfor %} |
113 </ul> | |
105
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
114 <div class="pull-right">{{ add_button(url_for('.add_note')) }}</div> |
0 | 115 {% endcall %} |
116 </div> | |
117 <div class="col-sm-4"> | |
32
9b0fb5ca7eff
Replace the (%d)s with badges
Benoît Allard <benoit.allard@greenbone.net>
parents:
31
diff
changeset
|
118 {% call panel(type="warning", heading="References", badge=cvrf._references | length, title=3) %} |
0 | 119 <ul> |
120 {% for reference in cvrf._references %} | |
105
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
121 <li> |
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
122 <a href="{{ reference._url }}" target="_blank"> |
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
123 {{ reference._description }}{% if reference._type %} ({{ reference._type }}){% endif %} |
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
124 </a> |
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
125 {{ edit_button(url_for('.edit_reference', index=loop.index0)) }} |
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
126 {{ delete_button(url_for('.del_reference', index=loop.index0)) }} |
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
127 </li> |
0 | 128 {% endfor %} |
129 </ul> | |
105
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
130 <div class="pull-right">{{ add_button(url_for('.add_reference')) }}</div> |
0 | 131 {% endcall %} |
132 </div> | |
133 <div class="col-sm-4"> | |
32
9b0fb5ca7eff
Replace the (%d)s with badges
Benoît Allard <benoit.allard@greenbone.net>
parents:
31
diff
changeset
|
134 {% call panel(type="info", heading="Acknowledgments", badge=cvrf._acknowledgments | length, title=3) %} |
0 | 135 <ul> |
136 {% for ack in cvrf._acknowledgments %} | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
137 <li><a href="{{ url_for('.view_acknowledgment', index=loop.index0) }}">{{ ack.getTitle() }}</a></li> |
0 | 138 {% endfor %} |
139 </ul> | |
105
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
140 <div class="pull-right">{{ add_button(url_for('.add_acknowledgment')) }}</div> |
0 | 141 {% endcall %} |
142 </div> | |
143 </div> | |
144 | |
145 | |
146 <div class="clearfix"> | |
147 <div class="col-md-6"> | |
45
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
32
diff
changeset
|
148 {% call panel(type="danger", heading="Product Tree", title=3, collapsible=False) %} |
0 | 149 {% if cvrf._producttree %} |
45
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
32
diff
changeset
|
150 <p>{{ cvrf._producttree._products | length }} Products defined</p> |
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
32
diff
changeset
|
151 <a href="{{ url_for('producttree.view') }}">View</a> |
0 | 152 {% else %} |
153 <em>No Product tree present</em> | |
154 <form action="{{ url_for('producttree.create') }}" method="POST" name="createProdTree"> | |
155 <a href="#" onclick="createProdTree.submit()" class="pull-right">create</a> | |
156 </form> | |
157 {% endif %} | |
158 {% endcall %} | |
159 </div> | |
160 | |
161 <div class="col-md-6"> | |
32
9b0fb5ca7eff
Replace the (%d)s with badges
Benoît Allard <benoit.allard@greenbone.net>
parents:
31
diff
changeset
|
162 {% call panel(type="primary", heading="Vulnerabilities", badge=cvrf._vulnerabilities | length, title=3) %} |
0 | 163 <ul> |
164 {% for vulnerability in cvrf._vulnerabilities %} | |
165 <li><a href="{{ url_for('vulnerability.view', ordinal=vulnerability._ordinal) }}">{{ vulnerability.getTitle() }}</a></li> | |
166 {% endfor %} | |
167 </ul> | |
105
09915cbdf549
Unify the add / edit / delete buttons
Benoît Allard <benoit.allard@greenbone.net>
parents:
73
diff
changeset
|
168 <div class="pull-right">{{ add_button(url_for('vulnerability.add')) }}</div> |
0 | 169 {% endcall %} |
170 </div> | |
171 </div> | |
132
812e613cbbb4
Add possibility to delete the current document.
Benoît Allard <benoit.allard@greenbone.net>
parents:
105
diff
changeset
|
172 <div class="pull-right"><a href="#delete_modal" data-toggle="modal" class="btn btn-danger btn-xs" role="btn">delete</a></div> |
812e613cbbb4
Add possibility to delete the current document.
Benoît Allard <benoit.allard@greenbone.net>
parents:
105
diff
changeset
|
173 {% call modal('delete_modal', 'Delete document') %} |
812e613cbbb4
Add possibility to delete the current document.
Benoît Allard <benoit.allard@greenbone.net>
parents:
105
diff
changeset
|
174 <p>This will delete the document <strong>{{ current_id }}</strong>.</p> |
812e613cbbb4
Add possibility to delete the current document.
Benoît Allard <benoit.allard@greenbone.net>
parents:
105
diff
changeset
|
175 <p>Are you sure ?</p> |
812e613cbbb4
Add possibility to delete the current document.
Benoît Allard <benoit.allard@greenbone.net>
parents:
105
diff
changeset
|
176 </div> |
812e613cbbb4
Add possibility to delete the current document.
Benoît Allard <benoit.allard@greenbone.net>
parents:
105
diff
changeset
|
177 <div class="modal-footer"> |
812e613cbbb4
Add possibility to delete the current document.
Benoît Allard <benoit.allard@greenbone.net>
parents:
105
diff
changeset
|
178 <button type="button" class="btn btn-link" data-dismiss="modal">Cancel</button> |
812e613cbbb4
Add possibility to delete the current document.
Benoît Allard <benoit.allard@greenbone.net>
parents:
105
diff
changeset
|
179 {{ POST_button(url_for('.delete'), text="Delete " + cvrf.getDocId(), style="btn-danger") }} |
812e613cbbb4
Add possibility to delete the current document.
Benoît Allard <benoit.allard@greenbone.net>
parents:
105
diff
changeset
|
180 {% endcall %} |
0 | 181 {% endblock %} |