1 <%page expression_filter="h"/>
2 <%def name="databaseList(lst, default, onchange, name, id, valueattr, descattr)">
3 <select name="${name}" id="${id}" \
5 onchange="${onchange}"\
8 <option ${'' if default else 'selected'} value="">None</option>
10 <option ${'selected' if default == getattr(item, valueattr) else ''} value="${getattr(item, valueattr)}">
11 ${getattr(item, descattr)}
17 <%def name="cdromList(default='', onchange=None)">
18 ${databaseList(sorted(database.CDROM.query(), key=lambda x: x.description),
19 default, onchange, 'cdrom', 'cdromlist', 'cdrom_id', 'description')|n}
22 <%def name="autoList(default='', onchange=None)">
23 ${databaseList(sorted(database.Autoinstall.query(), key=lambda x: x.description),
24 default, onchange, 'autoinstall', 'autoinstalllist', 'autoinstall_id', 'description')|n}
27 <%def name="vmTypeList(default=None)">
28 % for vmtype in (('linux-hvm', 'HVM'), ('linux', 'ParaVM'), ):
30 <input ${'checked="checked"' if default == vmtype[0] else '' | n} type="radio" name="vmtype" id="vmtype-${vmtype[0]}" value="${vmtype[0]}" />${vmtype[1]}
35 <%def name="errorRow(value, err)">
36 % if err and err.err_field == value:
38 <td class="error" colspan="2">${str(err)}</td>
45 return "'" + string.replace('\\', '\\\\').replace("'", "\\'").replace('\n', '\\n') + "'"
48 return string.replace('\n', '<br/>')
51 <%def name="helppopup(subj)">
52 ## Return HTML code for a (?) link to a specified help topic
53 <span class="helplink"><a href="help?simple=true;subject=${subj | u}" target="_blank" onclick="return helppopup(${subj | jquote})">(?)</a></span>