/[projects]/misc/xenconsole/index.php
ViewVC logotype

Diff of /misc/xenconsole/index.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1953 by torben, Mon Mar 25 20:08:29 2013 UTC revision 1957 by torben, Tue Mar 26 13:15:05 2013 UTC
# Line 46  $namelabel = $host["name_label"]; Line 46  $namelabel = $host["name_label"];
46  <html>  <html>
47  <head>  <head>
48  <title>XenServer::<?php echo $namelabel;?></title>  <title>XenServer::<?php echo $namelabel;?></title>
49    
50    <link rel="stylesheet" type="text/css" href="jquery/theme/jquery-ui.css">
51    <style>
52    .ui-menu {
53            width: 200px;
54    }
55    </style>
56  <script type='text/javascript' src="jquery/jquery-1.9.1.min.js"></script>  <script type='text/javascript' src="jquery/jquery-1.9.1.min.js"></script>
57    <script type='text/javascript' src="jquery/jquery-ui-1.10.2.min.js"></script>
58    
59  <script type='text/javascript'>  <script type='text/javascript'>
60    var menu = 0;
61    
62  $(document).ready( function() {  $(document).ready( function() {
63            $("#menu").hide();
64          setInterval(refreshData, 60000);                  setInterval(refreshData, 60000);        
65          refreshData();          refreshData();
66          $('.console').click( function() {          $('.console').click( function() {
67                  var session = $(this).data('session');                  var session = $(this).data('session');
68                  var conurl = $(this).data('conurl');                  var conurl = $(this).data('conurl');
69                  var name = $(this).data('name');                  var name = $(this).data('name');
70                  console(conurl,session,name);                  openConsole(conurl,session,name);
71          });          });
72    
73          $('#logo').click( function() {          $('#logo').click( function() {
74                  refreshData();                  refreshData();
75          });          });
76    
77            $('.settings').click( function(event) {
78    
79                    $('#menu').menu( {
80                            select: function(event2,ui) {
81                                            alert( ui.item.text() );
82                                    },
83                            create: function(event3,ui) {
84                                    menu = 1;
85                                    }
86                            /*position: {
87                                    my: "left", of: event
88                            }*/
89                    });
90                    $('#menu').show().position( {my: "left top", of: event} );
91                    event.stopPropagation();
92            });
93    
94            $(document).click( function(event) {
95                    closeMenu();
96            });
97    
98  });  });
99    
100    function closeMenu() {
101            if (menu > 0) {
102                    $("#menu").menu("destroy").hide();
103                    menu = 0;
104            }
105    }
106    
107  function refreshData() {  function refreshData() {
108          $("#logo").hide();                $("#logo").hide();      
109          $.get('ajaxdata.php', function(xml) {          $.get('ajaxdata.php', function(xml) {
# Line 126  function refreshData() { Line 166  function refreshData() {
166                                  vm.find('.console').data('conurl', conurl);                                  vm.find('.console').data('conurl', conurl);
167                                  vm.find('.console').data('session', session);                                  vm.find('.console').data('session', session);
168                                  vm.find('.console').data('name', name);                                  vm.find('.console').data('name', name);
169                                    vm.find('.settings').hide();
170                                  vm.find('.actionstop').show();                                  vm.find('.actionstop').show();
171                                  vm.find('.actionstart').hide();                                  vm.find('.actionstart').hide();
172                                  vm.find('.os').text(' - ' + os);                                  vm.find('.os').text(' - ' + os);
# Line 148  function refreshData() { Line 189  function refreshData() {
189    
190                                  vm.find('.network').hide();                                  vm.find('.network').hide();
191                                  vm.find('.console').hide();                                  vm.find('.console').hide();
192                                    vm.find('.settings').show();
193                                  vm.find('.actionstop').hide();                                  vm.find('.actionstop').hide();
194                                  vm.find('.actionstart').show();                                  vm.find('.actionstart').show();
195                                  vm.find('.cpu_graph').hide();                                  vm.find('.cpu_graph').hide();
# Line 188  function doAction(action, uuid, vm) { Line 230  function doAction(action, uuid, vm) {
230          });          });
231  }  }
232    
233  function console(url, session, name) {  function openConsole(url, session, name) {
234          if (url == '')          if (url == '')
235                  return;                  return;
236    
# Line 307  foreach($vms_array as $vm) { Line 349  foreach($vms_array as $vm) {
349                                  <a href='#' style='display:none;' class='console'>                                  <a href='#' style='display:none;' class='console'>
350                                          <img src='gfx/icon-terminal.png' style='vertical-align: middle;'>                                          <img src='gfx/icon-terminal.png' style='vertical-align: middle;'>
351                                  </a>                                  </a>
352                                    <a href='#' style='display:none;' class='settings'>
353                                            <img src='gfx/icon-settings16.png' style='vertical-align: middle;'>
354                                    </a>
355                          </td>                          </td>
356                  </tr>                  </tr>
357    
# Line 359  foreach($vms_array as $vm) { Line 404  foreach($vms_array as $vm) {
404    
405  <?PHP } ?>  <?PHP } ?>
406  </td></tr></table>  </td></tr></table>
407    
408    <br>
409    
410    <ul id="menu">
411            <li><a href="#">Set Memory Size</a></li>
412            <li><a href="#">Set CPU Count</a></li>
413    
414    
415    <!--    <li><a href="#">Item 3</a>
416                    <ul>
417                            <li><a href="#">Item 3-1</a></li>
418                            <li><a href="#">Item 3-2</a></li>
419                            <li><a href="#">Item 3-3</a></li>
420                            <li><a href="#">Item 3-4</a></li>
421                            <li><a href="#">Item 3-5</a></li>
422                    </ul>
423            </li>
424            <li><a href="#">Item 4</a></li>
425            <li><a href="#">Item 5</a></li>-->
426    </ul>
427    
428  </body></html>  </body></html>
429    

Legend:
Removed from v.1953  
changed lines
  Added in v.1957

  ViewVC Help
Powered by ViewVC 1.1.20