Changeset 443 for trunk/packages/sipb-xen-www/code
- Timestamp:
- Apr 21, 2008, 10:50:54 PM (17 years ago)
- Location:
- trunk/packages/sipb-xen-www/code
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-www/code/main.py
r440 r443 38 38 from Cheetah.Template import Template 39 39 import sipb_xen_database 40 from sipb_xen_database import Machine, CDROM, ctx, connect, MachineAccess, Type 40 from sipb_xen_database import Machine, CDROM, ctx, connect, MachineAccess, Type, Autoinstall 41 41 import validation 42 42 from webcommon import InvalidInput, CodeError, g … … 99 99 disk = 4.0 100 100 cdrom = '' 101 autoinstall = '' 101 102 name = '' 102 103 def __init__(self, max_memory=None, max_disk=None, **kws): … … 222 223 machines=machines, 223 224 has_vnc=has_vnc, 224 uptimes=g.uptimes, 225 cdroms=CDROM.select()) 225 uptimes=g.uptimes) 226 226 return d 227 227 … … 572 572 checkpoint.checkpoint('Got defaults') 573 573 d = dict(user=user, 574 cdroms=CDROM.select(),575 574 on=status is not None, 576 575 machine=machine, -
trunk/packages/sipb-xen-www/code/templates/functions.tmpl
r441 r443 1 #def cdromList($cdroms, $default="") 2 <select name="cdrom" id="cdromlist"> 1 #def databaseList($lst, $default, $onchange, $name, $id, $valueattr, $descattr) 2 <select name="$name" id="$id"#slurp 3 #if $onchange is not None 4 onchange="$onchange"#slurp 5 #end if 6 > 3 7 <option #slurp 4 8 #if $default then '' else 'selected' 5 9 value="">None</option> 6 #for $ cdrom in $cdroms10 #for $item in $lst 7 11 <option #slurp 8 #if $default == $cdrom.cdrom_idthen 'selected' else ''9 value="$ cdrom.cdrom_id">10 $ cdrom.description12 #if $default == getattr(item, valueattr) then 'selected' else '' 13 value="${getattr(item, valueattr)}"> 14 ${getattr(item, descattr)} 11 15 </option> 12 16 #end for 13 17 </select> 18 #end def 19 20 #def cdromList($default="", $onchange=None) 21 $databaseList(sorted($sipb_xen_database.CDROM.select(), key=lambda x: x.description), 22 default, onchange, 'cdrom', 'cdromlist', 'cdrom_id', 'description') 23 #end def 24 25 #def autoList($default="", $onchange=None) 26 $databaseList(sorted($sipb_xen_database.Autoinstall.select(), key=lambda x: x.description), 27 default, onchange, 'autoinstall', 'autoinstalllist', 'autoinstall_id', 'description') 28 ## $databaseList(autos, default, onchange, 'autoinstall', 'autoinstalllist', 'autoinstall_id', 'description') 14 29 #end def 15 30 -
trunk/packages/sipb-xen-www/code/templates/info.tmpl
r440 r443 41 41 #end if 42 42 <td>Boot CD:</td> 43 <td>$cdromList( $cdroms)</td>43 <td>$cdromList()</td> 44 44 </tr> 45 45 <tr> -
trunk/packages/sipb-xen-www/code/templates/list.tmpl
r440 r443 42 42 $errorRow('vmtype', $err) 43 43 <tr> 44 <td>Autoinstall$helppopup('autoinstall')</td> 45 <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto">$autoList($defaults.cdrom, "document.getElementById('cd_or_auto_auto').checked = true;document.getElementById('cdromlist').value = ''") 46 (experimental; 1-2 minutes, and you have a machine; root pw is 'password'.) 47 </input> 48 </tr> 49 <tr> 44 50 <td>Boot CD</td> 45 <td>$cdromList($cdroms, $defaults.cdrom)</td> 51 <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked>$cdromList($defaults.cdrom, "document.getElementById('cd_or_auto_cd').checked = true;document.getElementById('autoinstalllist').value = ''")</td> 52 </input> 46 53 </tr> 47 54 $errorRow('cdrom', $err) 48 <tr>49 <td>Clone image?</td>50 <td><input type="checkbox" name="clone_from" id="clone_from" value="ice3" onchange="onclone(event)"/>51 (experimental; 1-2 minutes, and you have an etch machine; root pw is 'password'.)52 <script type='text/javascript'>function onclone(e){ document.getElementById('cdromlist').value = ''; }</script></td>53 </tr>54 55 $errorRow('cdrom', $err) 55 56 <tr>
Note: See TracChangeset
for help on using the changeset viewer.