📄 editdbtemplate.tmpl
字号:
#encoding UTF-8## $Id: editdbTemplate.tmpl 3816 2007-01-22 16:02:50Z jodal $#### Copyright 2003, 2004 Norwegian University of Science and Technology#### This file is part of Network Administration Visualized (NAV)#### NAV is free software; you can redistribute it and/or modify## it under the terms of the GNU General Public License as published by## the Free Software Foundation; either version 2 of the License, or## (at your option) any later version.#### NAV is distributed in the hope that it will be useful,## but WITHOUT ANY WARRANTY; without even the implied warranty of## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the## GNU General Public License for more details.#### You should have received a copy of the GNU General Public License## along with NAV; if not, write to the Free Software## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA###### Author: Hans J鴕gen Hoel <hansjorg@orakel.ntnu.no>###extends nav.web.templates.MainTemplate#from nav.web.templates.selectTreeTemplate import selectTreeTemplate#def additionalCSS<link rel="stylesheet" type="text/css" href="/style/editdbTemplate.css" />$default_form_CSS()#end def#block additionalJavaScript<script type="text/javascript" src="/js/editdbTemplate.js"></script>#end block additionalJavaScript#def content#if $entryList$showSelectList($entryList)#elif $editList$showList($editList)#elif $editForm$showForm($editForm)#else$showBody($body)#end if#end def## function showSelectList#### Function for displaying a list in a table with optional## radiobuttons or checkboxes for selecting rows#### $selectList## ++-- title :: list title## ++-- formMethod :: method for form, post or get## ++-- formAction :: action for form## ++-- selectCname :: controlname for radiob./checkbox## ++-- status :: editdb.status object## ++-- buttonsTop :: list of buttons for top of list## +-- (cname,value) :: tuple of control name and value (text)## ++-- buttonsBottom :: list of buttons for bottom of list## +-- (cname,value) :: tuple of control name and value (text)## ++-- headings :: list of heading cells (cell objects)## +-- text :: heading text## +-- url :: heading link (optional)## ++-- rows :: array of rows## +-- (id,cells) :: tuple (id, list of cells)## +-- text :: cell text## +-- url :: link for this cell## +-- checkbox :: boolean, show a checkbox in this cell## +-- radiobutton :: boolean, show a radiobuttion## +-- image :: path to an image (optional)## +-- tooltip :: list of tooltip strings (optional) ###def $showSelectList($selectList) <h3>$selectList.title</h3>#if $selectList.body <p>$selectList.body</p>#end if#if $selectList.status $showStatus($selectList.status)#end if## Filters#if $selectList.filters $renderFilters($selectList)#end if <form method="$selectList.formMethod" action="$selectList.formAction">## Top buttons#if $selectList.buttonsTop <p>#for $cname,$value in $selectList.buttonsTop <input type="submit" name="$cname" value="$value" />#end for </p>#end if <table border="0" cellspacing="0" cellpadding="0">## Show headings <tr class="header"> <td class="startheader"></td>#for $cell in $selectList.headings <td valign="top">#if $cell.url <a href="$cell.url">$cell.text</a> #else $cell.text #end if#if $cell.tooltip <span>#for $line in $cell.tooltip $line<br />#end for </span>#end if </td>#end for <td class="endheader"></td> </tr>## Rows#set $oddRow = True#for $fullrow in $selectList.rows## $fullrow[0] is sortKey#set $id = $fullrow[1][0]#set $row = $fullrow[1][1]## Set rowstyle#if $oddRow#set $rowstyle = 'oddrow'#set $oddRow = False#else#set $rowstyle = 'evenrow'#set $oddRow = True#end if <tr class="$rowstyle">## Cells in a row <td> </td>#for $cell in $row <td>#if $cell.url <a href="$cell.url">#elif $cell.tooltip <a title="" class="info" href="#$id">#end if#if $cell.image <img src="$cell.image">#end if#if $cell.text#set $first = True#for $line in $cell.text#if not $first <br />#end if#set $first = False $line#end for#end if#if $cell.tooltip <span>#set $first = True#for $line in $cell.tooltip#if not $first <br />#end if#set $first = False $line#end for </span>#end if#if $cell.buttonType == 'chk' <input type="checkbox" name="$selectList.selectCname" value="$id" />#elif $cell.buttonType == 'rad' <input type="radio" name="$selectList.selectCname" value="$id" />#elif $cell.buttonType == 'hid' <input type="hidden" name="$selectList.selectCname" value="$id" />#end if#if $cell.url or $cell.tooltip </a>#end if </td>#end for <td> </td> </tr>#end for </table>## Bottom buttons#if $selectList.buttonsBottom <p>#for $cname,$value in $selectList.buttonsBottom <input type="submit" name="$cname" value="$value" />#end for </p>#end if </form>#end def## function renderFilters#### Function for displaying list filters###def renderFilters($slist)<form method="$slist.formMethod" action="$slist.filterAction"> <table class="header-active">#set $filters = $slist.filters#for $listFilter in $filters <tr> <td>${listFilter[0]}</td> <td> <select name="${listFilter[5]}">##raise repr($listFilter)#for $option in $listFilter[9]#if $option[0][0] == $listFilter[10]: <option value="$option[0][0]" selected>$option[1][0]</option>#else <option value="$option[0][0]">$option[1][0]</option>#end if#end for </select> </td> </tr>#end for <tr> <td colspan="2" align="right"><input type="submit" name="$slist.filterConfirm" value="$slist.filterConfirmText" /></td> </tr> </table></form>#end def## function showStatus#### Function for displaying status and error messages## takes an editdb.status object as parameter#### $status## +-- messages :: list of message strings## +-- errors :: list of error strings###def $showStatus($status) <p class="status">#for $message in $status.messages $message<br />#end for </p> <p class="error">#for $error in $status.errors $error<br />#end for </p>#end def## Form to show a body object## ie. display the editdb main menu#def $showBody($body) <h2>$body.title</h2>#if $body.status $showStatus($body.status)#end if <p class="infotext">$body.infotext</p> <p>#if not $body.showHelp <a href="$body.help[0]">$body.help[1]</a>#else <a href="$body.nohelp[0]">$body.nohelp[1]</a>#end if </p>#for $table in $body.tables <h3>$table.title</h3>#if $table.infotext <p>$table.infotext</p>#end if#if $body.showHelp <table style="width: 80%;">#else <table style="width: 40%;">#end if#if $table.headings <tr>#for $heading in $table.headings <th>$heading</th>#end for </tr>#end if#set odd = False#for $row in $table.rows#if odd == True#set style = "oddrow"#set odd = False#else#set style = "evenrow"#set odd = True#end if#if $body.showHelp#set $rowstyle=['width: 10%;','width: 60%;','','','']#else#set $rowstyle=['width: 40%;','','width: 15%;','width: 15%;','width: 30%;']#end if <tr class="$style" title="$row[1]"> <td style="$rowstyle[0]">$row[0]</td>#if $body.showHelp <td style="$rowstyle[1]">$row[1]</td>#end if#if $row[2]## Add <td style="$rowstyle[2]"><a href="$row[2][0]">$row[2][1]</a></td>#else <td> </td>#end if <td style="$rowstyle[3]"><a href="$row[3][0]">$row[3][1]</a></td>#if $row[4]## Bulk import <td style="$rowstyle[4]"><a href="$row[4][0]">$row[4][1]</a></td>#else <td> </td>#end if </tr>#end for </table>#end for#end def## Function to display a list for selecting## which entries to edit, or delete#def showList($list) <h3>$list.title</h3>#if $list.status <p class="status">#for $message in $list.status.messages $message<br />#end for </p> <p class="error">#for $error in $list.status.errors $error<br />#end for </p>#end if#if $list.isBulkList## Show bulk preview legend <p> Legend </p> <p> <img src="$list.imgGreen"> $list.legendGreen<br /> <img src="$list.imgRed"> $list.legendRed<br /> <img src="$list.imgYellow"> $list.legendYellow<br /> </p>#end if <form method="$list.method" action="$list.action">#if $list.hiddenIdValue <input type="hidden" name="$list.cnameHiddenId" value="$list.hiddenIdValue" />#end if#if not $list.isDeleteList $actionBar($list)#end if <table border="0" cellspacing="0" cellpadding="0"> <tr class="header"> <td bgcolor="white" style="background-image:url('/images/ragen/navbar-start.gif'); background-repeat: no-repeat; width: 14px">#for $heading in $list.headings <td valign="top">$heading </td>#end for <td bgcolor="white" style="background-image:url('/images/ragen/navbar-end.gif'); background-position: top right; background-repeat: no-repeat; width: 14px;"> </tr>#set $odd = True#for $id,$row in $list.rows#if $odd#set $rowtype = 'oddrow'#set $odd = False#else#set $rowtype = 'evenrow'#set $odd = True#end if <tr class="$rowtype"> <td> </td> ## first column is start gfx (fix)#if not ($list.isDeleteList or $list.isBulkList) <td><input type="checkbox" name="$list.cnameChk" value="$id" align="center" /> </td>#elif $list.isDeleteList <input type="hidden" name="$list.cnameChk" value="$id" />
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -