Institution page both for Authority and Projects, using _widget as partial templates...
authorLoic Baron <loic.baron@lip6.fr>
Fri, 23 Jan 2015 16:14:28 +0000 (17:14 +0100)
committerLoic Baron <loic.baron@lip6.fr>
Fri, 23 Jan 2015 16:14:28 +0000 (17:14 +0100)
12 files changed:
portal/actions.py
portal/managementtababout.py
portal/static/css/fed4fire.css
portal/static/js/institution.js
portal/templates/_widget-no_credentials.html [new file with mode: 0644]
portal/templates/_widget-tradeoff.html [new file with mode: 0644]
portal/templates/fed4fire/fed4fire_account-view.html
portal/templates/fed4fire/fed4fire_home-view.html
portal/templates/fed4fire/fed4fire_institution.html [new file with mode: 0644]
portal/templates/institution.html
portal/templates/onelab/onelab_account-view.html
portal/templates/onelab/onelab_home-view.html

index 8965a9f..64d814a 100644 (file)
@@ -88,7 +88,7 @@ def authority_add_pis(request, authority_hrn,user_hrn):
    
     updated_pi_list = pi_list.append(user_hrn) 
     query = Query.update('authority').filter_by('authority_hrn', '==', authority_hrn).set({'pi_users':pi_list})
-    results = execute_admin_query(request,query)
+    results = execute_query(request,query)
     newpis = authority_get_pis (request, authority_hrn)
     return newpis
 
@@ -101,7 +101,7 @@ def authority_remove_pis(request, authority_hrn,user_hrn):
  
     updated_pi_list = pi_list.remove(user_hrn) 
     query = Query.update('authority').filter_by('authority_hrn', '==', authority_hrn).set({'pi_users':pi_list})
-    results = execute_admin_query(request,query)
+    results = execute_query(request,query)
     newpis = authority_get_pis (request, authority_hrn)
     return newpis
 
index 1f5ceca..ec39f8f 100644 (file)
@@ -21,10 +21,13 @@ class ManagementAboutView (FreeAccessView, ThemeView):
 
     def get (self, request):
         
+        authority_contacts = {}
+        authority = {'authority_hrn':'fed4fire.upmc'}
         if request.user.is_authenticated(): 
             user_local_query  = Query().get('local:user').select('config').filter_by('email','==',str(self.request.user))
             user_local_details = execute_query(self.request, user_local_query)
             user_authority = json.loads(user_local_details[0]['config']).get('authority')
