Mercurial > farol > farol
view farol/templates/new.j2 @ 119:be6553a438fa
Added tag 0.2.1 for changeset 5d19b3158538
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Fri, 17 Oct 2014 16:01:04 +0200 |
parents | 65341d05a8f8 |
children | 07210df10edd |
line wrap: on
line source
{# # Description: # Web Template used in Farol Design # # Authors: # BenoƮt Allard <benoit.allard@greenbone.net> # # Copyright: # Copyright (C) 2014 Greenbone Networks GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -#} {% extends "base.j2" %} {% from "macros.j2" import textinput, textarea, panel %} {% from "common_edits.j2" import edit_title_type %} {% set active='new' %} {% block title %}New{% endblock %} {% block content %} {% if has_document and caching %} <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> {% endif %} <h3>New Document</h3> <div class="panel-group" id="accordion"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#fromURL"> Download a document </a> </h4> </div> <div id="fromURL" class="panel-collapse collapse in"> <div class="panel-body"> <div class="row"> {% for (type, placeholder) in [ ('RHSA', 'YYYY:nnnn'), ('Oracle', 'nnnnnnn'), ('Cisco', 'sa-YYYYMMDD-xxx')] %} <div class="col-lg-4"> <form role="form" method="POST"> <input type="hidden" name="{{ type | lower}}"> <div class="form-group"> <div class="input-group"> <span class="input-group-addon">{{ type }}: </span> <input type="text" class="form-control" name="id" placeholder="{{ placeholder }}" id="{{ type | lower }}_id" required> <span class="input-group-btn"> <button class="btn btn-primary" type="submit">Download</button> </span> </div><!-- /input-group --> </div> </form> </div> {% endfor %} </div> <div class=""> <form role="form" method="POST"> <div class="form-group"> <div class="input-group"> <span class="input-group-addon">URL: </span> <input type="url" class="form-control" name="url" placeholder="https://..." id="url_id" required> <span class="input-group-btn"> <button class="btn btn-primary" type="submit">Download</button> </span> </div><!-- /input-group --> </div> </form> </div> <hr> {% set comma = joiner(', ') %} <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 %} </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#fromFile"> Upload a document </a> </h4> </div> <div id="fromFile" class="panel-collapse collapse"> <div class="panel-body"> <form role="form" method="POST" enctype="multipart/form-data"> {{ textinput("local", "Local File", type="file", required=True) }} <button type="submit" class="btn btn-primary">Upload</button> </form> </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#fromText"> Raw text </a> </h4> </div> <div id="fromText" class="panel-collapse collapse"> <div class="panel-body"> <form role="form" method="POST"> {{ textarea("text", "Document content", value='<?xml version="1.0" encoding="utf-8"?> <cvrfdoc xmlns="http://www.icasi.org/CVRF/schema/cvrf/1.1"> <DocumentTitle>Title</DocumentTitle> <DocumentType>Type</DocumentType> <DocumentPublisher Type="Other"> </DocumentPublisher> <DocumentTracking> <Identification> <ID>1234</ID> </Identification> <Status>Draft</Status> <Version>0.1</Version> <RevisionHistory> <Revision> <Number>0.1</Number> <Date>' + now.isoformat() + '</Date> <Description>First Revision</Description> </Revision> </RevisionHistory> <InitialReleaseDate>' + now.isoformat() + '</InitialReleaseDate> <CurrentReleaseDate>' + now.isoformat() + '</CurrentReleaseDate> </DocumentTracking> </cvrfdoc>' | escape, required=True) }} <button type="submit" class="btn btn-primary">Parse</button> </form> </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#newDoc"> Create an empty Document </a> </h4> </div> <div id="newDoc" class="panel-collapse collapse"> <div class="panel-body"> <form role="form" method="POST"> {{ edit_title_type() }} <button type="submit" class="btn btn-primary">Create</button> </form> </div> </div> </div> </div> {% if caching %} {% call panel(heading="Load a document from the cache", title=4, collapsible=False) %} <ul> {% for element in cache | sort %} <li> {% if has_current %} <a href="#{{element}}_modal" data-toggle="modal">{{ element }}</a> {% else %} {{ POST_button(url_for('cache.load', element=element), text=element, style="btn-link") }} {% endif %} </li> {% endfor %} </ul> {% endcall %} {% endif %} {% endblock %}