c0f06c34f04bea84528f3c1a1f3502a1726796cf
[myslice.git] / portal / templates / fibre / fibre_home-view.html
1 {% extends "layout.html" %}
2
3 {% block content %}
4 <div class="row" id="home-dashboard">
5         <ul class="nav nav-tabs">
6           <li class="active"><a class="home-tab" data-panel="user" href="#">USER</a></li>
7           <li><a class="home-tab" data-panel="manager" href="#">MANAGER</a></li>
8         </ul>
9         <div class="home-panel" id="user">
10                 <table>
11                         <tr>
12                                 <td>ACCOUNT</td>
13                                 <td>SLICES</td>
14                                 <td>SUPPORT</td>
15                         </tr>
16                         <tr>
17                                 <td><a href="/portal/account/"><img src="{{ STATIC_URL }}img/icon_user_color.png" alt="" /></a></td>
18                                 <td><a href="#"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a></td>
19                                 <td><a href="/portal/support"><img src="{{ STATIC_URL }}img/icon_support.png" alt="" /></a></td>
20                         </tr>
21                         <tr>
22                                 {% if person %}
23                                 <td class="logged-in">
24                                         <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
25                                         <div>
26                                         {% if person.last_name %}
27                                                 {{person.first_name}} {{person.last_name}}<br />
28                                         {% endif %}
29                                         <span class="label">Email:</span> <a href='/portal/account/'>{{person.email}}</a>
30                                 </div>
31                                 {% else %}
32                                 <td>
33                     {# include 'fibre__widget-login-user.html' #}
34                                         {# include 'fibre__widget-login-ldap-user.html' #}
35                                         {% include 'fibre__widget-login-fed-manager.html' %}
36                                     <a href="/cafe"><img src="{{ STATIC_URL }}img/fibre/cafe.jpg" alt="CAFe authentication" /></a>
37                                 {% endif %}
38                                 </td>
39                                 <td>
40                                 {% if person %}
41                                         <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Request a Slice</button>
42                                         <div id="home-slice-list"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
43                                 {% else %}
44                                 {% endif %}
45                                 </td>
46                                 <td class="support">
47                                         <button id="ticketbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create Ticket</button>
48                                         <div>
49                                                 <a href="/portal/contact">Contact</a> <br />
50                                                 <a href="/portal/support/documentation">Documentation</a>
51                                         </div>
52                                 </td>
53                         </tr>
54                 </table>
55         </div>
56         <div class="home-panel" id="manager">
57                 <table>
58                         <tr>
59                                 <td>INSTITUTION</td>
60                                 <td>SLICES</td>
61                                 <td>REQUESTS</td>
62                         </tr>
63                         <tr>
64                                 <td><a href="/portal/institution"><img src="{{ STATIC_URL }}img/icon_authority_color.png" alt="" /></a></td>
65                                 <td><a href="/portal/institution#slices"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a></td>
66                                 <td><a href="/portal/validate"><img src="{{ STATIC_URL }}img/icon_testbed_color.png" alt="" /></a></td>
67                         </tr>
68         </table>
69         <table>
70                         <tr class="bar1">
71                                 {% if person %}
72                                 <td class="logged-in">
73                                         <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
74                                 {% else %}
75                                 <td>
76                     {# include 'fibre__widget-login-user.html' #}
77                                         {# include 'fibre__widget-login-ldap-user.html' #}
78                                         {% include 'fibre__widget-login-fed-manager.html' %}
79                                 {% endif %}
80                                 </td>
81                                 <td>
82                                         {% if person %}
83                                     <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create a Slice</button>
84                                         {% endif %}
85                                 </td>
86                                 <td class="support">
87                                         {% if person %}
88                                     <button id="validaterequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-ok"></span> Validate Requests</button>
89                                         {% endif %}
90                                 </td>
91                         </tr>
92                 </table>
93         </div>
94 </div>
95 <div id="footer">
96     FIBRE - Future Internet testbeds / experimentation between BRazil and Europe
97 </div>
98 <script>
99         $(document).ready(function() {
100                 $('a.home-tab').click(function() {
101                         $('ul.nav-tabs li').removeClass('active');
102                         $(this).parent().addClass('active');
103                         $('div.home-panel').hide();
104                         $('div#'+$(this).data('panel')).show();
105                 });
106                 $('button#validaterequestbtn').click(function() {
107                         window.location="/portal/validate/";
108                 });
109                 $('button#ticketbtn').click(function() {
110                         window.location="/portal/contact/";
111                 });
112                 $('button#slicerequestbtn').click(function() {
113                         window.location="/portal/slice_request/";
114                 });
115                 
116                 {% if person %}
117         $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
118                   var items = [];
119                   $.each( data[0].slices, function(i, val) {
120                         items.push( "<li><a href=\"/slice/"+val+"\">" + val + "</a></li>" );
121                   });
122                   
123                   $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
124                   
125                 });
126                 {% endif %}
127         });
128 </script>
129 {% endblock %}