4d09858ee0fc800aab812b67d1b0c59567d332a7
[unfold.git] / portal / templates / registration_view.html
1 {% extends "layout.html" %}
2
3 {% block content %}        
4
5 <div class="row">
6         <div class="col-md-12">
7         <h1><img src="{{ STATIC_URL }}icons/user-xs.png" alt="User Registration" />User sign-up</h1>
8         </div>
9 </div>
10 <div class="row">
11         <div class="col-md-12">
12                 <p><strong>Questions? <a href="/contact" >Contact us.</a></strong></p>
13   </div>
14 </div>
15 {% if errors %}
16 <div class="row">
17         <div class="col-md-12">
18                 <ul class="error">
19                   {% for error in errors %}
20                   <li>{{ error | safe }}</li>
21                   {% endfor %}
22                 </ul>
23         </div>
24 </div>
25 {% endif %}
26                                 <form action="/register" class="cmxform form-horizontal" method="post" enctype="multipart/form-data">
27 <div class="row">
28         <div class="col-md-12">
29                         <div class="form-group">
30                                 {% csrf_token %}
31                                 <label for="authority_hrn" class="control-label">Organization</label>
32                                 <p></p>
33                 <div class="ui-widget">
34                                 <select id="org_name" name="org_name" class="form-control" style="width:590px" value="{{ organization }}" 
35                                 title="Choose your organization (company/university) from the list that apears when you click in the field and start to type.
36                                  Use the arrow keys to scroll through the list; type part of the name to narrow down the list. We will send an email to 
37                                  the managers that we have on record for your organization, asking them to validate your sign-up request." required>
38                 {% if authorities %}
39                     {% for authority in authorities %}
40                         {% if authority.name %}
41                             {% if authority.authority_hrn == authority_hrn %}
42                                 <option value="{{ authority.authority_hrn }}" selected>{{authority.name}}</option>
43                             {% else %}
44                                 <option value="{{ authority.authority_hrn }}">{{authority.name}}</option>
45                             {% endif %}
46                         {% else %}
47                             {% if authority.authority_hrn == authority_hrn %}
48                             <option value="{{ authority.authority_hrn }}" selected>{{authority.authority_hrn}}</option>
49                             {% else %}
50                             <option value="{{ authority.authority_hrn }}">{{authority.authority_hrn}}</option>
51                             {% endif %}
52                         {% endif %}
53                     {% endfor %}
54                 {% else %}
55                     <option value:"">No authority found !!!</option>
56                 {% endif %}
57                 </select>
58                 </div>
59                                 <p></p>
60                                 <p>Organization not listed? <a href="/portal/join">Request its addition now.</a></p>
61                         </div>
62         </div>
63 </div>
64
65 <div class="row">
66         <div class="col-md-6">
67         
68             <div class="form-group">
69                         <label for="firstname" class="control-label">Personal information</label>
70                         <p></p>
71                         <input type="text" name="firstname" class="form-control" style="width:350px" minlength="2" value="{{ first_name }}" placeholder="First name" required />
72             </div>
73             <div class="form-group">
74                         <input type="text" name="lastname" size="25" class="form-control" style="width:350px" minlength="2" value="{{ last_name }}" placeholder="Last name" required />
75             </div>
76                 <div class="form-group">
77                 <input type="email" name="email" size="25"  class="form-control" style="width:350px" value="{{ email }}" 
78                         title="Your e-mail address will be your identifier for logging in. We contact you to verify your account and then, occasionally, for important issues."
79                         placeholder="Email" required />
80                 </div>
81         </div>  
82
83         <div class="col-md-6">
84             <div class="form-group">
85               <label for="password" class="control-label">Authentication</label>
86                   <p></p>       
87               <input type="password"  id="password" name="password"   class="form-control" style="width:250px" minlength="4" value="{{ password }}" 
88                         title="Your password allows you to log in to this portal."
89                         placeholder="Password" required />
90             </div>
91             <div class="form-group">
92                         <input type="password"  id="confirmpassword" name="confirmpassword" style="width:250px"  minlength="4" class="form-control" value="" 
93                                 placeholder="Confirm password" required />
94             </div>
95             <div class="form-group">
96                         <select name="question" class="form-control" style="width:350px" id="key-policy" 
97                                 title="Your public/private key pair allows you to access the testbeds." required >        
98                                 <option value="generate">Generate my keys for me (recommended)</option>
99                                 <option value="upload">Upload my public key (advanced users only)</option>
100                         </select>
101             </div>
102             <div class="form-group" style="display:none;" id="upload_key">
103                 <label for="file" class="control-label">Upload public key</label>
104                 <input type="file" name="user_public_key" class="form-control" style="width:200px" id="user_public_key" />
105                 <br />
106                         <div class="alert alert-danger" id="pkey_del_msg">
107                                 In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to 
108                                 <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a>
109                         </div>
110             </div>
111         </div>
112 </div>
113 <div class="row">
114         <div class="col-md-12">
115                 <div class="form-group">
116                         <p></p>
117                         <input type="checkbox" name="agreement" value="agreement" required />&nbsp;&nbsp; I agree to the 
118                         <a href="#" data-toggle="modal" data-target="#myModal">terms and conditions.</a> 
119                 </div>
120         </div>
121 </div>
122 <div class="row">
123         <div class="col-md-12">
124                 <div class="form-group" id="register">
125                         <p></p> 
126                 <input class="submit btn btn-onelab" type="submit" value="Sign up" />
127                 </form>
128             </div>
129         </div>
130 </div>
131
132         <!-- Modal - columns selector -->
133 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
134                         <div class="modal-dialog">
135                         <div class="modal-content">
136                                 <div class="modal-header">
137                                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
138                                                 <h4 class="modal-title" id="myModalLabel">Terms & Conditions</h4>
139                                 </div>
140                                 <div class="modal-body">
141                                                 <p align="left">
142                                                         To be added soon.
143                                                 </p>
144
145                                 </div>
146                                 <div class="modal-footer">
147                                         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
148                                 </div>
149                         </div>
150                         </div>
151 </div>
152
153     
154 <script>
155 $(document).ready(function(){
156     var availableTags = [
157     {% if authorities %}
158         {% for authority in authorities %}
159             {% if authority.name %}
160                 {value:"{{ authority.authority_hrn }}",label:"{{authority.name}}"},
161                         // show hrn if we don't have the name
162             {% else %}
163                 {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
164             {% endif %}
165         {% endfor %}    
166     {% else %}
167         {value:"",label:"No authority found !!!"}
168     {% endif %}
169     ];
170         // sorting the list
171     
172         availableTags.sort(function(a,b){
173                 var nameA=a.value.toLowerCase(), nameB=b.value.toLowerCase();
174                 if (nameA < nameB) {
175                 return -1;
176                 }
177                 if (nameA > nameB) {
178                 return 1;
179                 }
180         return 0;
181         }); 
182         // auto-complete the form
183     jQuery("#org_name").combobox();
184         $('[title!=""]').qtip();
185         $("form").validate();
186         $("form").submit(function() {
187                 if ($('select option:selected').val() == 'upload') {
188                         if ($('input[name=user_public_key]').val() == '') {
189                                 alert('Please specify the key file to upload');
190                                 return false;
191                         }
192                 }
193         });
194 });
195 </script>
196 {% endblock %}
197