{% extends "registration/base.html" %}
{% load i18n %}
{% block js_declaration %}{{ block.super }}
    <script type="text/javascript">
        $(document).ready(function() {
            $("#login-form").validate();
            
            
            $('#mon_ajax').click(function(e) {
                var url = "{% url project_api project_id='c8448f21-272d-11e1-876b-c8bcc896c290' emitter_format='.json' %}";
                
                var monjson = '{\
                        "annotations": [\
                            {\
                                "type": "c_07BA1284-5F24-71A8-1EE2-423EED999B8A",\
                                "type_title": "New cutting name if necessary",\
                                "media": "briandepalma_scarfacedepalma",\
                                "begin": 1600000,\
                                "end": 2100000,\
                                "content": {\
                                    "data": "new scar annot"\
                                },\
                                "tags": [ "json","dude" ]\
                            }\
                        ],\
                        "meta": {\
                            "creator": "John Doe",\
                            "created": "2011-09-10T09:12:58"\
                        }\
                    }';
                var monjson2 = '{\
                        "annotations": [\
                            {\
                                "type": "c_07BA1284-5F24-71A8-1EE2-423EED999B8A",\
                                "type_title": "New cutting name if necessary",\
                                "media": "briandepalma_scarfacedepalma",\
                                "begin": 2400000,\
                                "end": 3000000,\
                                "content": {\
                                    "data": "ntm iam 2"\
                                },\
                                "tags": [ "jak" ]\
                            }\
                        ],\
                        "meta": {\
                            "creator": "John Doe",\
                            "created": "2011-09-10T09:12:58"\
                        }\
                    }';
                
                $.ajax({
                    url: url,
                    type: 'PUT',
                    contentType: 'application/json',
                    data: monjson,
                    // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
                    //dataType: 'json',
                    success: function(json, textStatus, XMLHttpRequest) {
                        alert("success = " + json);
                    },
                    error: function(jqXHR, textStatus, errorThrown) {
                        alert("ERROR = " + jqXHR.responseText + ", " + errorThrown);
                    }
                });
            });
            
        });
    </script>
{% endblock %}

{% block css_import %}
	{{ block.super }}
	<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/ldt.css" />
	<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/ldtform.css" />
{% endblock %}


{% block login %}
{% endblock %}

{% block content_title %}{% trans 'Log in' %}{% endblock %}
{% block iricontent %}
    {% if form.errors %}
   	<p class="error">{% trans "Sorry, that's not a valid username or password." %}</p>
   {% endif %}
  	<div class="span-24 last">
        <form action="" method='post' id="login-form">
        	<div id="loginform_div" class="span-12">
            {% csrf_token %}
            <input type="hidden" name="next" value="{{ next }}" />
	        <ul id="login_fields_list">
	        {{form.as_ul}}
	        </ul>
            <ul>
                <li><a href="{% url django.contrib.auth.views.password_reset  %}" >{% trans "Forget password?" %}</a></li>
            </ul>
            <div id="submitcontent-buttons-login" class="span-24 last">
                <button class="button"type="submit" value="login">{% trans "login" %}</button>
            </div>
            </div>
	    </form>
        <div id="login_links" class="span-12 last">
            <div id="login_links_list" class="span-12 last">
            {% if social_list %}
            <p>{% trans "Or login with your external account" %}&nbsp;:</p>
            <ul>
            {% for backend_name in social_list %}
            <li><a href="{{ backend_name }}"><img src="{{LDT_MEDIA_PREFIX}}img/logo_{{backend_name}}.png" />&nbsp;{{ backend_name }}</a></li>
            {% endfor %}
            {% comment %}{{social_list|safe}}{% endcomment %}
            </ul>
            {% endif %}
            </div>
        </div>
        <p id="mon_ajax">clic ici</p>
	</div> 

{% endblock %}



