{% extends "base.html" %}
{% block title %}Submit Paper for Proceedings{% endblock %}

{% block addscripts %}
  <script type="text/javascript" src="/static/jquery/jquery.watermarkinput.js"></script>
  <link rel="stylesheet" href="/static/css/autosuggest_inquisitor.css" type="text/css" media="screen" charset="utf-8">
  <script type="text/javascript" src="/static/jquery/jquery.autosuggest.js"></script>
  <script type="text/javascript">
  /** Init autosuggest on Search Input **/
  jQuery(function() {

    // Set autosuggest options with all plugins activated
    var options = {
      script:"{% url kiwipycon_get_usernames %}?limit=10&",
      varname:"input",
      json:true,            // Returned response type
      shownoresults:true,       // If disable, display nothing if no results
      noresults:"No Results",     // String displayed when no results
      maxresults:8,         // Max num results displayed
      cache:false,          // To enable cache
      minchars:2,           // Start AJAX request with at leat 2 chars
      timeout:100000,         // AutoHide in XX ms
      callback: function (obj) {    // Callback after click or selection   
        // => TO submit form (general use)
        //$('#id_authors').val('sucks'); 
        //$('#form_search_country').submit(); 
      }
    };
    
    // Init autosuggest
    var as_json = new bsn.AutoSuggest('id_authors', options);
    
    // Display a little watermak  
    $("#id_authors").Watermark("Ex : alex, guido, travis");
  });
  </script>
{% endblock %}

{% block content %}
  <h1>Submit Proceedings paper</h1>

  {% include '_errors.html' %}

  <form action="{% if id %}{% url kiwipycon_submit_proceedings id %}{% else %}{% url kiwipycon_submit_proceedings %}{% endif %}" method="post">
    {% if not user.is_authenticated %}
    <fieldset>
      <legend>Are you a member of this site?</legend>
      <table class="kiwipycon-default required">{{ login_form }}</table>
      <input type="hidden" name="action" value="login" />
      <button class="button left" type="submit">Login</button>
    </fieldset>
  </form>
  <br />
  <form action="{% url kiwipycon_submit_proceedings id %}" 
    enctype="multipart/form-data" method="post">
    <fieldset>
      <legend>User Registration</legend>
      <table class="kiwipycon-default required">{{ register_form }}</table>
      <input type="hidden" name="action" value="register" />
    </fieldset>

    {% endif %}
    <br />

    <fieldset>
      <legend>Proceedings Paper Submission</legend>
      <table class="kiwipycon-default required">
		<tr>
          <th>{{ proceedings_form.title.label }}</th>
          <td>{{ proceedings_form.title.errors }}{{ proceedings_form.title }}</td>
        </tr>
		<tr>
          <th>{{ proceedings_form.abstract.label }}</th>
          <td>{{ proceedings_form.abstract.errors }}{{ proceedings_form.abstract }}</td>
        </tr>
        <tr>
          <th>{{ proceedings_form.body.label }}</th>
          <td>{{ proceedings_form.body.errors }}{{ proceedings_form.body }}</td>
        </tr>
        <tr>
          <th>{{ proceedings_form.rst_file.label }}</th>
          <td>{{ proceedings_form.rst_file.errors }}
              {{ proceedings_form.rst_file }}</td>
        </tr>
        <tr>
          <th>{{ proceedings_form.authors.label }}</th>
          <td>{{ proceedings_form.authors.errors }}
              {{ proceedings_form.authors }}</td>
        </tr>
      </table>
      <button class="button left" type="submit">Submit Paper</button>
    </fieldset>
  </form>
  {% if message %}
  <script type="text/javascript">$.jGrowl("{{ message }}");</script>
  {% endif %}
{% endblock content %}
