Ignore:
Timestamp:
Apr 21, 2008, 10:50:54 PM (17 years ago)
Author:
ecprice
Message:

Support autoinstalls table for creation list.

Location:
trunk/packages/sipb-xen-www/code
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-www/code/main.py

    r440 r443  
    3838from Cheetah.Template import Template
    3939import sipb_xen_database
    40 from sipb_xen_database import Machine, CDROM, ctx, connect, MachineAccess, Type
     40from sipb_xen_database import Machine, CDROM, ctx, connect, MachineAccess, Type, Autoinstall
    4141import validation
    4242from webcommon import InvalidInput, CodeError, g
     
    9999    disk = 4.0
    100100    cdrom = ''
     101    autoinstall = ''
    101102    name = ''
    102103    def __init__(self, max_memory=None, max_disk=None, **kws):
     
    222223             machines=machines,
    223224             has_vnc=has_vnc,
    224              uptimes=g.uptimes,
    225              cdroms=CDROM.select())
     225             uptimes=g.uptimes)
    226226    return d
    227227
     
    572572    checkpoint.checkpoint('Got defaults')
    573573    d = dict(user=user,
    574              cdroms=CDROM.select(),
    575574             on=status is not None,
    576575             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
     4onchange="$onchange"#slurp
     5#end if
     6>
    37  <option #slurp
    48#if $default then '' else 'selected'
    59 value="">None</option>
    6   #for $cdrom in $cdroms
     10  #for $item in $lst
    711  <option #slurp
    8 #if $default == $cdrom.cdrom_id then 'selected' else ''
    9  value="$cdrom.cdrom_id">
    10     $cdrom.description
     12#if $default == getattr(item, valueattr) then 'selected' else ''
     13 value="${getattr(item, valueattr)}">
     14    ${getattr(item, descattr)}
    1115  </option>
    1216  #end for
    1317</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')
    1429#end def
    1530
  • trunk/packages/sipb-xen-www/code/templates/info.tmpl

    r440 r443  
    4141        #end if
    4242      <td>Boot CD:</td>
    43       <td>$cdromList($cdroms)</td>
     43      <td>$cdromList()</td>
    4444  </tr>
    4545    <tr>
  • trunk/packages/sipb-xen-www/code/templates/list.tmpl

    r440 r443  
    4242$errorRow('vmtype', $err)
    4343        <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>
    4450          <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>
    4653        </tr>
    4754$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>
    5455$errorRow('cdrom', $err)
    5556        <tr>
Note: See TracChangeset for help on using the changeset viewer.