-#def cdromList($cdroms, $default="")
-<select name="cdrom" id="cdromlist">
+#def databaseList($lst, $default, $onchange, $name, $id, $valueattr, $descattr)
+<select name="$name" id="$id"#slurp
+#if $onchange is not None
+onchange="$onchange"#slurp
+#end if
+>
<option #slurp
#if $default then '' else 'selected'
value="">None</option>
- #for $cdrom in $cdroms
+ #for $item in $lst
<option #slurp
-#if $default == $cdrom.cdrom_id then 'selected' else ''
- value="$cdrom.cdrom_id">
- $cdrom.description
+#if $default == getattr(item, valueattr) then 'selected' else ''
+ value="${getattr(item, valueattr)}">
+ ${getattr(item, descattr)}
</option>
#end for
</select>
#end def
+#def cdromList($default="", $onchange=None)
+$databaseList(sorted($sipb_xen_database.CDROM.select(), key=lambda x: x.description),
+ default, onchange, 'cdrom', 'cdromlist', 'cdrom_id', 'description')
+#end def
+
+#def autoList($default="", $onchange=None)
+$databaseList(sorted($sipb_xen_database.Autoinstall.select(), key=lambda x: x.description),
+ default, onchange, 'autoinstall', 'autoinstalllist', 'autoinstall_id', 'description')
+## $databaseList(autos, default, onchange, 'autoinstall', 'autoinstalllist', 'autoinstall_id', 'description')
+#end def
+
+#def vmTypeList($default=None)
+#for $vmtype in sorted($sipb_xen_database.Type.select(), key=lambda x: x.description)
+<label>
+ <input #slurp
+#if $default == $vmtype then 'checked' else ''
+ type="radio" name="vmtype" value="${vmtype.type_id}">${vmtype.description}</input>
+</label>
+#end for
+#end def
+
#def addError(txt)
#if $varExists('txt')
#set global $error_text = $error_text + '----\n' + $txt