#!/usr/bin/env python
# -*- coding: UTF-8 -*-



##################################################
## DEPENDENCIES
import sys
import os
import os.path
from os.path import getmtime, exists
import time
import types
import __builtin__
from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
from Cheetah.Template import Template
from Cheetah.DummyTransaction import DummyTransaction
from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
from Cheetah.CacheRegion import CacheRegion
import Cheetah.Filters as Filters
import Cheetah.ErrorCatchers as ErrorCatchers
from nav.web.templates.MainTemplate import MainTemplate

##################################################
## MODULE CONSTANTS
try:
    True, False
except NameError:
    True, False = (1==1), (1==0)
VFFSL=valueFromFrameOrSearchList
VFSL=valueFromSearchList
VFN=valueForName
currentTime=time.time
__CHEETAH_version__ = '2.0.1'
__CHEETAH_versionTuple__ = (2, 0, 1, 'final', 0)
__CHEETAH_genTime__ = 1225031604.832603
__CHEETAH_genTimestamp__ = 'Sun Oct 26 14:33:24 2008'
__CHEETAH_src__ = 'LoggerTemplate.tmpl'
__CHEETAH_srcLastModified__ = 'Fri Jan 26 16:31:47 2007'
__CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'

if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
    raise AssertionError(
      'This template was compiled with Cheetah version'
      ' %s. Templates compiled before version %s must be recompiled.'%(
         __CHEETAH_version__, RequiredCheetahVersion))

##################################################
## CLASSES

class LoggerTemplate(MainTemplate):

    ##################################################
    ## CHEETAH GENERATED METHODS


    def __init__(self, *args, **KWs):

        MainTemplate.__init__(self, *args, **KWs)
        if not self._CHEETAH__instanceInitialized:
            cheetahKWArgs = {}
            allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
            for k,v in KWs.items():
                if k in allowedKWs: cheetahKWArgs[k] = v
            self._initCheetahInstance(**cheetahKWArgs)
        

    def content(self, **KWS):



        ## CHEETAH: generated from #block content at line 27, col 1.
        trans = KWS.get("trans")
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
            trans = self.transaction # is None unless self.awake() was called
        if not trans:
            trans = DummyTransaction()
            _dummyTrans = True
        else: _dummyTrans = False
        write = trans.response().write
        SL = self._CHEETAH__searchList
        _filter = self._CHEETAH__currentFilter
        
        ########################################
        ## START - generated method body
        
        write('''<h2>Syslog Analyzer</h2>
<div id="wrapper">
''')
        _v = VFFSL(SL,"logform",False)(VFFSL(SL,"priority",True),VFFSL(SL,"type",True),VFFSL(SL,"category",True),VFFSL(SL,"origin",True),VFFSL(SL,"tfrom",True),VFFSL(SL,"tto",True)) # '$logform($priority,$type,$category,$origin,$tfrom,$tto)' on line 30, col 1
        if _v is not None: write(_filter(_v, rawExpr='$logform($priority,$type,$category,$origin,$tfrom,$tto)')) # from line 30, col 1.
        write('''

''')
        if VFFSL(SL,"mode",True) == "statistics": # generated from line 32, col 1
            _v = VFFSL(SL,"statistics",False)(VFFSL(SL,"typelist",True), VFFSL(SL,"originlist",True), VFFSL(SL,"total",True), VFFSL(SL,"typedict",True), VFFSL(SL,"origindict",True), VFFSL(SL,"type",True), VFFSL(SL,"origin",True), VFFSL(SL,"priority",True), VFFSL(SL,"category",True), VFFSL(SL,"link",True)) # '$statistics($typelist, $originlist, $total, $typedict, $origindict, $type, $origin, $priority, $category, $link)' on line 33, col 1
            if _v is not None: write(_filter(_v, rawExpr='$statistics($typelist, $originlist, $total, $typedict, $origindict, $type, $origin, $priority, $category, $link)')) # from line 33, col 1.
            write('''
''')
        elif VFFSL(SL,"mode",True) == "log": # generated from line 34, col 1
            _v = VFFSL(SL,"viewlog",False)(VFFSL(SL,"log",True), VFFSL(SL,"total",True), VFFSL(SL,"type",True), VFFSL(SL,"origin",True), VFFSL(SL,"priority",True), VFFSL(SL,"category",True)) # '$viewlog($log, $total, $type, $origin, $priority, $category)' on line 35, col 1
            if _v is not None: write(_filter(_v, rawExpr='$viewlog($log, $total, $type, $origin, $priority, $category)')) # from line 35, col 1.
            write('''
''')
        elif VFFSL(SL,"mode",True) == "error": # generated from line 36, col 1
            _v = VFFSL(SL,"errorlist",False)(VFFSL(SL,"errors",True), VFFSL(SL,"total",True)) # '$errorlist($errors, $total)' on line 37, col 1
            if _v is not None: write(_filter(_v, rawExpr='$errorlist($errors, $total)')) # from line 37, col 1.
            write('''
''')
        elif VFFSL(SL,"mode",True) == "exception": # generated from line 38, col 1
            _v = VFFSL(SL,"exceptionlist",False)(VFFSL(SL,"exceptions",True)) # '$exceptionlist($exceptions)' on line 39, col 1
            if _v is not None: write(_filter(_v, rawExpr='$exceptionlist($exceptions)')) # from line 39, col 1.
            write('''
''')
        else: # generated from line 40, col 1
            _v = VFFSL(SL,"prioritylist",False)(VFFSL(SL,"priorities",True), VFFSL(SL,"priorityresult",True), VFFSL(SL,"link",True)) # '$prioritylist($priorities, $priorityresult, $link)' on line 41, col 1
            if _v is not None: write(_filter(_v, rawExpr='$prioritylist($priorities, $priorityresult, $link)')) # from line 41, col 1.
            write('''
''')
        write('''</div>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def logform(self, priority, type, category, origin, tfrom, tto, **KWS):



        ## CHEETAH: generated from #def logform($priority,$type,$category,$origin,$tfrom,$tto) at line 47, col 1.
        trans = KWS.get("trans")
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
            trans = self.transaction # is None unless self.awake() was called
        if not trans:
            trans = DummyTransaction()
            _dummyTrans = True
        else: _dummyTrans = False
        write = trans.response().write
        SL = self._CHEETAH__searchList
        _filter = self._CHEETAH__currentFilter
        
        ########################################
        ## START - generated method body
        
        write('''
<div id="logform">
<form action="" method="get">

<label for="priority">Priority</label>
<select id="priority" name="priority">
''')
        for p in VFFSL(SL,"priorities",True): # generated from line 54, col 1
            if str(VFFSL(SL,"p",True)[0]) == str(VFFSL(SL,"priority",True)): # generated from line 55, col 1
                write('''\t<option value="''')
                _v = VFFSL(SL,"p",True)[0] # '$p[0]' on line 56, col 17
                if _v is not None: write(_filter(_v, rawExpr='$p[0]')) # from line 56, col 17.
                write('''" selected="1">''')
                _v = VFFSL(SL,"p",True)[1] # '$p[1]' on line 56, col 37
                if _v is not None: write(_filter(_v, rawExpr='$p[1]')) # from line 56, col 37.
                write('''</option>
''')
            else: # generated from line 57, col 1
                write('''\t<option value="''')
                _v = VFFSL(SL,"p",True)[0] # '$p[0]' on line 58, col 17
                if _v is not None: write(_filter(_v, rawExpr='$p[0]')) # from line 58, col 17.
                write('''">''')
                _v = VFFSL(SL,"p",True)[1] # '$p[1]' on line 58, col 24
                if _v is not None: write(_filter(_v, rawExpr='$p[1]')) # from line 58, col 24.
                write('''</option>
''')
        write('''</select>
<label for="type"><a href="http://www.cisco.com/univercd/cc/td/doc/product/software/ios120/12supdoc/12sems/emover.htm#5002">Message type</a></label>
<select id="type" name="type">
''')
        for t in VFFSL(SL,"types",True): # generated from line 64, col 1
            if VFFSL(SL,"t",True)[1] == VFFSL(SL,"type",True): # generated from line 65, col 1
                write('''\t<option value="''')
                _v = VFFSL(SL,"t",True)[1] # '$t[1]' on line 66, col 17
                if _v is not None: write(_filter(_v, rawExpr='$t[1]')) # from line 66, col 17.
                write('''" selected="1">''')
                _v = VFFSL(SL,"t",True)[1] # '$t[1]' on line 66, col 37
                if _v is not None: write(_filter(_v, rawExpr='$t[1]')) # from line 66, col 37.
                write('''</option>
''')
            else: # generated from line 67, col 1
                write('''\t<option value="''')
                _v = VFFSL(SL,"t",True)[1] # '$t[1]' on line 68, col 17
                if _v is not None: write(_filter(_v, rawExpr='$t[1]')) # from line 68, col 17.
                write('''">''')
                _v = VFFSL(SL,"t",True)[1] # '$t[1]' on line 68, col 24
                if _v is not None: write(_filter(_v, rawExpr='$t[1]')) # from line 68, col 24.
                write('''</option>
''')
        write('''</select>

<br />

<label for="category">Category</label>
<select id="category" name="category">
''')
        for c in VFFSL(SL,"categories",True): # generated from line 77, col 1
            if VFFSL(SL,"c",True)[0] == VFFSL(SL,"category",True): # generated from line 78, col 1
                write('''\t<option value="''')
                _v = VFFSL(SL,"c",True)[0] # '$c[0]' on line 79, col 17
                if _v is not None: write(_filter(_v, rawExpr='$c[0]')) # from line 79, col 17.
                write('''" selected="1">''')
                _v = VFFSL(SL,"c",True)[0] # '$c[0]' on line 79, col 37
                if _v is not None: write(_filter(_v, rawExpr='$c[0]')) # from line 79, col 37.
                write('''</option>
''')
            else: # generated from line 80, col 1
                write('''\t<option value="''')
                _v = VFFSL(SL,"c",True)[0] # '$c[0]' on line 81, col 17
                if _v is not None: write(_filter(_v, rawExpr='$c[0]')) # from line 81, col 17.
                write('''">''')
                _v = VFFSL(SL,"c",True)[0] # '$c[0]' on line 81, col 24
                if _v is not None: write(_filter(_v, rawExpr='$c[0]')) # from line 81, col 24.
                write('''</option>
''')
        write('''</select>
<label for="origin">Origin</label>
<select id="origin" nameid="origin">
''')
        for o in VFFSL(SL,"origins",True): # generated from line 87, col 1
            if VFFSL(SL,"o",True)[1] == VFFSL(SL,"origin",True): # generated from line 88, col 1
                write('''\t<option value="''')
                _v = VFFSL(SL,"o",True)[1] # '$o[1]' on line 89, col 17
                if _v is not None: write(_filter(_v, rawExpr='$o[1]')) # from line 89, col 17.
                write('''" selected="1">''')
                _v = VFFSL(SL,"o",True)[1] # '$o[1]' on line 89, col 37
                if _v is not None: write(_filter(_v, rawExpr='$o[1]')) # from line 89, col 37.
                write('''</option>
''')
            else: # generated from line 90, col 1
                write('''\t<option value="''')
                _v = VFFSL(SL,"o",True)[1] # '$o[1]' on line 91, col 17
                if _v is not None: write(_filter(_v, rawExpr='$o[1]')) # from line 91, col 17.
                write('''">''')
                _v = VFFSL(SL,"o",True)[1] # '$o[1]' on line 91, col 24
                if _v is not None: write(_filter(_v, rawExpr='$o[1]')) # from line 91, col 24.
                write('''</option>
''')
        write('''</select>

<br />

<label for="tfrom" title="yyyy-mm-dd HH:MM:SS">From</label>
<input type="text" name="tfrom" value="''')
        _v = VFFSL(SL,"tfrom",True) # '$tfrom' on line 99, col 40
        if _v is not None: write(_filter(_v, rawExpr='$tfrom')) # from line 99, col 40.
        write('''" title="yyyy-mm-dd HH:MM:SS" size="19" maxlength="19" />

<label for="tto" title="yyyy-mm-dd HH:MM:SS">To</label>
<input type="text" name="tto" value="''')
        _v = VFFSL(SL,"tto",True) # '$tto' on line 102, col 38
        if _v is not None: write(_filter(_v, rawExpr='$tto')) # from line 102, col 38.
        write('''" title="yyyy-mm-dd HH:MM:SS" size="19" maxlength="19" />

<br />

<input type="submit" name="send" value="Send" />
<input type="button" name="reset" value="Reset" onclick="window.location.href=\'/logger/\'"/>
 - <a href="/logger/?error">parsing errors</a> - <a href="/logger/?exception">priority exceptions</a> -
</form>

</div>

''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def prioritylist(self, pritorities, priorityresult, link, **KWS):



        ## CHEETAH: generated from #def $prioritylist($pritorities, $priorityresult, $link) at line 116, col 1.
        trans = KWS.get("trans")
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
            trans = self.transaction # is None unless self.awake() was called
        if not trans:
            trans = DummyTransaction()
            _dummyTrans = True
        else: _dummyTrans = False
        write = trans.response().write
        SL = self._CHEETAH__searchList
        _filter = self._CHEETAH__currentFilter
        
        ########################################
        ## START - generated method body
        
        if len(VFFSL(SL,"priorityresult",True)): # generated from line 117, col 1
            write('''<table>
''')
            for row in VFFSL(SL,"priorities",True): # generated from line 119, col 1
                if VFN(VFFSL(SL,"priorityresult",True),"has_key",False)(VFFSL(SL,"row",True)[0]): # generated from line 120, col 1
                    write('''<tr><td><a href="/logger/?''')
                    _v = VFFSL(SL,"link",True) # '$link' on line 121, col 27
                    if _v is not None: write(_filter(_v, rawExpr='$link')) # from line 121, col 27.
                    write('''&amp;priority=''')
                    _v = VFFSL(SL,"row",True)[0] # '$row[0]' on line 121, col 46
                    if _v is not None: write(_filter(_v, rawExpr='$row[0]')) # from line 121, col 46.
                    write('''" title="''')
                    _v = VFFSL(SL,"row",True)[2] # '$row[2]' on line 121, col 62
                    if _v is not None: write(_filter(_v, rawExpr='$row[2]')) # from line 121, col 62.
                    write('''">Priority ''')
                    _v = VFFSL(SL,"row",True)[1] # '$row[1]' on line 121, col 80
                    if _v is not None: write(_filter(_v, rawExpr='$row[1]')) # from line 121, col 80.
                    write('''</a></td><td>''')
                    _v = VFFSL(SL,"priorityresult",True)[VFFSL(SL,"row",True)[0]] # '$priorityresult[$row[0]]' on line 121, col 100
                    if _v is not None: write(_filter(_v, rawExpr='$priorityresult[$row[0]]')) # from line 121, col 100.
                    write('''</td></tr>
''')
                elif not VFFSL(SL,"row",True)[0] == "-": # generated from line 122, col 1
                    write('''<tr><td><span title="''')
                    _v = VFFSL(SL,"row",True)[2] # '$row[2]' on line 123, col 22
                    if _v is not None: write(_filter(_v, rawExpr='$row[2]')) # from line 123, col 22.
                    write('''">Priority ''')
                    _v = VFFSL(SL,"row",True)[1] # '$row[1]' on line 123, col 40
                    if _v is not None: write(_filter(_v, rawExpr='$row[1]')) # from line 123, col 40.
                    write('''</span></td><td>0</td></tr>
''')
            write('''</table>
''')
        else: # generated from line 127, col 1
            write('''<p>Your search did not return any results.</p>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def statistics(self, typelist, originlist, total, typedict, origindict, typeid, originid, priorityid, categoryid, link, **KWS):



        ## CHEETAH: generated from #def $statistics($typelist, $originlist, $total, $typedict, $origindict, $typeid, $originid, $priorityid, $categoryid, $link) at line 132, col 1.
        trans = KWS.get("trans")
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
            trans = self.transaction # is None unless self.awake() was called
        if not trans:
            trans = DummyTransaction()
            _dummyTrans = True
        else: _dummyTrans = False
        write = trans.response().write
        SL = self._CHEETAH__searchList
        _filter = self._CHEETAH__currentFilter
        
        ########################################
        ## START - generated method body
        
        write('''<div style="text-align:center;width:100%">

<p style="text-align:center;">Total ''')
        _v = VFFSL(SL,"total",True) # '$total' on line 135, col 37
        if _v is not None: write(_filter(_v, rawExpr='$total')) # from line 135, col 37.
        write(''' matches
''')
        if VFFSL(SL,"typeid",True): # generated from line 136, col 1
            write('''of type ''')
            _v = VFFSL(SL,"typeid",True) # '$typeid' on line 137, col 9
            if _v is not None: write(_filter(_v, rawExpr='$typeid')) # from line 137, col 9.
            write('''
''')
        elif VFFSL(SL,"priorityid",True): # generated from line 138, col 1
            write('''of priority ''')
            _v = VFFSL(SL,"priorityid",True) # '$priorityid' on line 139, col 13
            if _v is not None: write(_filter(_v, rawExpr='$priorityid')) # from line 139, col 13.
            write('''
''')
        if VFFSL(SL,"originid",True): # generated from line 141, col 1
            write('''from origin ''')
            _v = VFFSL(SL,"originid",True) # '$originid' on line 142, col 13
            if _v is not None: write(_filter(_v, rawExpr='$originid')) # from line 142, col 13.
            write('''
''')
        elif VFFSL(SL,"categoryid",True): # generated from line 143, col 1
            write('''of category ''')
            _v = VFFSL(SL,"categoryid",True) # '$categoryid' on line 144, col 13
            if _v is not None: write(_filter(_v, rawExpr='$categoryid')) # from line 144, col 13.
            write('''
''')
        write('''</p>

<div style="float:left;text-align:left;">
''')
        if len(VFFSL(SL,"originlist",True)): # generated from line 149, col 1
            write('''<table>
''')
            for o in VFFSL(SL,"originlist",True): # generated from line 151, col 1
                if VFFSL(SL,"originid",True) == VFFSL(SL,"origindict",True)[VFFSL(SL,"o",True)[0]]: # generated from line 152, col 1
                    write('''<tr><td>''')
                    _v = VFFSL(SL,"origindict",True)[VFFSL(SL,"o",True)[0]] # '$origindict[$o[0]]' on line 153, col 9
                    if _v is not None: write(_filter(_v, rawExpr='$origindict[$o[0]]')) # from line 153, col 9.
                    write('''</td><td><a href="/logger/?''')
                    _v = VFFSL(SL,"link",True) # '$link' on line 153, col 54
                    if _v is not None: write(_filter(_v, rawExpr='$link')) # from line 153, col 54.
                    write('''&amp;log=1">''')
                    _v = VFFSL(SL,"o",True)[1] # '$o[1]' on line 153, col 71
                    if _v is not None: write(_filter(_v, rawExpr='$o[1]')) # from line 153, col 71.
                    write('''</a></td></tr>
''')
                else: # generated from line 154, col 1
                    write('''<tr><td><a href="/logger/?''')
                    _v = VFFSL(SL,"link",True) # '$link' on line 155, col 27
                    if _v is not None: write(_filter(_v, rawExpr='$link')) # from line 155, col 27.
                    write('''&amp;origin=''')
                    _v = VFFSL(SL,"origindict",True)[VFFSL(SL,"o",True)[0]] # '$origindict[$o[0]]' on line 155, col 44
                    if _v is not None: write(_filter(_v, rawExpr='$origindict[$o[0]]')) # from line 155, col 44.
                    write('''">''')
                    _v = VFFSL(SL,"origindict",True)[VFFSL(SL,"o",True)[0]] # '$origindict[$o[0]]' on line 155, col 64
                    if _v is not None: write(_filter(_v, rawExpr='$origindict[$o[0]]')) # from line 155, col 64.
                    write('''</a></td><td><a href="/logger/?''')
                    _v = VFFSL(SL,"link",True) # '$link' on line 155, col 113
                    if _v is not None: write(_filter(_v, rawExpr='$link')) # from line 155, col 113.
                    write('''&amp;origin=''')
                    _v = VFFSL(SL,"origindict",True)[VFFSL(SL,"o",True)[0]] # '$origindict[$o[0]]' on line 155, col 130
                    if _v is not None: write(_filter(_v, rawExpr='$origindict[$o[0]]')) # from line 155, col 130.
                    write('''&amp;log=1">''')
                    _v = VFFSL(SL,"o",True)[1] # '$o[1]' on line 155, col 160
                    if _v is not None: write(_filter(_v, rawExpr='$o[1]')) # from line 155, col 160.
                    write('''</a></td></tr>
''')
            write('''</table>
''')
        write('''</div>
<div style="float:left;text-align:left;">
''')
        if len(VFFSL(SL,"typelist",True)): # generated from line 162, col 1
            write('''<table>
''')
            for t in VFFSL(SL,"typelist",True): # generated from line 164, col 1
                if VFFSL(SL,"typeid",True) == VFFSL(SL,"typedict",True)[VFFSL(SL,"t",True)[0]]: # generated from line 165, col 1
                    write('''<tr><td>''')
                    _v = VFFSL(SL,"typedict",True)[VFFSL(SL,"t",True)[0]] # '$typedict[$t[0]]' on line 166, col 9
                    if _v is not None: write(_filter(_v, rawExpr='$typedict[$t[0]]')) # from line 166, col 9.
                    write('''</td><td><a href="/logger/?''')
                    _v = VFFSL(SL,"link",True) # '$link' on line 166, col 52
                    if _v is not None: write(_filter(_v, rawExpr='$link')) # from line 166, col 52.
                    write('''&amp;log=1">''')
                    _v = VFFSL(SL,"t",True)[1] # '$t[1]' on line 166, col 69
                    if _v is not None: write(_filter(_v, rawExpr='$t[1]')) # from line 166, col 69.
                    write('''</a></td></tr>
''')
                else: # generated from line 167, col 1
                    write('''<tr><td><a href="/logger/?''')
                    _v = VFFSL(SL,"link",True) # '$link' on line 168, col 27
                    if _v is not None: write(_filter(_v, rawExpr='$link')) # from line 168, col 27.
                    write('''&amp;type=''')
                    _v = VFFSL(SL,"typedict",True)[VFFSL(SL,"t",True)[0]] # '$typedict[$t[0]]' on line 168, col 42
                    if _v is not None: write(_filter(_v, rawExpr='$typedict[$t[0]]')) # from line 168, col 42.
                    write('''">''')
                    _v = VFFSL(SL,"typedict",True)[VFFSL(SL,"t",True)[0]] # '$typedict[$t[0]]' on line 168, col 60
                    if _v is not None: write(_filter(_v, rawExpr='$typedict[$t[0]]')) # from line 168, col 60.
                    write('''</a></td><td><a href="/logger/?''')
                    _v = VFFSL(SL,"link",True) # '$link' on line 168, col 107
                    if _v is not None: write(_filter(_v, rawExpr='$link')) # from line 168, col 107.
                    write('''&amp;type=''')
                    _v = VFFSL(SL,"typedict",True)[VFFSL(SL,"t",True)[0]] # '$typedict[$t[0]]' on line 168, col 122
                    if _v is not None: write(_filter(_v, rawExpr='$typedict[$t[0]]')) # from line 168, col 122.
                    write('''&amp;log=1">''')
                    _v = VFFSL(SL,"t",True)[1] # '$t[1]' on line 168, col 150
                    if _v is not None: write(_filter(_v, rawExpr='$t[1]')) # from line 168, col 150.
                    write('''</a></td></tr>
''')
            write('''</table>
''')
        write('''</div>
</div>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def viewlog(self, log, total, typeid, originid, priorityid, categoryid, **KWS):



        ## CHEETAH: generated from #def $viewlog($log, $total, $typeid, $originid, $priorityid, $categoryid) at line 178, col 1.
        trans = KWS.get("trans")
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
            trans = self.transaction # is None unless self.awake() was called
        if not trans:
            trans = DummyTransaction()
            _dummyTrans = True
        else: _dummyTrans = False
        write = trans.response().write
        SL = self._CHEETAH__searchList
        _filter = self._CHEETAH__currentFilter
        
        ########################################
        ## START - generated method body
        
        write('''<p style="text-align:center;">Total ''')
        _v = VFFSL(SL,"total",True) # '$total' on line 179, col 37
        if _v is not None: write(_filter(_v, rawExpr='$total')) # from line 179, col 37.
        write(''' matches
''')
        if VFFSL(SL,"typeid",True): # generated from line 180, col 1
            write('''of type ''')
            _v = VFFSL(SL,"typeid",True) # '$typeid' on line 181, col 9
            if _v is not None: write(_filter(_v, rawExpr='$typeid')) # from line 181, col 9.
            write('''
''')
        elif VFFSL(SL,"priorityid",True): # generated from line 182, col 1
            write('''of priority ''')
            _v = VFFSL(SL,"priorityid",True) # '$priorityid' on line 183, col 13
            if _v is not None: write(_filter(_v, rawExpr='$priorityid')) # from line 183, col 13.
            write('''
''')
        if VFFSL(SL,"originid",True): # generated from line 185, col 1
            write('''from origin ''')
            _v = VFFSL(SL,"originid",True) # '$originid' on line 186, col 13
            if _v is not None: write(_filter(_v, rawExpr='$originid')) # from line 186, col 13.
            write('''
''')
        elif VFFSL(SL,"categoryid",True): # generated from line 187, col 1
            write('''of category ''')
            _v = VFFSL(SL,"categoryid",True) # '$categoryid' on line 188, col 13
            if _v is not None: write(_filter(_v, rawExpr='$categoryid')) # from line 188, col 13.
            write('''
''')
        write('''</p>

''')
        if len(VFFSL(SL,"log",True)): # generated from line 192, col 1
            write('''<table>
''')
            for l in VFFSL(SL,"log",True): # generated from line 194, col 1
                write('''<tr><td>''')
                _v = VFFSL(SL,"l.time",True) # '$l.time' on line 195, col 9
                if _v is not None: write(_filter(_v, rawExpr='$l.time')) # from line 195, col 9.
                write('''</td><td>''')
                _v = VFFSL(SL,"l.origin",True) # '$l.origin' on line 195, col 25
                if _v is not None: write(_filter(_v, rawExpr='$l.origin')) # from line 195, col 25.
                write('''</td><td>''')
                _v = VFFSL(SL,"l.type",True) # '$l.type' on line 195, col 43
                if _v is not None: write(_filter(_v, rawExpr='$l.type')) # from line 195, col 43.
                write('''</td><td>''')
                _v = VFFSL(SL,"l.message",True) # '$l.message' on line 195, col 59
                if _v is not None: write(_filter(_v, rawExpr='$l.message')) # from line 195, col 59.
                write('''</td></tr>
''')
            write('''</table>
''')
        write('''
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def errorlist(self, errors, total, **KWS):



        ## CHEETAH: generated from #def $errorlist($errors, $total) at line 203, col 1.
        trans = KWS.get("trans")
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
            trans = self.transaction # is None unless self.awake() was called
        if not trans:
            trans = DummyTransaction()
            _dummyTrans = True
        else: _dummyTrans = False
        write = trans.response().write
        SL = self._CHEETAH__searchList
        _filter = self._CHEETAH__currentFilter
        
        ########################################
        ## START - generated method body
        
        write('''
''')
        if len(VFFSL(SL,"errors",True)): # generated from line 205, col 1
            write('''<p style="text-align:center;">Total ''')
            _v = VFFSL(SL,"total",True) # '$total' on line 206, col 37
            if _v is not None: write(_filter(_v, rawExpr='$total')) # from line 206, col 37.
            write(''' error conditions</p>
<table>
''')
            for e in VFFSL(SL,"errors",True): # generated from line 208, col 1
                write('''<tr><td>''')
                _v = VFFSL(SL,"e",True)[0] # '$e[0]' on line 209, col 9
                if _v is not None: write(_filter(_v, rawExpr='$e[0]')) # from line 209, col 9.
                write('''</td></tr>
''')
            write('''</table>
''')
        else: # generated from line 212, col 1
            write('''<p>There is not saved any error conditions from the parsing of the syslog
files. This probably means all the log messages have been parsed
successfully.</p>
''')
        write('''
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def exceptionlist(self, exceptions, **KWS):



        ## CHEETAH: generated from #def $exceptionlist($exceptions) at line 221, col 1.
        trans = KWS.get("trans")
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
            trans = self.transaction # is None unless self.awake() was called
        if not trans:
            trans = DummyTransaction()
            _dummyTrans = True
        else: _dummyTrans = False
        write = trans.response().write
        SL = self._CHEETAH__searchList
        _filter = self._CHEETAH__currentFilter
        
        ########################################
        ## START - generated method body
        
        write('''
''')
        if len(VFFSL(SL,"exceptions",True)): # generated from line 223, col 1
            write('''<p>Lists your defined priority exceptions based on the logger.conf configuration file</p>
<table>
''')
            for e in VFFSL(SL,"exceptions",True): # generated from line 226, col 1
                write('''<tr><td>''')
                _v = VFFSL(SL,"e",True)[0] # '$e[0]' on line 227, col 9
                if _v is not None: write(_filter(_v, rawExpr='$e[0]')) # from line 227, col 9.
                write('''</td><td>''')
                _v = VFFSL(SL,"e",True)[1] # '$e[1]' on line 227, col 23
                if _v is not None: write(_filter(_v, rawExpr='$e[1]')) # from line 227, col 23.
                write('''</td></tr>
''')
            write('''</table>
''')
        else: # generated from line 230, col 1
            write('''<p>You have not defined any priority exceptions in the logger.conf configuration file</p>
''')
        write('''
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def writeBody(self, **KWS):



        ## CHEETAH: main method generated for this template
        trans = KWS.get("trans")
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
            trans = self.transaction # is None unless self.awake() was called
        if not trans:
            trans = DummyTransaction()
            _dummyTrans = True
        else: _dummyTrans = False
        write = trans.response().write
        SL = self._CHEETAH__searchList
        _filter = self._CHEETAH__currentFilter
        
        ########################################
        ## START - generated method body
        
        #  $Id: MatrixTemplate.tmpl 2674 2004-04-28 13:03:41Z 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: Sigurd Gartmann <sigurd-nav@brogar.org>
        # 
        write('''
''')
        self.content(trans=trans)
        write('''










''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        
    ##################################################
    ## CHEETAH GENERATED ATTRIBUTES


    _CHEETAH__instanceInitialized = False

    _CHEETAH_version = __CHEETAH_version__

    _CHEETAH_versionTuple = __CHEETAH_versionTuple__

    _CHEETAH_genTime = __CHEETAH_genTime__

    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__

    _CHEETAH_src = __CHEETAH_src__

    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__

    _mainCheetahMethod_for_LoggerTemplate= 'writeBody'

## END CLASS DEFINITION

if not hasattr(LoggerTemplate, '_initCheetahAttributes'):
    templateAPIClass = getattr(LoggerTemplate, '_CHEETAH_templateClass', Template)
    templateAPIClass._addCheetahPlumbingCodeToClass(LoggerTemplate)


# CHEETAH was developed by Tavis Rudd and Mike Orr
# with code, advice and input from many other volunteers.
# For more information visit http://www.CheetahTemplate.org/

##################################################
## if run from command line:
if __name__ == '__main__':
    from Cheetah.TemplateCmdLineIface import CmdLineIface
    CmdLineIface(templateObj=LoggerTemplate()).run()


