Several modifications in fed4fire UI + Slice creation is restricted under projects...
[unfold.git] / portal / templates / fed4fire / fed4fire_slicerequest_view.html
index 7bcd56d..063a9f8 100644 (file)
                                title="Please enter a name for your slice"required="required">
                          </div>
                          <div class="form-group">
-                               {% if pi %}
-                               <input type="text" class="form-control" id="authority_hrn" name="org_name" style="width:300px" placeholder="Organization" 
-                               title="An authority responsible for vetting your slice" required="required">
-                               {% else %}
-                           <input type="hidden" class="form-control" id="authority_hrn" name="org_name" placeholder="Organization" style="width:300px;" 
-                               title="An authority responsible for vetting your slice" required="required" readonly>
-                <span style="float:left;">Authority: &nbsp;</span>
-                <div id="authority_display">
-                <img src="{{ STATIC_URL }}img/loading.gif" alt="Loading authority" />
-                </div>
-                               {% endif %}
+                               <input type="text" class="form-control" id="authority_hrn" name="org_name" style="width:300px" placeholder="Project" 
+                               title="Select a project under which you want to create your slice" required="required">
                          </div>
                          <div class="form-group">
-                Project: <div id="project_loading" style="display:inline;"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading projects" /></div> 
-                <select id="project" name="project" style="display:none;">
-                </select>
-              </div>
-                         <div class="form-group">
                            <input type="text" class="form-control" name="url" id="url" style="width:300px" placeholder="Experiment URL (if one exists)"
                                title="Please provide the url of your experiment if you have one." value="{{url}}">
                          </div>
                
 <script>
 jQuery(document).ready(function(){
-       
-       $("#authority_hrn").load("/rest/user/", {"fields" : ["parent_authority"], "filters": {"user_hrn": "{{ user_hrn }}"}}, function(data) {
-               var jsonData = JSON.parse(data);
-        $(this).attr("value", jsonData[0]['parent_authority']);
-           {% if pi %}
-        draw_projects(jsonData[0]['parent_authority']);
-        {% else %}
-        $('#authority_display').html(jsonData[0]['parent_authority']);
-        draw_projects('');
-        {% endif %}
-    });
-
-       {% if pi %}
-       $("#authority_hrn").val("{{authority_name}}");
-       var availableTags = [
-    {% if authorities %}
-        {% for authority in authorities %}
-            {% if authority.name %}
-                {value:"{{ authority.name }}",label:"{{authority.name}}"},
-                       // to show only full name
-            {% else %}
-                {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
-            {% endif %}
-        {% endfor %}    
-    {% else %}
-        {value:"",label:"No authority found !!!"}
-    {% endif %}
-    ];
-       // sorting the list
-       availableTags.sort(function(a,b){
-               var nameA=a.value.toLowerCase(), nameB=b.value.toLowerCase();
-               if (nameA < nameB) {
-               return -1;
-               }
-               if (nameA > nameB) {
-               return 1;
-               }
-       return 0;
-       }); 
+    var myprojects = JSON.parse(localStorage.getItem('projects'));
     $( "#authority_hrn" ).autocomplete({
-      source: availableTags,
-      minLength: 0,
-      select: function( event, ui ) {
-        $("#project").hide();
-        $("#project_loading").css('display', 'inline-block');
-        draw_projects(jQuery('.ui-state-focus').html());
-      },
+        source: myprojects,
+        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
+                    $("#authority_hrn").val("");
+                }
+        }
     });
-    {% endif %}
 });
 
-function draw_projects(authority_hrn){
+/*function draw_projects(authority_hrn){
 
     var projects = [];
     project_row = "<option value=''> - </option>";
@@ -152,7 +101,7 @@ function draw_projects(authority_hrn){
     }
     $("#project").show();
     $("#project_loading").hide();
-}
+}*/
 </script>
 {% endblock %}