Mercurial > farol > farol
annotate farol/templates/new.j2 @ 12:4219d6fb4c38
Implement three kind of caches
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Tue, 30 Sep 2014 12:18:52 +0200 |
parents | 2ce3676c9b2e |
children | 69e0330c4fae |
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 %} |
0 | 28 |
29 {% set active='new' %} | |
30 | |
31 {% block title %}New{% endblock %} | |
32 | |
33 {% block content %} | |
12
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
34 {% if has_document and caching %} |
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
35 <p class="text-danger">You have an unsaved document, maybe you want to <a href={{ url_for('cache.save') }}>save</a> it first ?</p> |
0 | 36 {% endif %} |
37 <h3>New Document</h3> | |
38 | |
39 <div class="panel-group" id="accordion"> | |
40 | |
41 <div class="panel panel-default"> | |
42 <div class="panel-heading"> | |
43 <h4 class="panel-title"> | |
44 <a data-toggle="collapse" data-parent="#accordion" href="#fromURL"> | |
8
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
45 Download a document from an URL |
0 | 46 </a> |
47 </h4> | |
48 </div> | |
49 <div id="fromURL" class="panel-collapse collapse in"> | |
50 <div class="panel-body"> | |
8
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
51 <div class="row"> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
52 {% for (type, placeholder) in [ |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
53 ('RHSA', 'YYYY:nnnn'), |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
54 ('Oracle', 'nnnnnnn'), |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
55 ('Cisco', 'sa-YYYYMMDD-xxx'), |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
56 ('NASL', '')] %} |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
57 <div class="col-lg-3"> |
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}}"> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
60 <div class="input-group"> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
61 <span class="input-group-addon">{{ type }}: </span> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
62 <input type="text" class="form-control" name="id" placeholder="{{ placeholder }}"> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
63 <span class="input-group-btn"> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
64 <button class="btn btn-primary" type="submit">Download</button> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
65 </span> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
66 </div><!-- /input-group --> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
67 </form> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
68 </div> |
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
69 {% endfor %} |
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 <hr> |
0 | 72 <form role="form" method="POST"> |
73 {{ textinput("url", "URL", "https://...", required=True, type="url") }} | |
74 <button type="submit", class="btn btn-primary">Download</button> | |
75 </form> | |
76 </div> | |
77 </div> | |
78 </div> | |
79 | |
80 <div class="panel panel-default"> | |
81 <div class="panel-heading"> | |
82 <h4 class="panel-title"> | |
83 <a data-toggle="collapse" data-parent="#accordion" href="#fromFile"> | |
84 Upload document | |
85 </a> | |
86 </h4> | |
87 </div> | |
88 <div id="fromFile" class="panel-collapse collapse"> | |
89 <div class="panel-body"> | |
90 <form role="form" method="POST" enctype="multipart/form-data"> | |
91 {{ textinput("local", "Local File", type="file", required=True) }} | |
92 <button type="submit", class="btn btn-primary">Upload</button> | |
93 </form> | |
94 </div> | |
95 </div> | |
96 </div> | |
97 | |
98 <div class="panel panel-default"> | |
99 <div class="panel-heading"> | |
100 <h4 class="panel-title"> | |
101 <a data-toggle="collapse" data-parent="#accordion" href="#fromText"> | |
102 Some text | |
103 </a> | |
104 </h4> | |
105 </div> | |
106 <div id="fromText" class="panel-collapse collapse"> | |
107 <div class="panel-body"> | |
108 <form role="form" method="POST"> | |
109 {{ textarea("text", "Document content", value='<?xml version="1.0" encoding="utf-8"?> | |
110 <cvrfdoc xmlns="http://www.icasi.org/CVRF/schema/cvrf/1.1"> | |
111 <DocumentTitle>Title</DocumentTitle> | |
112 <DocumentType>Type</DocumentType> | |
113 <DocumentPublisher Type="Other"> | |
114 </DocumentPublisher> | |
115 <DocumentTracking> | |
116 <Identification> | |
117 <ID>1234</ID> | |
118 </Identification> | |
119 <Status>Draft</Status> | |
120 <Version>0.1</Version> | |
121 <RevisionHistory> | |
122 <Revision> | |
123 <Number>0.1</Number> | |
124 <Date>' + now.isoformat() + '</Date> | |
125 <Description>First Revision</Description> | |
126 </Revision> | |
127 </RevisionHistory> | |
128 <InitialReleaseDate>' + now.isoformat() + '</InitialReleaseDate> | |
129 <CurrentReleaseDate>' + now.isoformat() + '</CurrentReleaseDate> | |
130 </DocumentTracking> | |
131 </cvrfdoc>' | escape, required=True) }} | |
132 <button type="submit", class="btn btn-primary">Parse</button> | |
133 </form> | |
134 </div> | |
135 </div> | |
136 </div> | |
137 | |
138 <div class="panel panel-default"> | |
139 <div class="panel-heading"> | |
140 <h4 class="panel-title"> | |
141 <a data-toggle="collapse" data-parent="#accordion" href="#newDoc"> | |
142 Create an empty Document | |
143 </a> | |
144 </h4> | |
145 </div> | |
146 <div id="newDoc" class="panel-collapse collapse"> | |
147 <div class="panel-body"> | |
148 <form role="form" method="POST"> | |
149 {{ textinput("title", "Document Title", required=True) }} | |
150 {{ textinput("type", "Document Type", "Security Advisory", required=True) }} | |
151 <button type="submit", class="btn btn-primary">Create</button> | |
152 </form> | |
153 </div> | |
154 </div> | |
155 </div> | |
156 | |
157 </div> | |
158 | |
12
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
159 {% if caching %} |
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
160 {% 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
|
161 <ul> |
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
162 {% for element in cache | sort %}<li><a href="{{ url_for('cache.load', element=element)}}">{{ element }}</a></li>{% endfor %} |
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
163 </ul> |
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
164 {% endcall %} |
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
165 {% endif %} |
8
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
166 |
0 | 167 {% endblock %} |