F4F: registration form fixed
[unfold.git] / portal / templates / fed4fire / fed4fire_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                             <option value="{{ authority.authority_hrn }}">{{authority.name}}</option>
42                         {% else %}
43                             <option value="{{ authority.authority_hrn }}">{{authority.authority_hrn}}</option>
44                         {% endif %}
45                     {% endfor %}    
46                 {% else %}
47                     <option value:"">No authority found !!!</option>
48                 {% endif %}
49                 </select>
50                 </div>
51                                 <p></p>
52                                 <!--<p>Organization not listed? <a href="/portal/join">Request its addition now.</a></p>-->
53                                 <p class="help-block">If your organization does not deploy a Fed4FIRE authority itself, you can use the<br> default one called "fed4fire.global".
54                 If your organization however does provide a<br> Fed4FIRE authority itself, please make sure to select it here. If you start typing<br> your organization's
55                  name, it will pop up.
56                 </p> 
57                         </div>
58         </div>
59 </div>
60
61 <div class="row">
62         <div class="col-md-6">
63         
64             <div class="form-group">
65                         <label for="firstname" class="control-label">Personal information</label>
66                         <p></p>
67                         <input type="text" name="firstname" class="form-control" style="width:350px" minlength="2" value="{{ first_name }}" placeholder="First name" required />
68             </div>
69             <div class="form-group">
70                         <input type="text" name="lastname" size="25" class="form-control" style="width:350px" minlength="2" value="{{ last_name }}" placeholder="Last name" required />
71             </div>
72                 <div class="form-group">
73                 <input type="email" name="email" size="25"  class="form-control" style="width:350px" value="{{ email }}" 
74                         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."
75                         placeholder="Email" required />
76                 </div>
77         </div>  
78
79         <div class="col-md-6">
80             <div class="form-group">
81               <label for="password" class="control-label">Authentication</label>
82                   <p></p>       
83               <input type="password"  id="password" name="password"   class="form-control" style="width:250px" minlength="4" value="{{ password }}" 
84                         title="Your password allows you to log in to this portal."
85                         placeholder="Password" required />
86             </div>
87             <div class="form-group">
88                         <input type="password"  id="confirmpassword" name="confirmpassword" style="width:250px"  minlength="4" class="form-control" value="" 
89                                 placeholder="Confirm password" required />
90             </div>
91             <div class="form-group">
92                         <select name="question" class="form-control" style="width:350px" id="key-policy" 
93                                 title="Your public/private key pair allows you to access the testbeds." required >        
94                                 <option value="generate">Generate my keys for me (recommended)</option>
95                                 <option value="upload">Upload my public key (advanced users only)</option>
96                         </select>
97             </div>
98             <div class="form-group" style="display:none;" id="upload_key">
99                 <label for="file" class="control-label">Upload public key</label>
100                 <input type="file" name="user_public_key" class="form-control" style="width:200px" id="user_public_key" />
101                 <br />
102                         <div class="alert alert-danger" id="pkey_del_msg">
103                                 In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to 
104                                 <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a>
105                         </div>
106             </div>
107         </div>
108 </div>
109 <div class="row">
110         <div class="col-md-12">
111                 <div class="form-group">
112                         <p></p>
113                         <input type="checkbox" name="agreement" value="agreement" required />&nbsp;&nbsp; I agree to the 
114                         <a href="#" data-toggle="modal" data-target="#myModal">terms and conditions.</a> 
115                 </div>
116         </div>
117 </div>
118 <div class="row">
119         <div class="col-md-12">
120                 <div class="form-group" id="register">
121                         <p></p> 
122                 <input class="submit btn btn-onelab" type="submit" value="Sign up" />
123                 </form>
124             </div>
125         </div>
126 </div>
127
128         <!-- Modal - columns selector -->
129 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
130                         <div class="modal-dialog">
131                         <div class="modal-content">
132                                 <div class="modal-header">
133                                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
134                                                 <h4 class="modal-title" id="myModalLabel">Terms & Conditions</h4>
135                                 </div>
136                                 <div class="modal-body">
137                                                 <p align="left">
138                                                         The exact terms and conditions for Fed4FIRE are currently under development.
139                                                 </p>
140
141                                 </div>
142                                 <div class="modal-footer">
143                                         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
144                                 </div>
145                         </div>
146                         </div>
147 </div>
148
149     
150 <script>
151 //setting the default value in the org_list
152 $(function() {
153     var temp="fed4fire.global"; 
154     $("#org_name").val(temp);
155 });
156
157 $(document).ready(function(){
158     var availableTags = [
159     {% if authorities %}
160         {% for authority in authorities %}
161             {% if authority.name %}
162                 {value:"{{ authority.authority_hrn }}",label:"{{authority.name}}"},
163                         // show hrn if we don't have the name
164             {% else %}
165                 {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
166             {% endif %}
167         {% endfor %}    
168     {% else %}
169         {value:"",label:"No authority found !!!"}
170     {% endif %}
171     ];
172         // sorting the list
173     
174         availableTags.sort(function(a,b){
175                 var nameA=a.value.toLowerCase(), nameB=b.value.toLowerCase();
176                 if (nameA < nameB) {
177                 return -1;
178                 }
179                 if (nameA > nameB) {
180                 return 1;
181                 }
182         return 0;
183         }); 
184         // auto-complete the form
185     jQuery("#org_name").combobox();
186         $('[title!=""]').qtip();
187         $("form").validate();
188         $("form").submit(function() {
189                 if ($('select option:selected').val() == 'upload') {
190                         if ($('input[name=user_public_key]').val() == '') {
191                                 alert('Please specify the key file to upload');
192                                 return false;
193                         }
194                 }
195         });
196 });
197 </script>
198 {% endblock %}
199