merge amisha changes
[plstackapi.git] / planetstack / templates / admin / login.html
1 {% extends "admin/base_site_login.html" %}
2 {% load i18n admin_static %}
3
4 {% block extrastyle %}{{ block.super }}
5 <link rel="stylesheet" type="text/css" href="/static/suit/bootstrap/css/bootstrap.min.css" media="all"/>
6 <link rel="stylesheet" type="text/css" href="{% static "planetstack.css" %}" />
7 <script src="{% static 'suit/js/jquery-1.9.1.min.js' %}"></script>
8 <script src="http://code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
9 {% endblock %}
10
11
12 {% block bodyclass %}login{% endblock %}
13
14 {% block nav-global %}{% endblock %}
15
16 {% block content_title %}{% endblock %}
17
18 {% block breadcrumbs %}{% endblock %}
19
20 {% block content %}
21 {% if form.errors and not form.non_field_errors and not form.this_is_the_login_form.errors %}
22 <p class="errornote">
23 {% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
24 </p>
25 {% endif %}
26
27 {% if form.non_field_errors or form.this_is_the_login_form.errors %}
28 {% for error in form.non_field_errors|add:form.this_is_the_login_form.errors %}
29 <p class="errornote">
30     {{ error }}
31 </p>
32 {% endfor %}
33 {% endif %}
34 <div id="wrap">
35 <div id="content-main">
36 <h1><i class="icon-lock icon-white"></i> OpenCloud</h1>
37 <form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
38   <div class="form-row">
39     {% if not form.this_is_the_login_form.errors %}{{ form.username.errors }}{% endif %}
40      {{ form.username }}
41   </div>
42   <div class="form-row">
43     {% if not form.this_is_the_login_form.errors %}{{ form.password.errors }}{% endif %}
44      {{ form.password }}
45     <input type="hidden" name="this_is_the_login_form" value="1" />
46     <input type="hidden" name="next" value="{{ next }}" />
47   </div>
48   <div class="submit-row">
49     <input type="submit" class="btn btn-info" value="{% trans 'SIGN IN' %}" />
50   </div>
51         <div id="requestAccountLink">{% trans 'Request a new Account' %}</div>
52 </form>
53
54 <div id="request-account-form" title="Request an Account" style="display: none;">
55         <form>
56                 <fieldset>
57                         <div class="request-form-row">
58                                 <label for="request-first-name">First Name</label>
59                                 <input type="text" name="request-first-name" id="request-first-name">
60                         </div>
61                          <div class="request-form-row">
62                                 <label for="request-last-name">Last Name</label>
63                                 <input type="text" name="request-last-name" id="request-last-name">
64                         </div>
65                          <div class="request-form-row">
66                                 <label for="request-email">Email</label>
67                                 <input type="text" name="request-email" id="request-email">
68                         </div>
69                          <div class="request-form-row">
70                                 <label for="request-site-name">Site</label><br>
71                                 <select id="request-site-name" name="request-site-name">
72                                          <option>---------</option>
73                                          <option>Stanford</option>
74                                          <option>Washington</option>
75                                          <option>Princeton</option>
76                                          <option>GeorgiaTech</option>
77                                          <option>MaxPlanck</option>
78                                          <option>I2 Atlanta</option>
79                                          <option>I2 Chicago</option>
80                                          <option>I2 Houston</option>
81                                          <option>I2 Kansas City</option>
82                                          <option>I2 Los Angeles</option>
83                                          <option>I2 New York</option>
84                                          <option>I2 Salt Lake City</option>
85                                          <option>I2 Seattle</option>
86                                          <option>I2 Washington DC</option>
87                                          <option>ON.Lab</option>
88                                          <option>I2 Singapore</option>
89                                          <option>Arizona</option>
90                                 </select>
91                         </div>
92                         <div class="submit-row">
93                                 <input id ="request-signup" class="btn btn-info" value="SIGN UP">
94                         </div>
95                 </fieldset>
96         </form>
97 </div>
98 </div>
99 </div>
100
101
102 <script type="text/javascript">
103 $(function() {
104         initRequest();
105 });
106 function initRequest(){
107         $.ajax({
108                         url: '/tenantview',
109                         dataType: 'json',
110                         success: function (data) {
111                                 var sites = data['sitesToBeRequested'];
112                                 console.log(sites);
113                                 for (site in sites){
114                                         $("#request-site-name").append("<option>" + site + "</option>");
115                                 }
116                         }
117                 });
118 }
119 $("#requestAccountLink").unbind().click(function(){
120         $("#request-account-form").dialog({
121                                         autoOpen: false,
122                                         modal: true,
123                                         dialogClass: "requestDialog",
124                                 });
125                                 $("#request-account-form").dialog("open");
126 })
127 $("#request-signup").unbind().click(function(){
128                                                         $.ajax({
129                                                                 url: '/requestaccess/',
130                                                                 dataType: 'json',
131                                                                 data: {
132                                                                         email: $("#request-email").val(),
133                                                                         firstname: $("#request-first-name").val(),
134                                                                         lastname: $("#request-last-name").val(),
135                                                                         site: $("#request-site-name").val(),
136                                                                         csrfmiddlewaretoken: "{{ csrf_token }}", // < here 
137                                                                         state: "inactive"
138                                                                 },
139                                                                 async: false,
140                                                                 type: 'POST',
141                                                                 success: function () {
142                                                                         $("#request-account-form").dialog("close");     
143                                                                         alert("Your request has been submitted");                                                       
144                                                                 },
145                                                                 error:function (xhr, textStatus, thrownError){
146                                                                    alert("Error:", textStatus + " " + xhr.responseText);
147                                                                 }
148                                                         });
149 })
150 document.getElementById('id_username').focus()
151 </script>
152 </div>
153 </div>
154 {% endblock %}