regform: fix- checkbox required
[myslice.git] / portal / templates / registration_view.html
index f40b831..b7846e9 100644 (file)
-{% extends "layout-unfold1.html" %}
-
-{% block head %}                
-<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/register.css" />
-<script type="text/javascript" src="{{STATIC_URL}}/jquery.validate.js"></script> 
-<script type="text/javascript" src="{{STATIC_URL}}/my_account.register.js"></script>
-{% endblock %}                              
-                                    
-{% block unfold1_main %}        
-
+{% extends "layout.html" %}
 
+{% block content %}        
 
+<div class="row">
+       <div class="col-md-12">
+       <h1><img src="{{ STATIC_URL }}icons/user-xs.png" alt="User Registration" />User sign-up</h1>
+       </div>
+</div>
+<div class="row">
+       <div class="col-md-12">
+               <h3>Questions? <a href="/portal/contact" >Contact us</a></h3>
+       </div>
+</div>
 {% if errors %}
-        <ul>
-            {% for error in errors %}
-            <li>{{ error }}</li>
-            {% endfor %}
-        </ul>
-    {% endif %}
+<ul>
+  {% for error in errors %}
+  <li>{{ error }}</li>
+  {% endfor %}
+</ul>
+{% endif %}
+   
+<div class="row">
+       <div class="col-md-2"></div>
+       <div class="col-md-8">
+       <form class="cmxform form-horizontal" id="registrationForm" method="post" enctype="multipart/form-data" role="form">
+    {% csrf_token %}
+       <div class="form-group">
+               <label for="authority_hrn" class="control-label">Organization</label>
+               <input id="authority_hrn" name="authority_hrn" class="form-control" style="width:200px" value="{{ authority_hrn }}" required>
+               <p class="help-block">Start typing to find the name of your organization (company or university).<br> If it is not in the list, <a href="/portal/join">please add it.</a></p>
+       </div>
+
+    <div class="form-group">
+               <label for="firstname" class="control-label">Personal Information</label>
+               <input type="text" name="firstname" class="form-control" style="width:200px" minlength="2" value="{{ firstname }}" placeholder="First Name" required />
+    </div>
+    <div class="form-group">
+               <input type="text" name="lastname" size="25" class="form-control" style="width:200px" minlength="2" value="{{ lastname }}" placeholder="Last Name" required />
+    </div>
+       <div class="form-group">
+       <input type="email" name="email" size="25"  class="form-control" style="width:200px" value="{{ email }}" placeholder="Email" required/>
+               <p class="help-block">Your e-mail address will be your identifier for logging in.<br> We contact you to verify your account and then, occasionally, for important issues. </p>
+       </div>
 
 
-<form class="cmxform" id="commentForm" method="post" action="" enctype="multipart/form-data" >
-{% csrf_token %}
- <fieldset>
-    <div class="OneLabTitle">
-        <h2>OneLab Experimenter Registration</h2>
-        <h3>For First Line Support please <a href="/portal/contact" >Contact Support</a></h3>
+       <!-- LOGIN
+       TODO: Login should be suggested from user email or first/last name, and
+       checked for existence. In addition, the full HRN should be shown to the
+       user.
+    <div class="form-group">
+      <label for="login" class="col-xs-2 control-label">Login</label>
+      <div class="col-xs-4">
+         <input type="text" name="login" size="25" class="form-control" minlength="2" value="{{ login }}" placeholder="Login" required />
+      </div>
+      <div class="col-xs-6"><p class="form-hint">Enter your login</p></div>
     </div>
-   
-   <div class="field">
-     <label for="cname">First Name</label>
-     <input type="text" id="firstname" name="firstname" size="25" class="required" minlength="2" value="{{ firstname}}" /> 
-     <p class="hint">Enter your first name</p>
-     <?php echo $errfName;?>
-   </div>
-   <div class="field">
-     <label for="lname">Last Name</label>
-     <input type="text" id="lastname" name="lastname" size="25" class="required" minlength="2" value="{{ lastname }}"/> 
-     <p class="hint">Enter your last name</p>
-     <?php echo $errlName;?>
-   </div>
-   <!-- DEPRECATED
-       <div class="field">
-     <label for="aff_list">Affiliation</label>
-     <input type="text" id="aff_list" name="affiliation" size="25" class="required"  value="{{ affiliation }}"/> 
-     <p class="hint">Enter your Institution name</p>
-     <?php echo $erraffiliation;?>
-   </div>
        -->
-    <div class="field">
-      <label for="auth_list">Authority</label>
-      <select id="auth_list" name="authority_hrn" size="1" class="required">
-        {% for authority in authorities %}
-        <option value="{{ authority.authority_hrn }}"/>{{authority.name}} ({{authority.authority_hrn}})</option>
-        {% endfor %}
-     </select>
-     <p class="hint">Please select an authority responsible for vetting your account</p>
-   </div>
-
-   <div class="field">
-     <label for="cemail">Email</label>
-     <input type="text" id="email" name="email" size="25"  class="required email" value="{{ email }}"/> 
-     <p class="hint">Enter a valid email address</p>
-     <?php echo $errEmail; ?>
-   </div>
-   <div class="field">
-     <label for="password">Password</label>
-     <input type="password"  id="password" name="password"   class="required" minlength="4" value="{{ password }}"/> 
-     <p class="hint">Enter password</p>
-     <?php //echo $errPass;?>
-   </div>
-   <div class="field">
-     <label for="password">Confirm Password</label>
-     <input type="password"  id="confirmpassword" name="confirmpassword"   minlength="4" class="required" value=""/>
-     <p class="hint">Retype the password</p>
-   </div>
-   <div class="field">
-      <label for="question">My Public Key</label>
-      <select name="question" class="required" id="question">        
-        <option value="generate">Generate key pairs for me </option>
-        <option value="upload">Upload my public key </option>
-      </select> 
-      <?php echo $errFile; ?>
-   </div>
-   <div class="field" style="display:none;" id="upload_key">
-      <label for="file">Upload public key</label>
-      <input type="file" name="user_public_key" class="required" id="user_public_key"/>
-      <p class="hint">Upload a valid public key</p>
-   </div>
-   <div class="field">
-     <input class="submit" type="submit" name="submit" value="Register"/>
-   </div>
- </fieldset>
-</form>
 
+    <div class="form-group">
+      <label for="password" class="control-label">Authentication</label>
+      <input type="password"  id="password" name="password"   class="form-control" style="width:200px" minlength="4" value="{{ password }}" placeholder="Password" required/>
+    </div>
+    <div class="form-group">
+               <input type="password"  id="confirmpassword" name="confirmpassword" style="width:200px"  minlength="4" class="form-control" value="" placeholder="Confirm Password" required/>
+               <p class="help-block">Your password allows you to log in to this portal.</p>
+    </div>
+    <div class="form-group">
+       <!--<label for="question" class="control-label">Keys</label> -->
+               <select name="question" class="form-control" style="width:200px" id="key-policy" required>        
+                       <option value="generate">Generate my keys for me (recommended)</option>
+                       <option value="upload">Upload my public key (advanced users only)</option>
+               </select>
+               <p class="help-block">Your public/private key pair allows you to access the testbeds.</p>
+    </div>
+    <div class="form-group" style="display:none;" id="upload_key">
+       <label for="file" class="control-label">Upload public key</label>
+       <input type="file" name="user_public_key" class="form-control" style="width:200px" id="user_public_key" required/>
+       <br />
+               <div class="alert alert-danger" id="pkey_del_msg">
+                       In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to i
+                       <a href="http://trac.myslice.info/wiki/InstallSfa" target="_blank">delegate your public key to the portal.</a>
+               </div>
+    </div>
+       <div class="form-group">
+               <input type="checkbox" name="agreement" value="agreement" required/> I agree to the terms and conditions 
+       </div>
+    <div class="form-group" id="register">
+      <button class="submit btn btn-default" type="submit">Sign up</button>
+    </div>
+  </form>  
+</div>
+<script>
+jQuery(document).ready(function(){
+    var availableTags = [
+    {% if authorities %}
+        {% for authority in authorities %}
+            {% if authority.name %}
+                {value:"{{ authority.authority_hrn }}",label:"{{authority.name}}"},
+            {% else %}
+                {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
+            {% endif %}
+        {% endfor %}    
+    {% else %}
+        {value:"",label:"No authority found !!!"}
+    {% endif %}
+    ];
+    jQuery( "#authority_hrn" ).autocomplete({
+      source: availableTags,
+      minLength: 0,
+      change: function (event, ui) {
+          if(!ui.item){
+              //http://api.jqueryui.com/autocomplete/#event-change -
+              // The item selected from the menu, if any. Otherwise the property is null
+              //so clear the item for force selection
+              jQuery("#authority_hrn").val("");
+          }
+      }
+      //select: function( event, ui ) {console.log(jQuery(this))}
+    });
+});
+</script>
 {% endblock %}