⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reporttemplate.tmpl

📁 Network Administration Visualized 网络管理可视化源码
💻 TMPL
字号:
#encoding UTF-8## $Id: ReportTemplate.tmpl 3809 2007-01-19 14:16:23Z jodal $##  ## Copyright 2003-2005 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: Magnar Sveen <magnars@idi.ntnu.no>###### Extends the MainTemplate for header-information, nav-logo and navigation-bar.## Builds html for the Report Generator with data in this form:#### $report##   +-- header                        :: name of the report##   +-- navigator##   |    +-- previous                 :: uri to previous page (optional)##   |    +-- view                     :: info about current page##   |    +-- next                     :: uri to next page (optional)##   +-- table##        +-- header##        |    +-- cells               :: array of cells##        |         +-- uri            :: link (optional)##        |         +-- text           :: name of the column##        |         +-- explanation    :: description of data in the column (optional)##        +-- rows##        |    +-- cells               :: array of cells##        |         +-- uri            :: link (optional)##        |         +-- text           :: the bread and butter of the table##        +-- footer##             +-- cells               :: array of cells##                  +-- sum            :: sum of values in the column (optional)#### The template uses images in $imagefolder/ragen/, where $imagefolder## is inherited from MainTemplate and defaults to "/images".#### This template can easily be used for other tables, as long as the indata is## structured in the same way. To change the watermark-logo, change the $logo attribute.## To illustrate:####   import ReportTemplate from foo.bar.ReportTemplate##   page = ReportTemplate()##   page.report = fillReportWithData()##   page.logo = "/foo/bar.gif"###extends MainTemplate#block additionalCSS$default_table_CSS()#end block additionalCSS#block additionalJavaScript<script type="text/javascript" src="/js/table.js"></script>#end block additionalJavaScript#block content#if $search>0<a href="${old_uri}adv=">Close Search</a><h2>Advanced Search</h2><form action="" method="get"><div style="float:right">The operators are used like this<ul><li>= : "equals" (enter null for empty string)</li><li>~ : "case insensitive search (* wildcards)"</li><li>[:] : "between", takes two colon-separated arguments</li><li>(,,) : "is one of", takes a comma-separated list of any size as argument. </li></ul><p><,>,<= and >= needs no explanation. </p><p> All these operators may be negated by clicking the "not" checkbox.</p></div><table>#set $counter = 0#for $a in $report.form<tr><td><label for="adv${counter}">$a.title</label></td><td><input type="checkbox" name="not_${a.raw}" id="not_adv${counter}"#slurp#if $neg.has_key($a.raw) checked="1"#slurp#end if></td><td><label for="not_adv${counter}">not</label></td><td>#if $operator.has_key($a.raw)$selectoptiondraw("op_"+$a.raw, $operatorlist, $operators,$operator[$a.raw], $descriptions)#else$selectoptiondraw("op_"+$a.raw, $operatorlist, $operators,"", $descriptions)#end if</td><td><input type="text" name="$a.raw" id="adv${counter}"#slurp#if $contents.has_key($a.raw) value="$contents[$a.raw]"#slurp#end if></tr>#set $counter += 1#end for<tr><td></td><td></td><td><input type="hidden" name="adv" value="1"/></td><td><input type="submit" name="r4g3n53nd" value="Send"/></table></form>#else<p><a href="${old_uri}adv=1">Advanced Search</a></p>#end if## ----------------------------------------------------------------------- REPORT ---- ###if $report#set $rowcount = len($report.table.rows) + 1#set $columncount = len($report.table.header.cells)  <table class="horiztable">## --- TITLE ROW ---- ##    <caption>        <span class="cornerkludge"></span>#if $report.navigator.previous        <span class="previous">        <a title="previous page" href="$report.navigator.previous"            onmouseover="imgprev.src='$imagefolder/ragen/previous-active.gif';"            onmouseout="imgprev.src='$imagefolder/ragen/previous.gif';">        <img id="imgprev" src="$imagefolder/ragen/previous.gif"            alt="&lt;&lt; previous" /></a></span>#end if#if $report.navigator.next        <span class="next">        <a title="next page" href="$report.navigator.next"            onmouseover="imgnext.src='$imagefolder/ragen/next-active.gif';"            onmouseout="imgnext.src='$imagefolder/ragen/next.gif';">        <img id="imgnext" src="$imagefolder/ragen/next.gif"            alt="next &gt;&gt;" /></a></span>#end if        $report.header<br />        <span class="subtitle">$report.navigator.view</span>    </caption>## --- HEADER ROW ---- ##    <tr class="header">        <td class="leftkludge" rowspan="$rowcount"></td>#for $cell in $report.table.header.cells#if $cell.uri        <th><a class="navbar" href="$cell.uri" title="$cell.explanation">$cell.text</a></th>#else        <th><a class="navbar" title="$cell.explanation">$cell.text</a></th>#end if#end for        <td class="rightkludge" rowspan="$rowcount"></td>    </tr>## --- DATA ROWS ---- ###for $row in $report.table.rows    <tr class="$rowcycler">#for $cell in $row.cells        <td class="$cellcycler">#if $cell.uri            <a href="$cell.uri">$cell.text</a>#else            $cell.text#end if        </td>#end for    </tr>#end for## --- FOOTER ---- ###if $report.table.footer#set $cols = len($report.table.header.cells)    <tr class="tablesum">        <td></td>#for $cell in $report.table.footer.cells        <th>#if $cell.sum        $cell.sum#end if        </th>#end for        <td></td>    </tr>#end if## --- FOOTER NAVIGATION ---- ##    <tr class="footer">        <td class="leftkludge"></td>        <th colspan="$columncount">#if $report.navigator.previous            <span class="previous">            <a title="previous page" href="$report.navigator.previous"                onmouseover="imgprevb.src='$imagefolder/ragen/bottom-previous-active.gif';"                onmouseout="imgprevb.src='$imagefolder/ragen/bottom-previous.gif';">            <img id="imgprevb" src="$imagefolder/ragen/bottom-previous.gif"                alt="&lt;&lt; previous" /></a></span>#end if#if $report.navigator.next            <span class="next">            <a title="next page" href="$report.navigator.next"                onmouseover="imgnextb.src='$imagefolder/ragen/bottom-next-active.gif';"                onmouseout="imgnextb.src='$imagefolder/ragen/bottom-next.gif';">            <img id="imgnextb" src="$imagefolder/ragen/bottom-next.gif" alt="next &gt;&gt;" /></a></span>#end if            <span>$report.navigator.view</span>        </th>        <td class="rightkludge"></td>    </tr></table>#else <p class="error">No results found!</p>#end if#end block content#def selectoptiondraw($name, $elementlist, $elementdict, $selected="", $descriptiondict=None)<select name="$name">#for $element in $elementlist    <option value="$element"#slurp#if $element == $selected selected="1"#slurp#end if#if $descriptiondict.has_key($element) title="$descriptiondict[$element]"#slurp#end if>#slurp$elementdict[$element]#slurp</option>#end for</select>#end def

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -