📄 frontpagetemplate.tmpl
字号:
#encoding UTF-8## $Id: FrontpageTemplate.tmpl 4292 2007-12-10 15:22:57Z mortenv $#### 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: Magnar Sveen <magnars@stud.ntnu.no>## Stein Magnus Jodal <stein.magnus.jodal@uninett.no>###extends MainTemplate#attr boxesdown = False#attr numberOfBoxesShown = 10#attr numberOfMessagesShown = 5#from nav.web import shouldShow#block additionalCSS$default_table_CSS#end block#block content<div class="boxes">$navlinksbox$externallinksbox$contactinformationbox</div>#if $varExists('welcome') and $welcome<div class="welcome">$welcome</div>#end if$messages$status#end block#def navlinksbox#if $varExists('navlinks') and $navlinks $sideboxstart('NAV links') $navlinks $sideboxend()#end if#end def#def externallinksbox#if $varExists('externallinks') and $externallinks $sideboxstart('External links') $externallinks $sideboxend()#end if#end def#def contactinformationbox#if $varExists('contactinformation') and $contactinformation $sideboxstart('Contact information') $contactinformation $sideboxend()#end if#end def#def sideboxstart($title)<table> <tr> <th>$title</th> </tr> <tr> <td>#end def#def sideboxend </td> </tr> </table>#end def#def messages#set $msgs = $getVar('msgs', False)#if $msgs #set $msgcount = len($msgs) #set $rowcount = $msgcount + 1<table class="listtable" style="width: 50em;"> <caption> <a href="/messages/">Messages</a><br /> #if $msgcount == 1 <span class="subtitle">$msgcount active message</span> #else <span class="subtitle">$msgcount active messages</span> #end if </caption> <thead> <tr> <th>Published</th> <th>Title</th> <th style="white-space: normal;">Description</th> <th>Tasks</th> </tr> </thead> <tbody> #for $msg in $msgs #if len($msg.description) > 80 #set $desc = $msg.description[:80] + '...' #else #set $desc = $msg.description #end if #if $msg.tasks #set $tasks = len($msg.tasks) #else #set $tasks = 0 #end if <tr class="$rowcycler"> <td>$msg.publish_start.strftime('%Y-%m-%d %H:%M')</td> <td><a href="/messages/view?id=$msg.messageid">$msg.title.replace('<', '<').replace('>', '>')</a></td> <td>$desc.replace('<', '<').replace('>', '>')</td> #if $tasks <td><a href="/messages/view?id=$msg.messageid"> <img src="/images/status/wrench.gif" width="10" height="10" alt="Tasks"> $tasks</a></td> #else <td> </td> #end if </tr> #end for </tbody></table>#end if#end def#def status#set $rowcount = len($boxesdown) + 1<table class="listtable" style="width: 50em;"> <caption> <a href="/status/">Status Now</a><br /> <span class="subtitle">$numboxesdown IP devices down, $numboxesshadow in shadow</span> </caption> <thead> <tr> <th>Sysname</th> <th>IP</th> <th>Down since</th> <th>Downtime</th> </tr> </thead>#set $numberdown = 0 <tbody>#for $box in $boxesdown#if not $box[4] #if $numberdown < $numberOfBoxesShown <tr class="$rowcycler"> #if shouldShow("/browse/$box[1]", $user) <td><a href="/browse/$box[1]">$box[1]</a></td> #else <td>$box[1]</td> #end if <td>$box[2]</td> #set $since = $box[3].strftime('%Y-%m-%d %H:%M') <td>$since</td> <td style="text-align: right;"><span title="$box[0]">$box[5]</span></td> </tr> #end if #set $numberdown = $numberdown + 1#end if#end for </tbody>#if len($boxesdown) > $numberOfBoxesShown #set $linktext = "More..."#else #set $linktext = "Status page"#end if <tbody class="footer"> <tr> <th colspan="6"><a href="/status/">$linktext</a></th> </tr> </tbody></table>#end def
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -