📄 editdbtemplate.tmpl
字号:
<th>$heading($fields['opt2'])</th> <th>$heading($fields['opt3'])</th> </tr> <tr> <td>$input($fields['opt1'])</td> <td>$input($fields['opt2'])</td> <td>$input($fields['opt3'])</td> </tr> </table>#end def## Form for adding or editing a type#def typebox($editbox)#set $fields = $editbox.fields <table class="header-active" width="60%"> <tr> <th colspan="3" width="30%">$heading($fields['typename'])</th> <th>$heading($fields['descr'])</th> </tr> <tr> <td colspan="3">$input($fields['typename'],'width: 100%;')</td> <td>$input($fields['descr'],'width: 100%;')</td> <tr> <th colspan="3">$heading($fields['vendorid'])</th> <th>$heading($fields['sysobjectid'])</th> </tr> <td colspan="3">$input($fields['vendorid'],'width: 100%;')</td> <td>$input($fields['sysobjectid'],'width: 100%')</td> </tr> <tr> <th>$heading($fields['cdp'])</th> <th>$heading($fields['tftp'])</th> <th>$heading($fields['frequency'])</th> <td> </td> </tr> <tr> <td align="center">$input($fields['cdp'])</td> <td align="center">$input($fields['tftp'])</td> <td>$input($fields['frequency'])</td> <td> </td> </tr></table>#end def## Form for adding or editing a product#def product($editbox)#set $fields = $editbox.fields#if $fields.has_key('productid')$input($fields['productid'])#end if <table class="header-active"> <tr> <th>$heading($fields['vendorid'])</th> <th>$heading($fields['productno'])</th> </tr> <tr> <td>$input($fields['vendorid'])</td> <td>$input($fields['productno'])</td> </tr> <tr> <th colspan="2">$heading($fields['descr'])</th> </tr> <tr> <td colspan="2">$input($fields['descr'],'width: 100%;')</td> </tr> </table>#end def## Form for adding or editing a container#def container($editbox)#set $fields = $editbox.fields <table class="header-active"> <tr> <th>$heading($fields['name'])</th> </tr> <tr> <td>$input($fields['name'])</td> </tr> </table>#end def## Form for adding or editing routers in containers#def ric($editbox)#set $fields = $editbox.fields <table class="header-active"> <tr> <th>$heading($fields['container'])</th> <th>$heading($fields['routers'])</th> </tr> <tr> <td>$input($fields['container'])</td> <td>$input($fields['routers'])</td> </tr> </table>#end def## Form for adding or editing a vendor#def vendor($editbox)#set $fields = $editbox.fields <table class="header-active"> <tr> <th>$heading($fields['vendorid'])</th> </tr> <tr> <td>$input($fields['vendorid'])</td> </tr> </table>#end def## Form for adding or editing a user category#def usage($editbox)#set $fields = $editbox.fields <table class="header-active"> <tr> <th>$heading($fields['usageid'])</th> <th>$heading($fields['descr'])</th> </tr> <tr> <td>$input($fields['usageid'])</td> <td>$input($fields['descr'])</td> </tr> </table>#end def## Form for adding or editing a service#def service($editbox)#set $fields = $editbox.fields <p>$editbox.help</p> <table class="header-active"> <tr> <th>$heading($fields['boxid'])</th> <th>$heading($fields['handler'])</th> </tr> <tr> <td>$input($fields['boxid'])</td> <td>$input($fields['handler'])</td> </tr> </table> $input($fields['properties'])$hiddenfields($editbox.hiddenFields)#end def## Form for editing serviceproperties (called by input())#def serviceproperty($property)#set $args = $property.args#set $optargs = $property.optargs#if $property.display#set $style = ''#else#set $style = 'display:none;'#end if <div id="$property.id" style="$style"> <p>$property.title</p> <table class="header-active">#if len($property.args) <tr> <th colspan="2">Required</th> </tr>#for $field,$content in $args.items() <tr> <td>$field <span style="color: #ff0000">*</span></td> <td>$input($args[$field])</td> </tr>#end for#end if#if len($property.optargs) <tr> <th colspan="2">Optional</th> </tr>#for $field,$content in $optargs.items() <tr> <td>$field</td> <td>$input($optargs[$field])</td> </tr>#end for#end if </table> </DIV>#end def## Form for prefix editing#def prefix($editbox)#set $fields = $editbox.fields <table class="header-active"> <tr> <th colspan="2">$heading($fields['netaddr'])</th> <th>$heading($fields['vlan.description'])</th> </tr> <tr> <td colspan="2">$input($fields['netaddr'])</td> <td>$input($fields['vlan.description'],style='width: 100%;')</td> </tr> <tr> <th colspan="2">$heading($fields['vlan.netident'])</th> <th>$heading($fields['vlan.orgid'])</th> </tr> <tr> <td colspan="2">$input($fields['vlan.netident'])</td> <td>$input($fields['vlan.orgid'])</td> </tr> <tr> <th>$heading($fields['vlan.nettype'])</th> <th>$heading($fields['vlan.vlan'])</th> <th>$heading($fields['vlan.usageid'])</th> </tr> <tr> <td>$input($fields['vlan.nettype'])</td> <td>$input($fields['vlan.vlan'])</td> <td>$input($fields['vlan.usageid'],style='width: 100%')</td> </tr> </table>#end def## Form for vlan editing#def $vlan($editbox)#set $fields = $editbox.fields <table class="header-active"> <tr> <th colspan="2">$heading($fields['netident'])</th> <th>$heading($fields['orgid'])</th> </tr> <tr> <td colspan="2">$input($fields['netident'])</td> <td>$input($fields['orgid'])</td> </tr> <tr> <th>$heading($fields['nettype'])</th> <th>$heading($fields['vlan'])</th> <th>$heading($fields['usageid'])</th> </tr> <tr> <td>$input($fields['nettype'])</td> <td>$input($fields['vlan'])</td> <td>$input($fields['usageid'],style='width: 100%')</td> </tr> <tr> <th colspan="3">$heading($fields['description'])</th> </tr> <tr> <td colspan="3">$input($fields['description'],style='width: 100%;')</td> </tr> </table>#end def## Form for adding or editing a subcategory#def subcat($editbox)#set $fields = $editbox.fields <table class="header-active"> <tr> <th>$heading($fields['subcatid'])</th> <th colspan="2">$heading($fields['catid'])</th> </tr> <tr> <td>$input($fields['subcatid'])</td> <td colspan="2">$input($fields['catid'])</td> </tr> <tr> <th colspan="3">$heading($fields['descr'])</th> </tr> <tr> <td colspan="3">$input($fields['descr'],'width: 100%;')</td> </tr> </table>#end def## Form for showing a message and adding hidden controls#def hiddenormessage($editbox)<p>$editbox.message</p><!-- def hiddenormessage -->$hiddenfields($editbox.hiddenFields)#end def## Form for bulk import#def bulk($editbox)#set $fields = $editbox.fields <p>$editbox.help</p> <table class="header-active"> <tr> <th align="left">Import</th> <td>$input($fields['table'],'width: 60%;')</td> </tr> <tr> <th align="left">Separator</th> <td>$input($fields['separator'],'width: 60%;')</td> </tr> <tr> <th align="left">Import from file</th> <td>$input($fields['file'],'width: 60%;')</td> </tr> <tr> <th align="left">Import from text</th> <td>$input($fields['textarea'])</td> </tr> </table>#end def## Form to write out all hidden input fields#def hiddenfields($fieldlist)#for $field in $fieldlist.values()$input($field)#end for#end def## Displays headings in forms, marks required fields#def heading($control)## REQ_TRUE = 1 (from editdb.py header)#if $control[1] == 1$control[2] <span style="color: #ff0000">*</span>#else$control[2]#end if#end def## Form to display all input fields#def input($control,$style='')#if $control[0].disabled#set $disabled = 'disabled'#else#set $disabled = ''#end if#set $control = $control[0]#if $control.type == 'text'#if $control.maxlength<input $disabled type="text" style="$style" size="$control.size" maxlength="$control.maxlength" name="$control.name" value="$control.value" />#else<input $disabled type="text" style="$style" size="$control.size" name="$control.name" value="$control.value" />#end if#elif $control.type == 'select'<select $disabled name="$control.name" style="$style" $control.attribs>#for $id,$option in $control.options#if $id == $control.value <option value="$id" selected>$option</option>#else <option value="$id">$option</option>#end if#end for</select>#elif $control.type == 'multipleselect'<select multiple name="$control.name" style="$style">#for $id,$option in $control.options#if $control.value.count($id) <option value="$id" selected>$option</option>#else <option value="$id">$option</option>#end if#end for</select>#elif $control.type == 'file' <input type="file" style="$style" name="$control.name" value="$control.value" />#elif $control.type == 'textarea' <textarea name="$control.name" style="$style" rows="$control.rows" cols="$control.cols">$control.value</textarea>#elif $control.type == 'checkbox'#if $control.value == '1'## VALUE is hardcoded to 1, which is good for boolean fields in the db <input type="checkbox" style="$style" name="$control.name" value="1" checked />#else <input type="checkbox" style="$style" name="$control.name" value="1" />#end if#elif $control.type == 'hidden' <input type="hidden" name="$control.name" value="$control.value" />#elif $control.type == 'treeselect'#set $ts = selectTreeTemplate()#if $control.treeselect $ts.renderLayoutBox($control.treeselect)#end if#elif $control.type == 'serviceproperties'#for $property in $control.propertyList $serviceproperty($property)#end for#elseUndefined control#end if#end def
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -