Several modifications in fed4fire UI + Slice creation is restricted under projects...
[unfold.git] / portal / templates / fed4fire / fed4fire_slicerequest_view.html
1 {% extends "layout.html" %}
2 {% load i18n %}
3
4 {% block content %}
5         <div class="row">
6                 <div class="col-md-12">
7                          <div class="breadcrumbs" style="line-height: 3;">
8                                  Experiment &nbsp;>&nbsp; Request a new Slice
9                          </div>
10                 </div>
11         </div>
12
13         {% if errors %}
14         <div class="row">
15                 <div class="col-md-12">
16                 <ul class="error">
17                   {% for error in errors %}
18                   <li>{{ error }}</li>
19                   {% endfor %}
20                 </ul>
21                 </div>
22         </div>
23         {% endif %}
24         
25         <div class="row">
26                 <div class="col-md-8 el">
27                         <form role="form" method="post">
28                         {% csrf_token %}
29                           <div class="form-group" style="display:none">
30                             <input type="email" class="form-control" id="email" style="width:300px" value="{{ email }}" readonly="readonly">
31                           </div>
32                           <div class="form-group">
33                             <input type="text" class="form-control" name="slice_name" id="slice_name" style="width:300px" placeholder="Slice name" value="{{slice_name}}" 
34                                 title="Please enter a name for your slice"required="required">
35                           </div>
36                           <div class="form-group">
37                                 <input type="text" class="form-control" id="authority_hrn" name="org_name" style="width:300px" placeholder="Project" 
38                                 title="Select a project under which you want to create your slice" required="required">
39                           </div>
40                           <div class="form-group">
41                             <input type="text" class="form-control" name="url" id="url" style="width:300px" placeholder="Experiment URL (if one exists)"
42                                 title="Please provide the url of your experiment if you have one." value="{{url}}">
43                           </div>
44                           <div class="form-group">
45                                 <textarea id="purpose" name="purpose" class="form-control" rows="6" placeholder="Experiment purpose" style="width:300px" 
46                                 title="Purpose of your experiment (informative)" required="required">{{ purpose }}</textarea>
47                           </div>
48                           {% if pi %}   
49                           <button type="submit" id=submit_pi class="btn btn-onelab"><span class="glyphicon glyphicon-plus"></span> Create slice</button>
50                           {% else %}
51                           <button type="submit" class="btn btn-onelab"><span class="glyphicon glyphicon-plus"></span> Request slice</button>
52                           {% endif %}   
53                         </form>
54         
55                 </div>
56         </div>
57                 
58 <script>
59 jQuery(document).ready(function(){
60     var myprojects = JSON.parse(localStorage.getItem('projects'));
61     $( "#authority_hrn" ).autocomplete({
62         source: myprojects,
63         change: function (event, ui) {
64                 if(!ui.item){
65                     //http://api.jqueryui.com/autocomplete/#event-change -
66                     // The item selected from the menu, if any. Otherwise the property is null
67                     //so clear the item for force selection
68                     $("#authority_hrn").val("");
69                 }
70         }
71     });
72 });
73
74 /*function draw_projects(authority_hrn){
75
76     var projects = [];
77     project_row = "<option value=''> - </option>";
78     projects.push(project_row);
79
80     if(authority_hrn.length > 0){
81         // Not for root authority
82         if(authority_hrn.split('.').length > 1){
83             $.post("/rest/myslice:authority/",{'fields':['authority_hrn','pi_users'],'filters':{'authority_hrn':'CONTAINS'+authority_hrn}}, function( data ) {
84                
85                 $.each( data, function( key, val ) {
86                     project_row = "<option value='"+val.authority_hrn+"'>"+val.authority_hrn+"</option>";
87                     projects.push(project_row);
88                 });
89                 $("#project").html(projects.join( "" ));
90             });
91         }else{
92             $("#project").html(projects.join( "" ));
93         }
94     }else{
95         my_projects = JSON.parse(localStorage.getItem('projects'));
96         $.each( my_projects, function( i, val ) {
97             project_row = "<option value='"+val+"'>"+val+"</option>";
98             projects.push(project_row);
99         });
100         $("#project").html(projects.join( "" ));
101     }
102     $("#project").show();
103     $("#project_loading").hide();
104 }*/
105 </script>
106 {% endblock %}
107