view farol/templates/new.j2 @ 0:4a9f23230eba

Initial Release
author Benoît Allard <benoit.allard@greenbone.net>
date Wed, 24 Sep 2014 10:07:49 +0200
parents
children 2ce3676c9b2e
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 %}

{% set active='new' %}

{% block title %}New{% endblock %}

{% block content %}
{% if has_document %}
<p class="text-danger">You have an unsaved document, maybe you want to <a href={{ url_for('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 document from URL
        </a>
      </h4>
    </div>
    <div id="fromURL" class="panel-collapse collapse in">
      <div class="panel-body">
        <form role="form" method="POST">
          {{ textinput("url", "URL", "https://...", required=True, type="url") }}
          <button type="submit", class="btn btn-primary">Download</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="#fromFile">
          Upload 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">
          Some 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">
          {{ textinput("title", "Document Title", required=True) }}
          {{ textinput("type", "Document Type", "Security Advisory", required=True) }}
          <button type="submit", class="btn btn-primary">Create</button>
        </form>
      </div>
    </div>
  </div>

</div>

{% endblock %}

http://farol.wald.intevation.org