+            print "**************________    management about  = ",user_authority
             # XXX Should be done using Metadata
             # select column.name from local:object where table=='authority'
             authority_query = Query().get('authority').select('authority_hrn', 'name', 'address', 'enabled','description', 
@@ -34,7 +37,6 @@ class ManagementAboutView (FreeAccessView, ThemeView):
             authority_details = execute_query(self.request, authority_query)
             
             if authority_details :
-                authority_contacts = {}
                 authority = authority_details[0]
                 if 'scientific' in authority and authority['scientific'] is not None:
                     authority_contacts['scientific'] = [ x.strip()[1:-1] for x in authority['scientific'][1:-1].split(',') ]
index b088b22..987d54e 100644 (file)
@@ -339,6 +339,7 @@ ul.nav-section li a {
 ul.nav-section li:first-child {
     padding:0;
 }
+/* it used to give space for the icon, which has been removed
 ul.nav-section li:first-child a {
     font-weight:bold;
     padding:6px 15px 4px 15px;
@@ -346,6 +347,8 @@ ul.nav-section li:first-child a {
 ul.nav-section li:first-child.active a {
     padding:6px 15px 3px 15px;
 }
+
+*/
 ul.nav-section li:first-child img {
     margin:0 4px 1px 0;
     padding:0;
index 2b2cfa3..e8d5121 100644 (file)
@@ -36,11 +36,13 @@ $(document).ready(function() {
 
     /* TODO: factorize into functions */
     $('button#deleteslices').click(function() {
+        var flag = false;
         $('input:checkbox.slice').each(function (index) {
             if(this.checked){
                 var record_id = this.id;
                 $.post("/delete/slice/",{'filters':{'slice_hrn':this.id}}, function(data) {
                     if(data.success){
+                        localStorage.clear();
                         $('tr[id="'+record_id+'"]').fadeOut("slow");
                         $('tr[id="'+record_id+'"]').remove();
                         mysliceAlert('Success: slice deleted','success', true);
@@ -76,10 +78,34 @@ $(document).ready(function() {
         // TODO: refresh table
         //window.location="/portal/institution#slices";
     });
+    $('button#deleteprojects').click(function() {
+        var flag = false;
+        $('input:checkbox.project').each(function (index) {
+            if(this.checked){
+                var record_id = this.id;
+                console.log(record_id);
+                $.post("/delete/myslice:authority/",{'filters':{'authority_hrn':this.id}}, function(data) {
+                    if(data.success){
+                        localStorage.clear();
+                        $('tr[id="'+record_id+'"]').fadeOut("slow");
+                        $('tr[id="'+record_id+'"]').remove();
+                        mysliceAlert('Success: project deleted','success', true);
+                    }else{
+                        mysliceAlert('Rest Error for: '+data.error,'warning', true);
+                        //alert("Rest Error for "+record_id+": "+data.error);
+                    }
+                });
+            }
+        });
+    });
 
     $('button#createslice').click(function() {
         window.location="/portal/slice_request/";
     });
+
+    $('button#createproject').click(function() {
+        window.location="/portal/project_request/";
+    });
     $('button#slicerequestbtn').click(function() {
         /*
         window.location="/portal/slice_request/";
diff --git a/portal/templates/_widget-no_credentials.html b/portal/templates/_widget-no_credentials.html
new file mode 100644 (file)
index 0000000..ab07ce7
--- /dev/null
@@ -0,0 +1,66 @@
+<!-- This widget is used to show a popup to users explaining why they don't have credentials delegated to the portal (accountview, homeview) -->
+<!-- Modal- No credentials -->
+<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+     <div class="modal-dialog">
+         <div class="modal-content">
+             <div class="modal-header">
+                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                     <h4 class="modal-title" id="myModalLabel">No credentials are delegated to the portal</h4>
+             </div>
+                       <div class="modal-body" style="text-align:justify;">
+                       <p>You are getting this message for any of the following reasons:</p>
+                       <ul>
+                               <li>If your account is still pending for validation</li>
+                               <li>If the server cache hasn't been cleared</li>
+                               <li>If you press the "Clear Credentials" button</li>
+                               <li>If you "Generate a new key pair"</li>
+                               <li>If a new slice is added to your account</li>
+                       </ul>
+                       <h3>Clear server cache</h3>
+            <p>
+            <button class="btn btn-default btn-primary" type="button" title="Clear server cache" name="clear_server_cache" id="clear_server_cache" style="float:left;">Clear server cache</button>
+            <div id="clear_success" style="color:green; margin-left: 160px;">&nbsp;</div>
+            <div id="clear_error" style="color:red; margin-left: 160px;">&nbsp;</div>
+            </p>
+                       <p>Unless your account has not yet been validated, it is sufficient to refresh the page or go back to the home page. 
+                               The portal will then regenerate your credentials. In some cases it may take more time than usual. If nothing works, 
+                               then please logout and login back into to the portal.
+                       </p>
+                       <h3>Manual delegation of credentials</h3>
+                               <p>
+                                       You have selected upon sign-up to upload your public key. As you have uploaded your own public key, 
+                                       the portal can no longer generate your credentials automatically. In order to have your credentials 
+                                       delegated to the portal, please follow these instructions:
+                               </p>
+                               <ul>
+                                       <li>Your account must first be validated by the manager of your organization.</li>
+                                       <li>In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to
+                                               <a href="/portal/manual_delegation" target="_blank" style="text-decoration:underline;font-weight:bold;">delegate your credentials.</a></li>
+                               </ul>
+                       </p>
+                       <h3>Contact support</h3>
+                       <p>If you don't have the above mentioned cases and still have this message, please  <a href="/contact/" target="_blank" style="text-decoration:underline;font-weight:bold;">contact us</a>.</p>
+             </div>
+             <div class="modal-footer">
+                 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+             </div>
+         </div>
+     </div>
+</div>
+<script>
+$(document).ready(function() {
+    $('button#clear_server_cache').click(function() {
+        $('#clear_success').html('<img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Services" />');
+        $.post("/cache/clear/", function( data ) {
+            console.log(data);
+            if(data['ret']==1){
+                $('#clear_success').html('Server cache cleared')
+            }else{
+                $('#clear_error').html('error:'+data['error'])
+                $('#clear_success').html('');
+            }
+        });
+    });
+});
+</script>
+
diff --git a/portal/templates/_widget-tradeoff.html b/portal/templates/_widget-tradeoff.html
new file mode 100644 (file)
index 0000000..4e75ba3
--- /dev/null
@@ -0,0 +1,39 @@
+<!-- Modal- Trade-off Message  -->
+<div class="modal fade" id="tradeoffmodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+            <div class="modal-dialog">
+                <div class="modal-content">
+                    <div class="modal-header">
+                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                            <h4 class="modal-title" id="myModalLabel">
+                                                               Automatic vs. Manual delegation of credentials
+                                                       </h4>
+                    </div>
+                                       <div class="modal-body" style="text-align:justify;">
+                                       <h3>Automatic delegation of credentials</h3>
+                                               <p>Don't delete private key, ease-of-use option:</p>
+                                               <ul>
+                                                       <li>
+                                                               This means that you will keep your private key in the portal and it will automatically delegate your credentials on your behalf.
+                                                       </li>
+                                                       <li>
+                                                               This option does not provide as high of a level of security; however, your private key will still only be used in the portal and 
+                                                               will be available to you and the OneLab admins only.
+                                                       </li>
+                                               </ul>
+                                       <h3>Manual delegation of credentials</h3>
+                                               <p>Download & Delete private key, higher security option:</p>
+                                               <ul>
+                                                       <li>If you delete your private key, you will have more security but the portal will no longer be able to delegate credentials 
+                                                               on your behalf, and you will have to manually
+                                                               <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a>
+                                                       </li>
+                                               </ul>
+                                       <h3>Contact support</h3>
+                                       <p>For more information, please  <a href="/contact/" target="_blank">contact us</a>.</p>
+                    </div>
+                    <div class="modal-footer">
+                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+                    </div>
+                </div>
+            </div>
+</div>
index 6163459..5a610f3 100644 (file)
@@ -1,6 +1,8 @@
 {% extends "layout.html" %}
+{% load portal_filters %}
 {% block content %}
-
+{% widget "_widget-no_credentials.html" %}
+{% widget "_widget-tradeoff.html" %}
 <div class="row">
        <div class="col-md-12">
                 <div class="breadcrumbs">
                </table>
        
                </div>
-       
 
        {%if 'Enabled'  in user_status %}
                <div class="col-md-12">
                <h3>Credentials <small>Delegated to Principal Account</small></h3>
-                       <table class="table">
-                                       <caption><b>Delegated User Credential</b></caption> 
-                           <tr class="odd"> 
-                               <th>Expiration Date</th>
-                                               <th>Download</th>
-                           </tr>
-                                       {% for row in my_users %}         
-                                       <tr class="border_bottom">
-                                       <td class="odd"> {{ row.cred_exp }} </td>
-                                               <td class="odd">
-                                                       <button class="btn btn-default btn-xs" name= "dl_user_cred" type="submit" title="Download User Credential">
-                                                               <span class="glyphicon glyphicon-download"></span> Credential
-                                                       </button>
-                                                       <button class="btn btn-default btn-xs" name= "dl_user_cert" type="submit" title="Download User Certificate">
-                                                               <span class="glyphicon glyphicon-download"></span> Certificate
-                                                       </button>
-                             <button class="btn btn-default btn-xs" name= "dl_user_p12" type="submit" title="Download User PKCS12">
-                                 <span class="glyphicon glyphicon-download"></span> PKCS p12
-                             </button>
-                                               </td>
-                                       </tr>
-                                       {%endfor%}
-                                </table>
-                               <p></p>
-                               <table class="mytable table table-bordered table-hover">
-                                       <caption><b>Delegated Slice Credentials</b></caption>  
-                               <tr class="odd"> 
-                                               <th>Slice Name</th> 
-                                       <th>Expiration Date</th>
-                                               <th>Download</th>
-                               </tr>
-                                       {% for row in my_slices %}     
-                               <tr class="border_bottom">
-                                       <td class="odd"> {{ row.slice_name }} </td>
-                                               <td class="odd"> {{ row.cred_exp }} </td>
-                                               <td class="odd"> 
-                                                       <button class="btn btn-default btn-xs" name= "dl_{{row.slice_name}}" type="submit" title="Download Slice Credentials">
-                                                               <span class="glyphicon glyphicon-download"></span> Download
-                                                       </button> 
-                                               </td>
-                               </tr>
-                               {%endfor%}
-                               </table>
-                               <p></p>
-                               <table class="mytable table table-bordered table-hover">
-                                       <caption><b>Delegated Authority Credentials</b></caption>
-                                       <tr class="odd"> 
-                                       <th>Authority Name</th> 
-                                       <th>Expiration Date</th>
-                                               <th>Download</th>
-                                       </tr>
-                                       {% for row in my_auths %}
-                                       <tr class="border_bottom">
-                                       <td class="odd"> {{ row.auth_name }} </td>
-                                       <td class="odd"> {{ row.cred_exp }} </td>
-                                               <td class="odd">
-                                                       <button class="btn btn-default btn-xs" name= "dl_{{row.auth_name}}" type="submit" title="Download Authority Credentials">
-                                                               <span class="glyphicon glyphicon-download"></span> Download
-                                                       </button>
-                                               </td>
-                                       </tr>
-                                       {%endfor%}
-                               </table>
-                               <p></p>
-                                {%if '' not in my_users%}      
-                               <p><button class="btn btn-danger btn-lg btn-block"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
-                               {%else%}
-                               <p><button class="btn btn-danger btn-lg btn-block disabled"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
-                               {%endif%}
+                   <table class="table">
+                               <caption><b>Delegated User Credential</b></caption> 
+                       <tr class="odd"> 
+                           <th>Expiration Date</th>
+                                       <th>Download</th>
+                       </tr>
+                               {% for row in my_users %}         
+                               <tr class="border_bottom">
+                               <td class="odd"> {{ row.cred_exp }} </td>
+                                       <td class="odd">
+                                               <button class="btn btn-default btn-xs" name= "dl_user_cred" type="submit" title="Download User Credential">
+                                                       <span class="glyphicon glyphicon-download"></span> Credential
+                                               </button>
+                                               <button class="btn btn-default btn-xs" name= "dl_user_cert" type="submit" title="Download User Certificate">
+                                                       <span class="glyphicon glyphicon-download"></span> Certificate
+                                               </button>
+                         <button class="btn btn-default btn-xs" name= "dl_user_p12" type="submit" title="Download User PKCS12">
+                             <span class="glyphicon glyphicon-download"></span> PKCS p12
+                         </button>
+                                       </td>
+                               </tr>
+                               {%endfor%}
+                        </table>
+                       <p></p>
+                       <table class="mytable table table-bordered table-hover">
+                               <caption><b>Delegated Slice Credentials</b></caption>  
+                       <tr class="odd"> 
+                                       <th>Slice Name</th> 
+                               <th>Expiration Date</th>
+                                       <th>Download</th>
+                       </tr>
+                               {% for row in my_slices %}     
+                       <tr class="border_bottom">
+                               <td class="odd"> {{ row.slice_name }} </td>
+                                       <td class="odd"> {{ row.cred_exp }} </td>
+                                       <td class="odd"> 
+                                               <button class="btn btn-default btn-xs" name= "dl_{{row.slice_name}}" type="submit" title="Download Slice Credentials">
+                                                       <span class="glyphicon glyphicon-download"></span> Download
+                                               </button> 
+                                       </td>
+                       </tr>
+                       {%endfor%}
+                       </table>
+                       <p></p>
+                       <table class="mytable table table-bordered table-hover">
+                               <caption><b>Delegated Authority Credentials</b></caption>
+                               <tr class="odd"> 
+                               <th>Authority Name</th> 
+                               <th>Expiration Date</th>
+                                       <th>Download</th>
+                               </tr>
+                               {% for row in my_auths %}
+                               <tr class="border_bottom">
+                               <td class="odd"> {{ row.auth_name }} </td>
+                               <td class="odd"> {{ row.cred_exp }} </td>
+                                       <td class="odd">
+                                               <button class="btn btn-default btn-xs" name= "dl_{{row.auth_name}}" type="submit" title="Download Authority Credentials">
+                                                       <span class="glyphicon glyphicon-download"></span> Download
+                                               </button>
+                                       </td>
+                               </tr>
+                               {%endfor%}
+                       </table>
+                       <p></p>
+                        {%if '' not in my_users%}      
+                       <p><button class="btn btn-danger btn-lg btn-block"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
+                       {%else%}
+                       <p><button class="btn btn-danger btn-lg btn-block disabled"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
+                       {%endif%}
                </div>
        </div>
-<!-- Modal- No credentials -->
-<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
-            <div class="modal-dialog">
-                <div class="modal-content">
-                    <div class="modal-header">
-                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
-                            <h4 class="modal-title" id="myModalLabel">No credentials are delegated to the portal</h4>
-                    </div>
-                                       <div class="modal-body" style="text-align:justify;">
-                                       <p>You are getting this message for any of the following reasons:</p>
-                                       <ul>
-                                               <li>If your account is still pending for validation</li>
-                                               <li>If you press the "Clear Credentials" button</li>
-                                               <li>If you "Generate a new key pair"</li>
-                                               <li>If a new slice is added to your account</li>
-                                       </ul>
-                                       <p>Unless your account has not yet been validated, it is sufficient to refresh the page or go back to the home page. 
-                                               The portal will then regenerate your credentials. In some cases it may take more time than usual. If nothing works, 
-                                               then please logout and login back into to the portal.
-                                       </p>
-                                       <h3>Manual delegation of credentials</h3>
-                                               <p>
-                                                       You have selected upon sign-up to upload your public key. As you have uploaded your own public key, 
-                                                       the portal can no longer generate your credentials automatically. In order to have your credentials 
-                                                       delegated to the portal, please follow these instructions:
-                                               </p>
-                                               <ul>
-                                                       <li>Your account must first be validated by the manager of your organization.</li>
-                                                       <li>In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to
-                                                               <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a></li>
-                                               </ul>
-                                       </p>
-                                       <h3>Contact support</h3>
-                                       <p>If you don't have the above mentioned cases and still have this message, please  <a href="/contact/" target="_blank">contact us</a>.</p>
-                    </div>
-                    <div class="modal-footer">
-                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
-                    </div>
-                </div>
-            </div>
-</div>
-
-
-<!-- Modal- Trade-off Message  -->
-<div class="modal fade" id="tradeoffmodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
-            <div class="modal-dialog">
-                <div class="modal-content">
-                    <div class="modal-header">
-                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
-                            <h4 class="modal-title" id="myModalLabel">
-                                                               Automatic vs. Manual delegation of credentials
-                                                       </h4>
-                    </div>
-                                       <div class="modal-body" style="text-align:justify;">
-                                       <h3>Automatic delegation of credentials</h3>
-                                               <p>Don't delete private key, ease-of-use option:</p>
-                                               <ul>
-                                                       <li>
-                                                               This means that you will keep your private key in the portal and it will automatically delegate your credentials on your behalf.
-                                                       </li>
-                                                       <li>
-                                                               This option does not provide as high of a level of security; however, your private key will still only be used in the portal and 
-                                                               will be available to you and the Fed4FIRE admins only.
-                                                       </li>
-                                               </ul>
-                                       <h3>Manual delegation of credentials</h3>
-                                               <p>Download & Delete private key, higher security option:</p>
-                                               <ul>
-                                                       <li>If you delete your private key, you will have more security but the portal will no longer be able to delegate credentials 
-                                                               on your behalf, and you will have to manually
-                                                               <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a>
-                                                       </li>
-                                               </ul>
-                                       <h3>Contact support</h3>
-                                       <p>For more information, please  <a href="/contact/" target="_blank">contact us</a>.</p>
-                    </div>
-                    <div class="modal-footer">
-                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
-                    </div>
-                </div>
-            </div>
-</div>
-
 
 
        <div class="tab-pane row" id="access">
                        e.preventDefault();
                        $(this).tab('show');
                        id = $(this).attr('href').substr(1);
-               
                });
                
         $('button#createslice').click(function() {
index 4c1c6fb..bb5b16c 100644 (file)
@@ -6,47 +6,7 @@
 {% widget '_widget-news.html' %}
 </div> -->
 {% if username %}
-<!-- Modal- No credentials -->
-<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
-            <div class="modal-dialog">
-                <div class="modal-content">
-                    <div class="modal-header">
-                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
-                            <h4 class="modal-title" id="myModalLabel">No credentials are delegated to the portal</h4>
-                    </div>
-                    <div class="modal-body" style="text-align:justify;">
-                                       <p>You are getting this message for any of the following reasons:</p>
-                                       <ul>
-                                               <li>If your account is still pending for validation</li>
-                                               <li>If you press the "Clear Credentials" button</li>
-                                               <li>If you "Generate a new key pair"</li>
-                                               <li>If a new slice is added to your account</li>
-                                       </ul>
-                                       <p>Unless your account has not yet been validated, it is sufficient to refresh the page or go back to the home page. 
-                                               The portal will then regenerate your credentials. In some cases it may take more time than usual. If nothing works, 
-                                               then please logout and login back into to the portal.
-                                       </p>
-                                       <h3>Manual delegation of credentials</h3>
-                                               <p>
-                                                       You have selected upon sign-up to upload your public key. As you have uploaded your own public key, 
-                                                       the portal can no longer generate your credentials automatically. In order to have your credentials 
-                                                       delegated to the portal, please follow these instructions:
-                                               </p>
-                                               <ul>
-                                                       <li>Your account must first be validated by the manager of your organization.</li>
-                                                       <li>In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to
-                                                               <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a></li>
-                                               </ul>
-                                       </p>
-                                       <h3>Contact support</h3>
-                                       <p>If you don't have the above mentioned cases and still have this message, please  <a href="/contact/" target="_blank">contact us</a>.</p>
-                    </div>
-                    <div class="modal-footer">
-                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
-                    </div>
-                </div>
-            </div>
-</div>
+{% widget "_widget-no_credentials.html" %}
 <div class="container dashboard">
        <div class="row">
        {%if 'no_creds'  in user_cred %}
diff --git a/portal/templates/fed4fire/fed4fire_institution.html b/portal/templates/fed4fire/fed4fire_institution.html
new file mode 100644 (file)
index 0000000..021e3ee
--- /dev/null
@@ -0,0 +1,264 @@
+{% extends "layout_wide.html" %}
+
+{% block head %} 
+<script type="text/javascript" src="{{STATIC_URL}}/js/institution.js"></script>
+{% endblock head %}
+
+{% block content %}
+<div class="container">
+       <div class="row">
+               <div class="col-md-12">
+                        <div class="breadcrumbs">
+                {% if project %}
+                               Management &nbsp;>&nbsp; Project: <span id="authority_name">{{user_details.parent_authority}}</span>
+                {% else %}
+                               Management &nbsp;>&nbsp; Institution: <span id="authority_name">{{user_details.parent_authority}}</span>
+                {% endif %}
+                        </div>
+               </div>
+       </div>
+</div>
+<div class="container">
+       <div class="row">
+               <div class="col-md-12">
+                       <ul class="nav nav-tabs nav-section">
+                               <li class="active"><a href="#about">About</a></li>
+                               <li><a href="#users">Users</a></li>
+                {% if not project %}
+                               <li><a href="#projects">Projects</a></li>
+                {% endif %}
+                               <li><a href="#slices">Slices</a></li>
+                               <li><a href="#requests">Requests</a></li>
+                       </ul>
+           </div>
+       </div>
+</div>
+<div class="container tab-content">
+       <div class="tab-pane active row" id="about">
+        <div class="col-md-12 el">
+        <h2>{{user_details.parent_authority}}</h2>
+        </div>
+       </div>
+       
+       <div class="tab-pane row" id="users" data-authority="{{user_details.parent_authority}}">
+               <div class="col-md-12 el">
+                       <div id="user-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
+                               <div id="user-tab-loaded" style="display:none;">
+                               <table id="user-tab" class="table">
+                                       <tr>
+                                       <th>+/-</th>
+                            {% if not project %}
+                                       <th>Email</th>
+                            {% endif %}
+                                       <th>User hrn</th>
+                            <!--
+                                       <th>First name</th>
+                                       <th>Last name</th>
+                                       <th>Enabled</th>
+                            -->
+                                       </tr>
+                               </table>
+                               
+                       </div>
+                       {%if  pi %}     
+                       <div>
+                {% if project %}
+                               <button id="removepi" type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Remove from project</button>
+                {% else %}
+                               <button id="makepi" type="button" class="btn btn-primary"><span class="glyphicon glyphicon-arrow-up"></span> Upgrade to PI</button>
+                               <button id="removepi" type="button" class="btn"><span class="glyphicon glyphicon-arrow-down"></span> Downgrade to  user</button>
+                               <button id="deleteusers" type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Delete selected users</button>
+                {% endif %}
+                       </div>
+                       {% endif %}
+               </div>
+       </div>
+
+    {% if not project %}
+       <div class="tab-pane row" id="projects" data-authority="{{user_details.parent_authority}}">
+               <div class="col-md-12 el">
+                       <div id="project-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Projects" /></div>
+                               <div id="project-tab-loaded" style="display:none;">
+                               <table id="project-tab" class="table">
+                                       <tr>
+                                       <th>+/-</th>
+                                       <th>Project hrn</th>
+                                       </tr>
+                               </table>
+                               
+                       </div>
+               {% if  pi %}
+                       <div>
+                       <button id="createproject" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create project</button>
+                       <button id="deleteprojects" type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Delete selected projects</button>
+                       {% else %}
+                       <button id="createproject" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Request project</button>
+                       {% endif %}
+                       </div>
+               </div>
+       </div>
+   {% endif %}
+       <div class="tab-pane row" id="slices">
+               <div class="col-md-12 el">
+           <div id="slice-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
+           <div id="slice-tab-loaded" style="display:none;">
+               <table id="slice-tab" class="table">
+                   <tr>
+                       <th>+/-</th>
+                       <th>Slice hrn</th>
+                       <th>Users</th>
+                       <th>Url</th>
+                       <!-- <th>nodes</th> -->
+                       <th>Creation</th>
+                   </tr>
+               </table>                        
+           </div>
+        <div>
+               {% if pi %}
+                       <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create slice</button>
+            <button id="renewslices" type="button" class="btn btn-primary"><span class="glyphicon glyphicon-refresh"></span> Renew Slices</button>
+            <button id="deleteslices" type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Delete Slices</button>
+                       {% else %}
+                       <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Request slice</button>
+                       {% endif %}
+        </div>
+          </div>
+       </div>
+       <div class="tab-pane row" id="requests">
+       </div>
+</div>
+<script>
+$(document).ready(function() {
+    {% if person %}
+    {% if user_details.parent_authority %}
+
+        $.post("/rest/myslice:slice/",{'fields':['slice_hrn','users','url','slice_date_created'],'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
+            var list_slices = [];
+            var table_slices = [];
+            /* "slice_hrn", "slice_description", "slice_type", "parent_authority", "created", "nodes", "slice_url", "slice_last_updated", "users", "slice_urn", "slice_expires" */
+            $.each( data, function( key, val ) {
+                list_slices.push( "<li><a href=\"portal/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></li>" );
+                if(val.nodes=="undefined" || val.nodes==null){
+                    nodes_length=0;
+                }else{
+                    nodes_length=val.nodes.length;
+                }
+                console.log(val);
+                if(val.users=="undefined" || val.users==null){
+                    users_length=0;
+                }else{
+                    users_length=val.users.length;
+                }
+
+                if(val.url=="undefined" || val.url==null){
+                    slice_url="";
+                }else{
+                    slice_url="<a href='"+val.url+"' target='_blank'>"+val.url+"</a>";
+                }
+                
+                slice_row = "<tr id='"+val.slice_hrn+"'>";
+                slice_row += "<td><input type='checkbox' class='slice' id='"+val.slice_hrn+"'></td>";
+                slice_row += "<td><a href='/slice/"+val.slice_hrn+"'>" + val.slice_hrn + "</a></td>";
+                slice_row += "<td>"+users_length+"</td>";
+                slice_row += "<td>"+slice_url+"</td>";
+                //slice_row += "<td>"+nodes_length+"</td>";
+                slice_row += "<td>"+val.slice_date_created+"</td>";
+                slice_row += "</tr>";
+                table_slices.push(slice_row);
+                
+            });
+           
+            /* $("div#slice-list").html($( "<ul/>", { html: list_slices.join( "" ) })); */
+            $("table#slice-tab tr:last").after(table_slices.join( "" ));
+            $("div#slice-tab-loaded").css("display","block");
+            $("div#slice-tab-loading").css("display","none");
+        });
+               
+        {% if project %}
+               $.post("/rest/myslice:authority/",{'fields':['pi_users'],'filters':{'authority_hrn':'{{user_details.parent_authority}}'}}, function( data ) {
+           
+            var table_users = [];
+            $.each( data[0].pi_users, function( key, val ) {
+                console.log(val);
+                user_row = "<tr id='"+val+"'>";
+                user_row += "<td><input type='checkbox' class='user' id='"+val+"'></td>";
+                user_row += "<td>"+val+"</td>";
+                user_row += "</tr>";
+                table_users.push(user_row);
+            });
+            $("table#user-tab tr:last").after(table_users.join( "" ));
+            $("div#user-tab-loaded").css("display","block");
+            $("div#user-tab-loading").css("display","none");
+
+        });
+        {% else %}
+        $.post("/rest/user/",{'fields':['user_hrn','user_email'],'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
+            var list_users = [];
+            var table_users = [];
+                   /* Available fields
+                   user_gid, user_enabled, slices, pi_authorities, keys, parent_authority, user_first_name,
+                   user_urn, user_last_name, user_phone, user_hrn, user_email, user_type
+                   */
+            $.each( data, function( key, val ) {
+                list_users.push( "<li><a href=\"portal/user/"+val.user_email+"\">" + val.user_email + "</a></li>" );
+                user_row = "<tr id='"+val.user_hrn+"'>";
+                user_row += "<td><input type='checkbox' class='user' id='"+val.user_hrn+"'></td>";
+                user_row += "<td>"+val.user_email+"</td>";
+                user_row += "<td>"+val.user_hrn+"</td>";
+                /*
+                user_row += "<td>"+val.user_first_name+"</td>";
+                user_row += "<td>"+val.user_last_name+"</td>";
+                           user_row += "<td>"+val.user_enabled+"</td>";
+                */
+                user_row += "</tr>";
+                table_users.push(user_row);
+            });
+            $("table#user-tab tr:last").after(table_users.join( "" ));
+            $("div#user-tab-loaded").css("display","block");
+            $("div#user-tab-loading").css("display","none");
+        });
+               $.post("/rest/myslice:authority/",{'fields':['authority_hrn','pi_users'],'filters':{'authority_hrn':'CONTAINS{{user_details.parent_authority}}'}}, function( data ) {
+           
+            var table_projects = [];
+            $.each( data, function( key, val ) {
+                console.log(val);
+                project_row = "<tr id='"+val.authority_hrn+"'>";
+                project_row += "<td><input type='checkbox' class='project' id='"+val.authority_hrn+"'></td>";
+                project_row += "<td><a href='/portal/project/"+val.authority_hrn+"'>"+val.authority_hrn+"</a></td>";
+                project_row += "</tr>";
+                table_projects.push(project_row);
+            });
+            $("table#project-tab tr:last").after(table_projects.join( "" ));
+            $("div#project-tab-loaded").css("display","block");
+            $("div#project-tab-loading").css("display","none");
+
+        });
+
+        {% endif %}
+    {% endif %}
+    {% endif %}
+
+}); // End document.ready
+
+$(document).ready(function() {
+       $('.nav-tabs a').click(function (e) {
+               e.preventDefault();
+               $(this).tab('show');
+       var id = $(this).attr('href').substr(1);
+       if ((id == 'requests')){
+               $("#" + id).load('/management/' + id);
+        }
+        /*
+       if ((id == 'requests') || (id == 'about'))
+               $("#" + id).load('/management/' + id);
+        */
+       });
+       var hash = window.location.hash;
+       if (hash) {
+               $('.nav-tabs a[href='+hash+']').click();
+       } else {
+               $('.nav-tabs a[href=#about]').click();
+       }
+});
+</script>
+{% endblock %}
index 26fdf0a..30fad6c 100644 (file)
@@ -28,6 +28,9 @@
 </div>
 <div class="container tab-content">
        <div class="tab-pane active row" id="about">
+        <div class="col-md-12 el">
+        <h2>{{user_details.parent_authority}}</h2>
+        </div>
        </div>
        
        <div class="tab-pane row" id="users" data-authority="{{user_details.parent_authority}}">
@@ -50,8 +53,8 @@
                        </div>
                        {%if  pi %}     
                        <div>
-                               <button id="makepi" type="button" class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span> Upgrade to PI</button>
-                               <button id="removepi" type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Downgrade to  user</button>
+                               <button id="makepi" type="button" class="btn btn-primary"><span class="glyphicon glyphicon-arrow-up"></span> Upgrade to PI</button>
+                               <button id="removepi" type="button" class="btn"><span class="glyphicon glyphicon-arrow-down"></span> Downgrade to  user</button>
                                <button id="deleteusers" type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Delete selected users</button>
                        </div>
                        {% endif %}
@@ -193,13 +196,13 @@ $(document).ready(function() {
                e.preventDefault();
                $(this).tab('show');
        var id = $(this).attr('href').substr(1);
-        /*
        if ((id == 'requests')){
                $("#" + id).load('/management/' + id);
         }
-        */
+        /*
        if ((id == 'requests') || (id == 'about'))
                $("#" + id).load('/management/' + id);
+        */
        });
        var hash = window.location.hash;
        if (hash) {
index 13da125..86071f1 100644 (file)
@@ -1,6 +1,8 @@
 {% extends "layout.html" %}
+{% load portal_filters %}
 {% block content %}
-
+{% widget "_widget-no_credentials.html" %}
+{% widget "_widget-tradeoff.html" %}
 <div class="row">
        <div class="col-md-12">
                 <div class="breadcrumbs">
                                {%endif%}
                </div>
        </div>
-<!-- Modal- No credentials -->
-<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
-            <div class="modal-dialog">
-                <div class="modal-content">
-                    <div class="modal-header">
-                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
-                            <h4 class="modal-title" id="myModalLabel">No credentials are delegated to the portal</h4>
-                    </div>
-                                       <div class="modal-body" style="text-align:justify;">
-                                       <p>You are getting this message for any of the following reasons:</p>
-                                       <ul>
-                                               <li>If your account is still pending for validation</li>
-                                               <li>If you press the "Clear Credentials" button</li>
-                                               <li>If you "Generate a new key pair"</li>
-                                               <li>If a new slice is added to your account</li>
-                                       </ul>
-                                       <p>Unless your account has not yet been validated, it is sufficient to refresh the page or go back to the home page. 
-                                               The portal will then regenerate your credentials. In some cases it may take more time than usual. If nothing works, 
-                                               then please logout and login back into to the portal.
-                                       </p>
-                                       <h3>Manual delegation of credentials</h3>
-                                               <p>
-                                                       You have selected upon sign-up to upload your public key. As you have uploaded your own public key, 
-                                                       the portal can no longer generate your credentials automatically. In order to have your credentials 
-                                                       delegated to the portal, please follow these instructions:
-                                               </p>
-                                               <ul>
-                                                       <li>Your account must first be validated by the manager of your organization.</li>
-                                                       <li>In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to
-                                                               <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a></li>
-                                               </ul>
-                                       </p>
-                                       <h3>Contact support</h3>
-                                       <p>If you don't have the above mentioned cases and still have this message, please  <a href="/contact/" target="_blank">contact us</a>.</p>
-                    </div>
-                    <div class="modal-footer">
-                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
-                    </div>
-                </div>
-            </div>
-</div>
-
-
-<!-- Modal- Trade-off Message  -->
-<div class="modal fade" id="tradeoffmodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
-            <div class="modal-dialog">
-                <div class="modal-content">
-                    <div class="modal-header">
-                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
-                            <h4 class="modal-title" id="myModalLabel">
-                                                               Automatic vs. Manual delegation of credentials
-                                                       </h4>
-                    </div>
-                                       <div class="modal-body" style="text-align:justify;">
-                                       <h3>Automatic delegation of credentials</h3>
-                                               <p>Don't delete private key, ease-of-use option:</p>
-                                               <ul>
-                                                       <li>
-                                                               This means that you will keep your private key in the portal and it will automatically delegate your credentials on your behalf.
-                                                       </li>
-                                                       <li>
-                                                               This option does not provide as high of a level of security; however, your private key will still only be used in the portal and 
-                                                               will be available to you and the OneLab admins only.
-                                                       </li>
-                                               </ul>
-                                       <h3>Manual delegation of credentials</h3>
-                                               <p>Download & Delete private key, higher security option:</p>
-                                               <ul>
-                                                       <li>If you delete your private key, you will have more security but the portal will no longer be able to delegate credentials 
-                                                               on your behalf, and you will have to manually
-                                                               <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a>
-                                                       </li>
-                                               </ul>
-                                       <h3>Contact support</h3>
-                                       <p>For more information, please  <a href="/contact/" target="_blank">contact us</a>.</p>
-                    </div>
-                    <div class="modal-footer">
-                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
-                    </div>
-                </div>
-            </div>
-</div>
-
-
 
        <div class="tab-pane row" id="access">
                <div class="col-md-12">
index 32e7373..bacc2b2 100644 (file)
@@ -6,53 +6,13 @@
 {% widget '_widget-news.html' %}
 </div> -->
 {% if username %}
-<!-- Modal- No credentials -->
-<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
-            <div class="modal-dialog">
-                <div class="modal-content">
-                    <div class="modal-header">
-                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
-                            <h4 class="modal-title" id="myModalLabel">No credentials are delegated to the portal</h4>
-                    </div>
-                    <div class="modal-body" style="text-align:justify;">
-                                       <p>You are getting this message for any of the following reasons:</p>
-                                       <ul>
-                                               <li>If your account is still pending for validation</li>
-                                               <li>If you press the "Clear Credentials" button</li>
-                                               <li>If you "Generate a new key pair"</li>
-                                               <li>If a new slice is added to your account</li>
-                                       </ul>
-                                       <p>Unless your account has not yet been validated, it is sufficient to refresh the page or go back to the home page. 
-                                               The portal will then regenerate your credentials. In some cases it may take more time than usual. If nothing works, 
-                                               then please logout and login back into to the portal.
-                                       </p>
-                                       <h3>Manual delegation of credentials</h3>
-                                               <p>
-                                                       You have selected upon sign-up to upload your public key. As you have uploaded your own public key, 
-                                                       the portal can no longer generate your credentials automatically. In order to have your credentials 
-                                                       delegated to the portal, please follow these instructions:
-                                               </p>
-                                               <ul>
-                                                       <li>Your account must first be validated by the manager of your organization.</li>
-                                                       <li>In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to
-                                                               <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a></li>
-                                               </ul>
-                                       </p>
-                                       <h3>Contact support</h3>
-                                       <p>If you don't have the above mentioned cases and still have this message, please  <a href="/contact/" target="_blank">contact us</a>.</p>
-                    </div>
-                    <div class="modal-footer">
-                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
-                    </div>
-                </div>
-            </div>
-</div>
+{% widget "_widget-no_credentials.html" %}
 <div class="container dashboard">
-          {%if 'no_creds'  in user_cred %}
-      <p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">NO CREDENTIALS</a> are delegated to the portal!</p>
-  {%endif%}
-        {%if 'creds_expired'  in user_cred %}
-    <p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">EXPIRED CREDENTIALS</a> Please delegate again your credentials to the portal!</p>
+       {%if 'no_creds'  in user_cred %}
+        <p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">NO CREDENTIALS</a> are delegated to the portal!</p>
+    {%endif%}
+       {%if 'creds_expired'  in user_cred %}
+        <p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">EXPIRED CREDENTIALS</a> Please delegate again your credentials to the portal!</p>
     {%endif%}
 
        <div class="row">