Changeset 205 for trunk/web/templates/info.tmpl
- Timestamp:
- Oct 20, 2007, 8:28:32 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/templates/info.tmpl
r187 r205 6 6 #end def 7 7 8 9 #def body 10 <h1>Info</h1> 8 #def infoTable() 11 9 <p>Info on ${machine.name}:</p> 12 10 <table> … … 15 13 #end for 16 14 </table> 15 #end def 17 16 18 <p>Commands:</p> 17 #def commands() 18 <script> 19 function 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> 19 29 <form action="command" action="POST"> 20 30 <input type="hidden" name="machine_id" value="$machine.machine_id"/> … … 34 44 <tr> 35 45 #if $on 36 <td><input type="submit" class="button" name="action" value="Power off" /></td>37 <td><input type="submit" class="button" name="action" value="Shutdown" /></td>38 <td><input type="submit" class="button" name="action" value="Reboot" /></td>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> 39 49 #else 40 <td><input type="submit" class="button" name="action" value="Power on" /></td>50 <td><input type="submit" class="button" name="action" value="Power on" onclick="return commandButton(this, 'Power on');"/></td> 41 51 #end if 42 52 <td>Boot CD:</td> 43 <td><select name="cdrom"> 44 <option selected value="">None</option> 45 #for $cdrom in $cdroms 46 <option value="$cdrom.cdrom_id"> 47 $cdrom.description 48 </option> 49 #end for 50 </select></td> 53 <td>$cdromList($cdroms)</td> 51 54 </tr> 52 55 <tr> 53 <td><input type="submit" class="button" name="action" value="Delete VM" /></td>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> 54 57 </tr> 55 58 </table> 56 59 </form> 57 <p>Change settings: 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 58 68 #if $on 59 69 (To edit ram, disk size, or machine name, turn off the machine first.) 60 70 #end if 61 71 </p> 62 <form action="modify" method="POST" >63 <input type="hidden" name="machine_id" value="$ machine.machine_id"/>72 <form action="modify" method="POST" onsubmit="return jsFormSubmit('modify', this);"> 73 <input type="hidden" name="machine_id" value="$defaults.machine_id"/> 64 74 <table> 65 <tr><td>Owner${helppopup("owner")}:</td><td><input type="text" name="owner", value="$machine.owner"/></td></tr> 66 <tr><td>Administrator${helppopup("administrator")}:</td><td><input type="text" name="administrator", value="$machine.administrator"/></td></tr> 67 <tr><td>Contact email:</td><td><input type="text" name="contact" value="$machine.contact"/></td></tr> 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) 68 81 #if $machine.nics 69 <tr><td>Hostname:</td><td><input type="text" name="hostname" value="$ machine.nics[0].hostname"/>.servers.csail.mit.edu</td></tr>82 <tr><td>Hostname:</td><td><input type="text" name="hostname" value="$defaults.hostname"/>.servers.csail.mit.edu</td></tr> 70 83 #end if 84 $errorRow('hostname', $err) 71 85 #if not $on 72 <tr><td>Machine Name:</td><td><input type="text" name="name" value="$machine.name"/></td></tr> 73 <tr><td>Ram:</td><td><input type="text" size=3 name="memory" value="$machine.memory"/>MB (max $max_mem)</td></tr> 74 <tr><td>Disk:</td><td><input type="text" size=3 name="disk" value="${machine.disks[0].size/1024.}"/>GB (max $max_disk)</td><td>WARNING: Modifying disk size may corrupt your data.</td></tr> 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) 75 96 #end if 76 97 <tr><td><input type="submit" class="button" name="action" value="Change"/></td></tr> 77 98 </table> 78 99 </form> 100 #end def 79 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> 80 116 #end def
Note: See TracChangeset
for help on using the changeset viewer.