Mercurial > farol > farol
annotate farol/templates/new.j2 @ 162:07210df10edd
Add support for CVE import (from GSA)
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Tue, 30 Dec 2014 14:33:50 +0100 |
parents | 65341d05a8f8 |
children | 000114da182d |
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" %} | |
8
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
27 {% from "macros.j2" import textinput, textarea, panel %} |
34
22d89f53e34c
Add macro to display a description for the input fields
Benoît Allard <benoit.allard@greenbone.net>
parents:
28
diff
changeset
|
28 {% from "common_edits.j2" import edit_title_type %} |
0 | 29 |
30 {% set active='new' %} | |
31 | |
32 {% block title %}New{% endblock %} | |
33 | |
34 {% block content %} | |
12
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
35 {% if has_document and caching %} |
27
69e0330c4fae
Display the id of the current document when asking to save it
Benoît Allard <benoit.allard@greenbone.net>
parents:
12
diff
changeset
|
36 <p class="text-danger">You are currently editing a document: <strong>{{ current_id }}</strong>. Loading a new one will lose your modifications. Do you want to <a href={{ url_for('cache.save') }}>save</a> it first ?</p> |
0 | 37 {% endif %} |
38 <h3>New Document</h3> | |
39 | |
40 <div class="panel-group" id="accordion"> | |
41 | |
42 <div class="panel panel-default"> | |
43 <div class="panel-heading"> | |
44 <h4 class="panel-title"> | |
45 <a data-toggle="collapse" data-parent="#accordion" href="#fromURL"> | |
28
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
46 Download a document |
0 | 47 </a> |
48 </h4> | |
49 </div> | |
50 <div id="fromURL" class="panel-collapse collapse in"> | |
51 <div class="panel-body"> | |
8
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
52 <div class="row"> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
53 {% for (type, placeholder) in [ |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
54 ('RHSA', 'YYYY:nnnn'), |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
55 ('Oracle', 'nnnnnnn'), |
162
07210df10edd
Add support for CVE import (from GSA)
Benoît Allard <benoit.allard@greenbone.net>
parents:
102
diff
changeset
|
56 ('Cisco', 'sa-YYYYMMDD-xxx'),('CVE', 'CVE-YYYY-NNNN')] %} |
28
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
57 <div class="col-lg-4"> |
8
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
58 <form role="form" method="POST"> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
59 <input type="hidden" name="{{ type | lower}}"> |
28
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
60 <div class="form-group"> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
61 <div class="input-group"> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
62 <span class="input-group-addon">{{ type }}: </span> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
63 <input type="text" class="form-control" name="id" placeholder="{{ placeholder }}" id="{{ type | lower }}_id" required> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
64 <span class="input-group-btn"> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
65 <button class="btn btn-primary" type="submit">Download</button> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
66 </span> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
67 </div><!-- /input-group --> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
68 </div> |
8
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
69 </form> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
70 </div> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
71 {% endfor %} |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
72 </div> |
28
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
73 <div class=""> |
0 | 74 <form role="form" method="POST"> |
28
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
75 <div class="form-group"> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
76 <div class="input-group"> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
77 <span class="input-group-addon">URL: </span> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
78 <input type="url" class="form-control" name="url" placeholder="https://..." id="url_id" required> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
79 <span class="input-group-btn"> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
80 <button class="btn btn-primary" type="submit">Download</button> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
81 </span> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
82 </div><!-- /input-group --> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
83 </div> |
0 | 84 </form> |
28
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
85 </div> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
86 <hr> |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
87 {% set comma = joiner(', ') %} |
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
88 <p>Some examples: {% for (name, id, value) in [('Red Hat Security Advisory: kernel security, bug fix, and enhancement update', 'rhsa', '2014:0981'), ('Oracle Critical Patch Update Advisory - April 2014', 'oracle' , '2188432'), ('Multiple Vulnerabilities in OpenSSL Affecting Cisco Products','cisco','sa-20140605-openssl'), ('Greenbone Security Advisory 2013-01', 'url', 'http://www.greenbone.net/download/gbsa/gbsa2013-01.cvrf')] %}{{ comma() }}<a href="#" onclick="$('#{{ id }}_id').val('{{ value }}')">{{ name }}</a>{% endfor %} |
0 | 89 </div> |
90 </div> | |
91 </div> | |
92 | |
93 <div class="panel panel-default"> | |
94 <div class="panel-heading"> | |
95 <h4 class="panel-title"> | |
96 <a data-toggle="collapse" data-parent="#accordion" href="#fromFile"> | |
28
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
97 Upload a document |
0 | 98 </a> |
99 </h4> | |
100 </div> | |
101 <div id="fromFile" class="panel-collapse collapse"> | |
102 <div class="panel-body"> | |
103 <form role="form" method="POST" enctype="multipart/form-data"> | |
104 {{ textinput("local", "Local File", type="file", required=True) }} | |
28
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
105 <button type="submit" class="btn btn-primary">Upload</button> |
0 | 106 </form> |
107 </div> | |
108 </div> | |
109 </div> | |
110 | |
111 <div class="panel panel-default"> | |
112 <div class="panel-heading"> | |
113 <h4 class="panel-title"> | |
114 <a data-toggle="collapse" data-parent="#accordion" href="#fromText"> | |
28
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
115 Raw text |
0 | 116 </a> |
117 </h4> | |
118 </div> | |
119 <div id="fromText" class="panel-collapse collapse"> | |
120 <div class="panel-body"> | |
121 <form role="form" method="POST"> | |
122 {{ textarea("text", "Document content", value='<?xml version="1.0" encoding="utf-8"?> | |
123 <cvrfdoc xmlns="http://www.icasi.org/CVRF/schema/cvrf/1.1"> | |
124 <DocumentTitle>Title</DocumentTitle> | |
125 <DocumentType>Type</DocumentType> | |
126 <DocumentPublisher Type="Other"> | |
127 </DocumentPublisher> | |
128 <DocumentTracking> | |
129 <Identification> | |
130 <ID>1234</ID> | |
131 </Identification> | |
132 <Status>Draft</Status> | |
133 <Version>0.1</Version> | |
134 <RevisionHistory> | |
135 <Revision> | |
136 <Number>0.1</Number> | |
137 <Date>' + now.isoformat() + '</Date> | |
138 <Description>First Revision</Description> | |
139 </Revision> | |
140 </RevisionHistory> | |
141 <InitialReleaseDate>' + now.isoformat() + '</InitialReleaseDate> | |
142 <CurrentReleaseDate>' + now.isoformat() + '</CurrentReleaseDate> | |
143 </DocumentTracking> | |
144 </cvrfdoc>' | escape, required=True) }} | |
28
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
145 <button type="submit" class="btn btn-primary">Parse</button> |
0 | 146 </form> |
147 </div> | |
148 </div> | |
149 </div> | |
150 | |
151 <div class="panel panel-default"> | |
152 <div class="panel-heading"> | |
153 <h4 class="panel-title"> | |
154 <a data-toggle="collapse" data-parent="#accordion" href="#newDoc"> | |
155 Create an empty Document | |
156 </a> | |
157 </h4> | |
158 </div> | |
159 <div id="newDoc" class="panel-collapse collapse"> | |
160 <div class="panel-body"> | |
161 <form role="form" method="POST"> | |
34
22d89f53e34c
Add macro to display a description for the input fields
Benoît Allard <benoit.allard@greenbone.net>
parents:
28
diff
changeset
|
162 {{ edit_title_type() }} |
28
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
27
diff
changeset
|
163 <button type="submit" class="btn btn-primary">Create</button> |
0 | 164 </form> |
165 </div> | |
166 </div> | |
167 </div> | |
168 | |
169 </div> | |
170 | |
12
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
171 {% if caching %} |
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
172 {% call panel(heading="Load a document from the cache", title=4, collapsible=False) %} |
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
173 <ul> |
102
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
34
diff
changeset
|
174 {% for element in cache | sort %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
34
diff
changeset
|
175 <li> |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
34
diff
changeset
|
176 {% if has_current %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
34
diff
changeset
|
177 <a href="#{{element}}_modal" data-toggle="modal">{{ element }}</a> |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
34
diff
changeset
|
178 {% else %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
34
diff
changeset
|
179 {{ POST_button(url_for('cache.load', element=element), text=element, style="btn-link") }} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
34
diff
changeset
|
180 {% endif %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
34
diff
changeset
|
181 </li> |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
34
diff
changeset
|
182 {% endfor %} |
12
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
183 </ul> |
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
184 {% endcall %} |
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
185 {% endif %} |
8
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
186 |
0 | 187 {% endblock %} |