📄 statustemplate.tmpl
字号:
#encoding UTF-8## $Id: StatusTemplate.tmpl 3851 2007-01-31 12:51:03Z jodal $## Contains functions for displaying status sections## and for displaying the status preference page#### 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###### Authors: Hans J鴕gen Hoel <hansjorg@orakel.ntnu.no>###extends nav.web.templates.MainTemplate#def content#if $prefs<h2>Status page preferences</h2>$displayPrefs($prefs)#end if#if $status<h2>$status.title</h2><table>#for $SectionBox in $status.sections $displaySectionBox($SectionBox)#end for</table>#end if#if $history<h2>$history.title</h2>$displayStatusAction($history)$displaySectionBoxes($history)#end if#end def#def additionalCSS<style type="text/css">td.down {background: #eee}td.shadow {background: #f85}th.sortedBy {background: #8aa}th.sortedBy#ascending:after {content: url("/images/pilned.png")}th.sortedBy#descending:after {content: url("/images/pilopp.png")}tr.title { vertical-align: baseline; font-size: 15; background-color: #ddddff;}</style>$default_table_CSS()$default_form_CSS()#end def## This function show the select bar (type=boxes|services|?,days=1-?)#def displayStatusAction($bar) <form action="$bar.action" method="$bar.method">#if $bar.selid <input type="hidden" name="$bar.typeCname" value="$bar.seltype">#end if <p> $bar.typeText## Only show the type select if no special box is selected#if not $bar.selid <select name="$bar.typeCname" onchange="$bar.onChange">#for $value,$option in $bar.typeOptions#if $value == $bar.typeValue <option selected value="$value">$option</option>#else <option value="$value">$option</option>#end if#end for </select>#end if $bar.daysText <select name="$bar.daysCname" onchange="$bar.onChange">#for $value,$option in $bar.daysOptions#if $value == $bar.daysValue <option selected value="$value">$option</option>#else <option value="$value">$option</option>#end if#end for </select> </p> ## Preserve the id when it is specified#if $bar.selid <input type="hidden" name="$bar.idCname" value="$bar.selid">#end if <form>#end def## Function for displaying all the sections on a page## Used by the history page to display all rows from all sections## in one table (can do this since the number of columns is## equal for all sections)#def displaySectionBoxes($page)<table> #for $section in $page.sections $listSectionRows($section) #end for</table>#end def## This renders the rows in a sectionbox#def listSectionRows($SectionBox)<tr><td><table class="horiztable" style="width: 100%;"> <caption id="$SectionBox.controlBaseName"> <span class="cornerkludge"></span> $SectionBox.title </caption> <tr class="header"> <td class="leftkludge"></td>#for $heading, $url, $style, $id in $SectionBox.headings#if $url <th><a href="$url.replace('&', '&')">$heading</a></th>#else <th>$heading</th>#end if#end for <td class="rightkludge"></td> </tr>#for $row in $SectionBox.rows <tr class="$rowcycler"> <td style="background: white;"></td>## $row[0] is sort data#set $row = row[1]#for $data, $url, $image, $style in $row <td class="$style">#if $url <a href="$url.replace('&', '&')">#end if#if $image <img border="0" title="$image[1]" src="$image[0]" />#end if $data#if $url </a>#end if </td>#end for <td style="background: white;"></td> </tr>#end for</table></td></tr>#end def## This renders each sectionbox#def displaySectionBox($SectionBox)#set $colscount = len($SectionBox.headings)<tr><td><table id="$SectionBox.controlBaseName" class="horiztable" style="width: 100%;"> <caption> <span class="cornerkludge"></span> $SectionBox.title #for $url, $text in $SectionBox.historyLink (<a href="$url.replace('&', '&')">$text</a>) #end for <br /> <span class="subtitle">$SectionBox.summary</span> </caption> <tr class="header"> <td class="leftkludge"></td>#for $heading, $url, $style, $id in $SectionBox.headings#if $url <th><a href="$url.replace('&', '&')">$heading</a></th>#else <th>$heading</th>#end if#end for <td class="rightkludge"></td> </tr>#for $row in $SectionBox.rows## $row[0] is data for sorting#set $row = $row[1] <tr class="$rowcycler"> <td style="background: white;"></td>#for $col in $row#set $data = $col[0]#set $url = $col[1]#set $image = $col[2]#set $style = $col[3] <td class="$style">#if $url <a href="$url.replace('&', '&')">#end if#if $image <img title="$image[1]" alt="$image[1]" src="$image[0]" />#end if $data#if $url </a>#end if </td>#end for <td style="background: white;"></td> </tr>#end for</table></td></tr>#end def## This renders the preferences page#def displayPrefs($prefsPage)## move this from template to StatusPrefs.py<p>Add, delete or rearrange sections on your status page.</p><form action="$prefsPage.formAction" method="post"><table class="header-inactive"><tr><th style="width: 10px;"> </th><th>Name</th><th>Filter</th></tr>#for $editSection in $prefsPage.editSectionBoxes$displayEditSectionBox($editSection,$prefsPage.radioButtonName)#end for## action bar<tr><td colspan="3"><input type="submit" name="$prefsPage.actionBarUpName" value="Move selected section up"><input type="submit" name="$prefsPage.actionBarDelName" value="Delete selected section"></td></tr></table>## addbar <p> <h3>Add new section</h3> <table> <tr> <td>$prefsPage.addBarTitle</td> <td> <SELECT name="$prefsPage.addBarSelectName">#for $value,$text in $prefsPage.addBarSelectOptions <OPTION value="$value">$text</OPTION>#end for </SELECT> </td> <td><input type="submit" name="$prefsPage.addBarSubmitName" value="Add"></td> </tr> <tr> <td colspan="3"> <input type="submit" name="$prefsPage.addBarSaveName" value="Save"> </td> </tr> </table> </p>#if $prefsPage.isAdmin <p> <h3>$prefsPage.adminHeader</h3> <p>$prefsPage.adminHelp</p> <p> <input type="submit" name="$prefsPage.addBarSaveDefName" value="$prefsPage.adminButton"> </p>#end if</form>#end def#def displayEditSectionBox($editSectionBox,$radioButtonName)<tr><td class=header-active><input type="radio" name="$radioButtonName" value="$editSectionBox.controlBaseName"></td><td class=header-active>$editSectionBox.name<br><input type="text" value="$editSectionBox.title" name="$editSectionBox.controlBaseName"></td><td class=header-active><table class=header-active cellpadding=5%><tr>#for $heading in $editSectionBox.filterHeadings<th>$heading</th>#end for</tr><tr>#for $select in $editSectionBox.filterSelects<td align="center"> #set $control = $select[0]#set $selects = $select[1]<select size=4 multiple name="$control">#for $value,$option,$selected in $selects#if $selected<option value="$value" selected>$option</option>#else<option value="$value">$option</option>#end if#end for</select></td>#end for</tr></table></td></tr>#end def
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -