{% extends "wirecloud/views/base_plain.html" %}
{% load i18n %}
<script type="text/javascript">
    function sendCancel() {
        {% if widget %}
        document.getElementById("pingback_cancel").value = 'true';
        document.getElementById("main_form").submit();
        {% endif %}
    }
    setTimeout(function () {
        document.body.onbeforeunload = sendCancel;
    }, 0);
</script>

{% block content %}
    {% if error_message %}
    <p class="errornote">{{ error_message }}</p>
    {% endif %}

    <h1 id="warning"> {{ msg }} </h1>

    {% if widget %}
    <h2 id="warning"> Widget info:</h2>
    <p><img src="{{ widget.image_uri }}" /></p>
    <p><b>Name:</b> {{ widget.name }}</p>
    <p><b>DisplayName:</b> {{ widget.display_name }}</p>
    <p><b>Vendor:</b> {{ widget.vendor }}</p>
    <p><b>Version:</b> {{ widget.version }}</p>
    <p><b>Author:</b> {{ widget.author }}</p>
    <p><b>Email:</b> {{ widget.mail }}</p>
    <p><b>Description:</b> {{ widget.description}}</p>
    <p><b>Wiki:</b> {{ widget.doc_uri }}</p>

    <form id="main_form" action="/interfaces/widget" method="post">
        <input type="hidden" value="{{template_uri}}" name="template_uri" />
        {% if pingback %}
        <input type="hidden" value="{{pingback}}" name="pingback" />
        {% endif %}
        <input type="hidden" value="false" name="pingback_cancel" id="pingback_cancel" />
        <p><b>Add to Workspace:</b><input type="checkbox" name="add_to_ws" /></p>
        <input type="submit" value="Add widget" />
        <input type="submit" value="Cancel" onclick="javascript:sendCancel();" />
    </form>
    {% else %}
    <a href="/">Go to Wirecloud</a>
    {% endif %}
{% endblock %}

