source: trunk/web/templates/info.tmpl @ 205

Last change on this file since 205 was 205, checked in by ecprice, 17 years ago

A monster checkin, with a variety of changes to the web
infrastructure.

Adds some support for javascript and asynchronous updates.

Also added prototype.

The interface is *really* *slow*, though.

File size: 3.5 KB
Line 
1#from skeleton import skeleton
2#extends skeleton
3
4#def title
5Info on $machine.name
6#end def
7
8#def infoTable()
9<p>Info on ${machine.name}:</p>
10<table>
11  #for $key, $value in $fields
12  <tr><td>$key:</td><td>$value</td></tr>
13  #end for
14</table>
15#end def
16
17#def commands()
18<script>
19function commandButton(elt, action){
20  form = elt.up('', 4);
21  cdrom = Form.serialize(form, true).cdrom;
22  new Ajax.Request('command', {method: 'post',
23  parameters: 'machine_id=$machine.machine_id&js=info&cdrom='+cdrom+'&action='+action,
24  onSuccess: replaceFunc
25  });
26  return false;
27}
28</script>
29<form action="command" action="POST">
30  <input type="hidden" name="machine_id" value="$machine.machine_id"/>
31  <table>
32   
33    <tr><td>
34        #if $on
35        #if $has_vnc
36        <a href="vnc?machine_id=$machine.machine_id">Console</a>
37        #else
38        VNC is not enabled
39        #end if
40        #else
41
42        #end if
43    </td></tr>
44      <tr>
45        #if $on
46        <td><input type="submit" class="button" name="action" value="Power off" onclick="return commandButton(this, 'Power off');"/></td>
47        <td><input type="submit" class="button" name="action" value="Shutdown" onclick="return commandButton(this, 'Shutdown');"/></td>
48        <td><input type="submit" class="button" name="action" value="Reboot" onclick="return commandButton(this, 'Reboot');"/></td>
49        #else
50        <td><input type="submit" class="button" name="action" value="Power on" onclick="return commandButton(this, 'Power on');"/></td>
51        #end if
52      <td>Boot CD:</td>
53      <td>$cdromList($cdroms)</td>
54  </tr>
55    <tr>
56      <td><input type="submit" class="button" name="action" value="Delete VM" onclick="return confirm('Are you sure that you want to delete this VM?');"/></td>
57    </tr>
58  </table>
59</form>
60#end def
61
62#def modifyForm()
63#if $err
64<p class="error">We had a problem with your request:</p>
65#else if $varExists('new_machine')
66<p>Successfully modified.</p>
67#end if
68#if $on
69(To edit ram, disk size, or machine name, turn off the machine first.)
70#end if
71</p>
72<form action="modify" method="POST" onsubmit="return jsFormSubmit('modify', this);">
73  <input type="hidden" name="machine_id" value="$defaults.machine_id"/>
74  <table>
75    <tr><td>Owner${helppopup("owner")}:</td><td><input type="text" name="owner", value="$defaults.owner"/></td></tr>
76$errorRow('owner', $err)
77    <tr><td>Administrator${helppopup("administrator")}:</td><td><input type="text" name="administrator", value="$defaults.administrator"/></td></tr>
78$errorRow('administrator', $err)
79    <tr><td>Contact email:</td><td><input type="text" name="contact" value="$defaults.contact"/></td></tr>
80$errorRow('contact', $err)
81#if $machine.nics
82    <tr><td>Hostname:</td><td><input type="text" name="hostname" value="$defaults.hostname"/>.servers.csail.mit.edu</td></tr>
83#end if
84$errorRow('hostname', $err)
85#if not $on
86    <tr><td>Machine Name:</td><td><input type="text" name="name" value="$defaults.name"/></td></tr>
87$errorRow('name', $err)
88    <tr><td>Ram:</td><td><input type="text" size=3 name="memory" value="$defaults.memory"/>MB (max $max_mem)</td></tr>
89$errorRow('memory', $err)
90    <tr><td>Disk:</td><td><input type="text" size=3 name="disk" value="$defaults.disk"/>GB (max $max_disk)</td><td>WARNING: Modifying disk size may corrupt your data.</td></tr>
91$errorRow('disk', $err)
92#else
93$errorRow('name', $err)
94$errorRow('memory', $err)
95$errorRow('disk', $err)
96#end if
97    <tr><td><input type="submit" class="button" name="action" value="Change"/></td></tr>
98  </table>
99</form>
100#end def
101
102#def body
103<h1>Info</h1>
104<div id="info">
105  $infoTable()
106</div>
107
108<p>Commands:</p>
109<div id="commands">
110  $commands()
111</div>
112<p>Change settings:
113<div id="modify">
114  $modifyForm()
115</div>
116#end def
Note: See TracBrowser for help on using the repository browser.