{% extends "html/base_authenticated.html" %}

{% block title %}{{ gettext('Upload File') }}{% endblock %}

{% block page_id %}upload-worksheet-page{% endblock %}

{% block main %}

{% if "url" in request.args: %}
<div>
    <h2>{{ gettext('Upload worksheet to the Sage Notebook') }}</h2>
    <form method="POST" action="upload_worksheet"
          name="upload" enctype="multipart/form-data">
       <div>
           <label for="url">{{ gettext('URL of file on web') }}</label> <input size="50" type="text"
            name="url" value="{{ request.args["url"] }}" />
        </div>
        <div>
            <label for="name">{{ gettext('What do you want to call it? (if different than the original name)') }}</label>
            <input size="50" type="text" name="name" />
        </div>
        <button type="submit">{{ gettext('Upload Worksheet') }}</button>
    </form>
</div>
{% else: %}
<div>
    <h2>{{ gettext('Upload worksheet to the Sage Notebook') }}</h2>
    <p>{{ gettext('Supported file formats:') }}</p>
    <ul class="simple">
        <li><tt>.sws</tt> - {{ gettext('a Sage worksheet') }}</li>
        <li><tt>.html</tt> {{ gettext('or <tt>.txt</tt> - a worksheet text file with html code and cells surrounded by <tt>&#123;&#123;&#123;</tt> and <tt>&#125;&#125;&#125;</tt> that defines a worksheet') }}</li>
        <li><tt>.html</tt> - {{ gettext('the URL of a page of the Sage Documentation, for example the URL of <a class="reference external" href="http://www.sagemath.org/doc/reference/sage/rings/integer.html">this page</a>') }}</li>
    <li><tt>.html</tt> - {{ gettext('an HTML page generated by docutils from a ReStructuredText file') }}</li>
    <li><tt>.rst</tt> - {{ gettext('a ReStructuredText file (Add "<tt>.. escape-backslashes</tt>" as a line in the file if you want backslashes to be escaped. Put latex code inside backticks "<tt>`</tt>" or dollar signs "<tt>$</tt>" or "<tt>$$</tt>". Math role is not supported for now.)') }}</li>
    <li><tt>.zip</tt> - {{ gettext('a zip archive of any of the above') }}</li>
    </ul>
    <form method="POST" action="upload_worksheet"
          name="upload" enctype="multipart/form-data">
        <div>
            <label for="file">{{ gettext('Browse your computer to select a file to upload:') }}</label>
            <input size="50" type="file" name="file" />
        </div>
        <div>
            <label for="url">{{ gettext('Or enter the URL of a file on the web. This can be a direct link to any of the above kinds of files, or the URL of any HTML page that supports "linked worksheet autodiscovery".') }}</label> <input size="50" type="text"
            name="url" />
        </div>
        <div>
            <label for="name">{{ gettext('What do you want to call it? (if different than the original name)') }}</label>
            <input size="50" type="text" name="name" />
        </div>
        <button type="submit">{{ gettext('Upload Worksheet') }}</button>
    </form>
</div>
{% endif %}

{% endblock %}
