#!/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__ = 1225031601.6509221
__CHEETAH_genTimestamp__ = 'Sun Oct 26 14:33:21 2008'
__CHEETAH_src__ = 'ArnoldTemplate.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 ArnoldTemplate(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 34, 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>Arnold</h2>

<p>
''')
        _v = VFFSL(SL,"printLinks",False)(VFFSL(SL,"buttons",True),VFFSL(SL,"buttonnames",True)) # '$printLinks($buttons,$buttonnames)' on line 40, col 1
        if _v is not None: write(_filter(_v, rawExpr='$printLinks($buttons,$buttonnames)')) # from line 40, col 1.
        write('''
</p>

''')
        if VFFSL(SL,"action",True) == 'search': # generated from line 43, col 1
            write("""  <div class='infobox'>
    <h5>Usage:</h5>

    <br>

    Search by choosing searchfield and then enter a value. Choose if
    what you are searching for is enabled, disabled or both. Enter the
    number of days back in time (0 being today) you want to limit your
    search to.

    <ul>
      <li>IP-format: Standard inet-values accepted (e.g. 129.241.xxx.xxx, 129.241.xxx.xxx/xx)</li>
      <li>MAC-format: Hexadecimal values with no padding.</li>
      <li>Netbios, DNS and Orgid accept all characters and words.</li>
    </ul>

  </div>

  <br>

  """)
            _v = VFFSL(SL,"printSearch",False)() # '$printSearch()' on line 64, col 3
            if _v is not None: write(_filter(_v, rawExpr='$printSearch()')) # from line 64, col 3.
            write('''

''')
        elif VFFSL(SL,"action",True) == 'showdetails': # generated from line 66, col 1
            write('''  ''')
            _v = VFFSL(SL,"printList",False)(VFFSL(SL,"headertext",True), "", VFFSL(SL,"list",True), VFFSL(SL,"headersList",True), VFFSL(SL,"headers",True), 1, 0) # '$printList($headertext, "", $list, $headersList, $headers, 1, 0)' on line 67, col 3
            if _v is not None: write(_filter(_v, rawExpr='$printList($headertext, "", $list, $headersList, $headers, 1, 0)')) # from line 67, col 3.
            write('''
  <h3>History</h3>
  ''')
            _v = VFFSL(SL,"printList",False)(VFFSL(SL,"headertext2",True), VFFSL(SL,"hitstext2",True), VFFSL(SL,"list2",True), VFFSL(SL,"headersList2",True), VFFSL(SL,"headers2",True), VFFSL(SL,"hits2",True), 1) # '$printList($headertext2, $hitstext2, $list2, $headersList2, $headers2, $hits2, 1)' on line 69, col 3
            if _v is not None: write(_filter(_v, rawExpr='$printList($headertext2, $hitstext2, $list2, $headersList2, $headers2, $hits2, 1)')) # from line 69, col 3.
            write('''

''')
        elif VFFSL(SL,"action",True) == 'addreason': # generated from line 71, col 1
            write('''  ''')
            _v = VFFSL(SL,"printAddreason",False)(VFFSL(SL,"blockreasonheadersList",True), VFFSL(SL,"blockreasonheaders",True), VFFSL(SL,"blockreasons",True), VFFSL(SL,"hits",True)) # '$printAddreason($blockreasonheadersList, $blockreasonheaders, $blockreasons, $hits)' on line 72, col 3
            if _v is not None: write(_filter(_v, rawExpr='$printAddreason($blockreasonheadersList, $blockreasonheaders, $blockreasons, $hits)')) # from line 72, col 3.
            write('''

''')
        elif VFFSL(SL,"action",True) == 'history': # generated from line 74, col 1
            write("""  <form action='history' method='GET'>
    <input type='text' name='days' size='3' value='""")
            _v = VFFSL(SL,"days",True) # '$days' on line 76, col 52
            if _v is not None: write(_filter(_v, rawExpr='$days')) # from line 76, col 52.
            write("""'>days of history (based on lastchanged)
  </form>
  """)
            _v = VFFSL(SL,"printList",False)(VFFSL(SL,"headertext",True), VFFSL(SL,"hitstext",True), VFFSL(SL,"list",True), VFFSL(SL,"headersList",True), VFFSL(SL,"headers",True), VFFSL(SL,"hits",True), 1) # '$printList($headertext, $hitstext, $list, $headersList, $headers, $hits, 1)' on line 78, col 3
            if _v is not None: write(_filter(_v, rawExpr='$printList($headertext, $hitstext, $list, $headersList, $headers, $hits, 1)')) # from line 78, col 3.
            write('''

''')
        elif VFFSL(SL,"action",True) == 'blockedports': # generated from line 80, col 1
            if VFFSL(SL,"output",True): # generated from line 81, col 3
                write("""    <p class='red'>""")
                _v = VFFSL(SL,"output",True) # '$output' on line 82, col 20
                if _v is not None: write(_filter(_v, rawExpr='$output')) # from line 82, col 20.
                write('''</p>
''')
            write('''  ''')
            _v = VFFSL(SL,"printList",False)(VFFSL(SL,"headertext",True), VFFSL(SL,"hitstext",True), VFFSL(SL,"list",True), VFFSL(SL,"headersList",True), VFFSL(SL,"headers",True), VFFSL(SL,"hits",True), 1) # '$printList($headertext, $hitstext, $list, $headersList, $headers, $hits, 1)' on line 84, col 3
            if _v is not None: write(_filter(_v, rawExpr='$printList($headertext, $hitstext, $list, $headersList, $headers, $hits, 1)')) # from line 84, col 3.
            write('''

''')
        elif VFFSL(SL,"action",True) == 'manualblock': # generated from line 86, col 1
            write("""  <div class='infobox'>
    <h5>Usage:</h5>

    <br>

    Enter ip-address to block and choose reason for block. If you want
    you can add a comment. Autoenable is the number of days until the port
    will be automatically enabled. If not entered, the port will stay
    blocked until manually opened.

  </div>

  

""")
            if VFFSL(SL,"output",True): # generated from line 101, col 3
                write("""    <p class='red'>""")
                _v = VFFSL(SL,"output",True) # '$output' on line 102, col 20
                if _v is not None: write(_filter(_v, rawExpr='$output')) # from line 102, col 20.
                write('''</p>
''')
            write('''
  <br>

  ''')
            _v = VFFSL(SL,"printManualblock",False)(VFFSL(SL,"reasons",True)) # '$printManualblock($reasons)' on line 107, col 3
            if _v is not None: write(_filter(_v, rawExpr='$printManualblock($reasons)')) # from line 107, col 3.
            write('''

''')
        elif VFFSL(SL,"action",True) == 'blocktypes': # generated from line 109, col 1
            write("""  <p><a href='addBlocktype'>Add new blocktype</a></p>
  """)
            _v = VFFSL(SL,"printList",False)(VFFSL(SL,"headertext",True), VFFSL(SL,"hitstext",True), VFFSL(SL,"list",True), VFFSL(SL,"headersList",True), VFFSL(SL,"headers",True), VFFSL(SL,"hits",True), 1) # '$printList($headertext, $hitstext, $list, $headersList, $headers, $hits, 1)' on line 111, col 3
            if _v is not None: write(_filter(_v, rawExpr='$printList($headertext, $hitstext, $list, $headersList, $headers, $hits, 1)')) # from line 111, col 3.
            write('''

''')
        elif VFFSL(SL,"action",True) == 'addBlocktype': # generated from line 113, col 1
            write('''  ''')
            _v = VFFSL(SL,"addBlocktype",False)(VFFSL(SL,"blockreasons",True)) # '$addBlocktype($blockreasons)' on line 114, col 3
            if _v is not None: write(_filter(_v, rawExpr='$addBlocktype($blockreasons)')) # from line 114, col 3.
            write('''

''')
        elif VFFSL(SL,"action",True) == 'printError': # generated from line 116, col 1
            write('''  <p>''')
            _v = VFFSL(SL,"error",True) # '$error' on line 117, col 6
            if _v is not None: write(_filter(_v, rawExpr='$error')) # from line 117, col 6.
            write('''</p>

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

    def printLinks(self, buttons, buttonnames, **KWS):



        ## CHEETAH: generated from #def printLinks($buttons,$buttonnames) at line 135, 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('''
''')
        sep = ''
        for button in VFFSL(SL,"buttonnames",True): # generated from line 139, col 1
            write('''  ''')
            _v = VFFSL(SL,"sep",True) # '$sep' on line 140, col 3
            if _v is not None: write(_filter(_v, rawExpr='$sep')) # from line 140, col 3.
            write(''' <a href="''')
            _v = VFFSL(SL,"buttons",True)[VFFSL(SL,"button",True)] # '$buttons[$button]' on line 140, col 17
            if _v is not None: write(_filter(_v, rawExpr='$buttons[$button]')) # from line 140, col 17.
            write('''">''')
            _v = VFFSL(SL,"button",True) # '$button' on line 140, col 36
            if _v is not None: write(_filter(_v, rawExpr='$button')) # from line 140, col 36.
            write('''</a>
''')
            sep = " | "
        write('''
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def printList(self, headertext, hitstext, list, headersList, headers, hits, printHits, **KWS):



        ## CHEETAH: generated from #def printList($headertext, $hitstext, $list, $headersList, $headers, $hits, $printHits) at line 149, 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('''

''')
        rowspan = VFFSL(SL,"hits",True) + 1
        colspan = VFFSL(SL,"len",False)(VFFSL(SL,"headersList",True)) + 1
        write('''
<table class="horiztable">

    <caption>
        <span class="cornerkludge"></span>
        ''')
        _v = VFFSL(SL,"headertext",True) # '$headertext' on line 160, col 9
        if _v is not None: write(_filter(_v, rawExpr='$headertext')) # from line 160, col 9.
        write('''<br />
''')
        if VFFSL(SL,"printHits",True): # generated from line 161, col 1
            write('''        <span class="subtitle">''')
            _v = VFFSL(SL,"hits",True) # '$hits' on line 162, col 32
            if _v is not None: write(_filter(_v, rawExpr='$hits')) # from line 162, col 32.
            write(''' ''')
            _v = VFFSL(SL,"hitstext",True) # '$hitstext' on line 162, col 38
            if _v is not None: write(_filter(_v, rawExpr='$hitstext')) # from line 162, col 38.
            write('''</span>
''')
        write('''    </caption>

''')
        #  HEADERS / ROW DESCRIPTIONS
        write('''
    <tr class="header">
        <td class="leftkludge"></td>
''')
        for entry in VFFSL(SL,"headersList",True): # generated from line 170, col 1
            write('''        <th>
''')
            if VFFSL(SL,"sort",True) and VFFSL(SL,"action",True) == 'history': # generated from line 172, col 5
                write('''            <a href="''')
                _v = VFFSL(SL,"section",True) # '$section' on line 173, col 22
                if _v is not None: write(_filter(_v, rawExpr='$section')) # from line 173, col 22.
                write('''?sort=''')
                _v = VFFSL(SL,"entry",True) # '$entry' on line 173, col 36
                if _v is not None: write(_filter(_v, rawExpr='$entry')) # from line 173, col 36.
                write('''&days=''')
                _v = VFFSL(SL,"days",True) # '$days' on line 173, col 48
                if _v is not None: write(_filter(_v, rawExpr='$days')) # from line 173, col 48.
                write('''" class="navbar" title="">''')
                _v = VFFSL(SL,"headers",True)[VFFSL(SL,"entry",True)] # '$headers[$entry]' on line 173, col 79
                if _v is not None: write(_filter(_v, rawExpr='$headers[$entry]')) # from line 173, col 79.
                write('''</a>
''')
            elif VFFSL(SL,"sort",True): # generated from line 174, col 5
                write('''            <a href="''')
                _v = VFFSL(SL,"section",True) # '$section' on line 175, col 22
                if _v is not None: write(_filter(_v, rawExpr='$section')) # from line 175, col 22.
                write('''?sort=''')
                _v = VFFSL(SL,"entry",True) # '$entry' on line 175, col 36
                if _v is not None: write(_filter(_v, rawExpr='$entry')) # from line 175, col 36.
                write('''" class="navbar" title="">''')
                _v = VFFSL(SL,"headers",True)[VFFSL(SL,"entry",True)] # '$headers[$entry]' on line 175, col 68
                if _v is not None: write(_filter(_v, rawExpr='$headers[$entry]')) # from line 175, col 68.
                write('''</a>
''')
            else: # generated from line 176, col 5
                write('''            ''')
                _v = VFFSL(SL,"headers",True)[VFFSL(SL,"entry",True)] # '$headers[$entry]' on line 177, col 13
                if _v is not None: write(_filter(_v, rawExpr='$headers[$entry]')) # from line 177, col 13.
                write('''
''')
            write('''        </th>
''')
        write('''        <td class="rightkludge"></td>
    </tr>


''')
        #  THE INFORMATION / TABLE
        write('''
''')
        for listitem in VFFSL(SL,"list",True): # generated from line 187, col 1
            write('''    <tr class="''')
            _v = VFFSL(SL,"rowcycler",True) # '$rowcycler' on line 188, col 16
            if _v is not None: write(_filter(_v, rawExpr='$rowcycler')) # from line 188, col 16.
            write('''">
''')
            for entry in VFFSL(SL,"headersList",True): # generated from line 189, col 5
                write('''        <td class="''')
                _v = VFFSL(SL,"cellcycler",True) # '$cellcycler' on line 190, col 20
                if _v is not None: write(_filter(_v, rawExpr='$cellcycler')) # from line 190, col 20.
                write('''">''')
                _v = VFFSL(SL,"listitem",True)[VFFSL(SL,"entry",True)] # '$listitem[$entry]' on line 190, col 33
                if _v is not None: write(_filter(_v, rawExpr='$listitem[$entry]')) # from line 190, col 33.
                write('''</td>
''')
            write('''    </tr>
''')
        write('''</table>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def printSearch(self, **KWS):



        ## CHEETAH: generated from #def printSearch() at line 199, 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('''

<form action="search" method="GET">

<table border=0 cellpadding=0 cellspacing=4>
  <tr>
    <td>
      <select name="searchfield">
''')
        for entry in VFFSL(SL,"searchfields",True): # generated from line 209, col 2
            if VFFSL(SL,"entry",True) == VFFSL(SL,"searchfield",True): # generated from line 210, col 4
                write('''          <option value="''')
                _v = VFFSL(SL,"entry",True) # '$entry' on line 211, col 26
                if _v is not None: write(_filter(_v, rawExpr='$entry')) # from line 211, col 26.
                write('''" selected>''')
                _v = VFFSL(SL,"entry",True) # '$entry' on line 211, col 43
                if _v is not None: write(_filter(_v, rawExpr='$entry')) # from line 211, col 43.
                write('''</option>
''')
            else: # generated from line 212, col 11
                write('''          <option value="''')
                _v = VFFSL(SL,"entry",True) # '$entry' on line 213, col 26
                if _v is not None: write(_filter(_v, rawExpr='$entry')) # from line 213, col 26.
                write('''">''')
                _v = VFFSL(SL,"entry",True) # '$entry' on line 213, col 34
                if _v is not None: write(_filter(_v, rawExpr='$entry')) # from line 213, col 34.
                write('''</option>
''')
        write('''      </select>
      = <input type="text" name="searchtext" value=\'''')
        _v = VFFSL(SL,"searchtext",True) # '$searchtext' on line 217, col 53
        if _v is not None: write(_filter(_v, rawExpr='$searchtext')) # from line 217, col 53.
        write('''\' size="20">
    </td>
  </tr>

  <tr>
    <td>
''')
        for item in VFFSL(SL,"statusfields",True): # generated from line 223, col 7
            if VFFSL(SL,"item",True) == VFFSL(SL,"status",True): # generated from line 224, col 9
                write("""          <input type='radio' name='status' value='""")
                _v = VFFSL(SL,"item",True) # '$item' on line 225, col 52
                if _v is not None: write(_filter(_v, rawExpr='$item')) # from line 225, col 52.
                write("""' checked>""")
                _v = VFFSL(SL,"item",True) # '$item' on line 225, col 67
                if _v is not None: write(_filter(_v, rawExpr='$item')) # from line 225, col 67.
                write('''
''')
            else: # generated from line 226, col 9
                write("""          <input type='radio' name='status' value='""")
                _v = VFFSL(SL,"item",True) # '$item' on line 227, col 52
                if _v is not None: write(_filter(_v, rawExpr='$item')) # from line 227, col 52.
                write("""'>""")
                _v = VFFSL(SL,"item",True) # '$item' on line 227, col 59
                if _v is not None: write(_filter(_v, rawExpr='$item')) # from line 227, col 59.
                write('''
''')
        write("""    </td>
  </tr>

  <tr>
    <td>
      From now and <input type='text' name='days' value='""")
        _v = VFFSL(SL,"days",True) # '$days' on line 235, col 58
        if _v is not None: write(_filter(_v, rawExpr='$days')) # from line 235, col 58.
        write('''\' size=\'4\' maxsize=\'4\'> days back
    </td>
  </tr>

  <tr>
    <td colspan=\'2\'>
      <input type="submit" value="Search">
    </td>
  </tr>

</table>

<input type="hidden" name="action" value="dosearch">
</form>

''')
        if VFFSL(SL,"searchresults",True): # generated from line 250, col 1
            _v = VFFSL(SL,"printList",False)(VFFSL(SL,"headertext",True), VFFSL(SL,"hitstext",True), VFFSL(SL,"searchresults",True), VFFSL(SL,"headersList",True), VFFSL(SL,"headers",True), VFFSL(SL,"hits",True), 1) # '$printList($headertext, $hitstext, $searchresults, $headersList, $headers, $hits, 1)' on line 251, col 1
            if _v is not None: write(_filter(_v, rawExpr='$printList($headertext, $hitstext, $searchresults, $headersList, $headers, $hits, 1)')) # from line 251, col 1.
            write('''
''')
        elif VFFSL(SL,"searchtext",True): # generated from line 252, col 1
            write('''<p>''')
            _v = VFFSL(SL,"headertext",True) # '$headertext' on line 253, col 4
            if _v is not None: write(_filter(_v, rawExpr='$headertext')) # from line 253, col 4.
            write('''</p>
''')
        write('''
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def printAddreason(self, blockreasonheadersList, blockreasonheaders, blockreasons, hits, **KWS):



        ## CHEETAH: generated from #def printAddreason ($blockreasonheadersList, $blockreasonheaders, $blockreasons, $hits) at line 259, 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("""

  <form action='doaddblockreason' method='GET'>
    <input type='text' name='blockreason' size='30'>
    <input type='submit' value='Add reason'>
  </form>


  """)
        _v = VFFSL(SL,"printList",False)(VFFSL(SL,"headertext",True), VFFSL(SL,"hitstext",True), VFFSL(SL,"blockreasons",True), VFFSL(SL,"blockreasonheadersList",True), VFFSL(SL,"blockreasonheaders",True), VFFSL(SL,"hits",True), 1) # '$printList($headertext, $hitstext, $blockreasons, $blockreasonheadersList, $blockreasonheaders, $hits, 1)' on line 269, col 3
        if _v is not None: write(_filter(_v, rawExpr='$printList($headertext, $hitstext, $blockreasons, $blockreasonheadersList, $blockreasonheaders, $hits, 1)')) # from line 269, col 3.
        write('''


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

    def printManualblock(self, reasons, **KWS):



        ## CHEETAH: generated from #def printManualblock($reasons) at line 275, 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("""
<table>

<form action='domanualblock' method='GET'>

  <tr>
    <td>IP-address to block</td>
    <td>Reason</td>
    <td>Comment</td>
    <td>Autoenable</td>
    <td>&nbsp;</td>
  </tr>

  <tr>
    <td><input type='text' name='ipadresse'></td>

    <td>
      <select name='reason'>
""")
        for reason in VFFSL(SL,"reasons",True): # generated from line 295, col 7
            write("""        <option value='""")
            _v = VFFSL(SL,"reason",True)['id'] # "$reason['id']" on line 296, col 24
            if _v is not None: write(_filter(_v, rawExpr="$reason['id']")) # from line 296, col 24.
            write("""'>""")
            _v = VFFSL(SL,"reason",True)['text'] # "$reason['text']" on line 296, col 39
            if _v is not None: write(_filter(_v, rawExpr="$reason['text']")) # from line 296, col 39.
            write('''</option>
''')
        write("""      </select>
    </td>

    <td><input type='text' name='comment'></td>
    <td><input type='text' name='autoenable' size='3'></td>
    <td><input type='submit' value='Block'></td>
  </tr>

</form>

</table>

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

    def addBlocktype(self, blockreasons, **KWS):



        ## CHEETAH: generated from #def addBlocktype($blockreasons) at line 314, 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("""
<small>(Red fields indicates that a value must be entered)</small>

<table border='0'>

<form action='doaddblock' method='GET'>
  <input type='hidden' name='blockid' value='""")
        _v = VFFSL(SL,"blockinfo",True)['blockid'] # "$blockinfo['blockid']" on line 322, col 46
        if _v is not None: write(_filter(_v, rawExpr="$blockinfo['blockid']")) # from line 322, col 46.
        write("""'>

""")
        if VFFSL(SL,"blockinfo",True)['blockid']: # generated from line 324, col 3
            write('''  <tr>
    <td>ID</td>
    <td>''')
            _v = VFFSL(SL,"blockinfo",True)['blockid'] # "$blockinfo['blockid']" on line 327, col 9
            if _v is not None: write(_filter(_v, rawExpr="$blockinfo['blockid']")) # from line 327, col 9.
            write('''</td>
  </tr>
''')
        write("""
  <tr>
    <td class='red'>Title</td>
    <td><input class='blocktype' type='text' name='blocktitle' value='""")
        _v = VFFSL(SL,"blockinfo",True)['blocktitle'] # "$blockinfo['blocktitle']" on line 333, col 71
        if _v is not None: write(_filter(_v, rawExpr="$blockinfo['blocktitle']")) # from line 333, col 71.
        write("""'></td>
  </tr>

  <tr>
    <td>Description</td>
    <td><textarea class='blocktype' name='description'>""")
        _v = VFFSL(SL,"blockinfo",True)['blockdesc'] # "$blockinfo['blockdesc']" on line 338, col 56
        if _v is not None: write(_filter(_v, rawExpr="$blockinfo['blockdesc']")) # from line 338, col 56.
        write("""</textarea></td>
  </tr>

  <tr>
    <td class='red'>Reason</td>
    <td>
      <select class='blocktype' name='reasonid'>
""")
        if VFFSL(SL,"blockinfo",True)['reasonid'] == 0: # generated from line 345, col 2
            write("""\t  <option value='0' selected>--- Select reason ---</option>
""")
        write('''
''')
        for element in VFFSL(SL,"blockreasons",True): # generated from line 349, col 9
            if VFFSL(SL,"blockinfo",True)['reasonid'] == VFFSL(SL,"element",True)['id']: # generated from line 350, col 4
                write("""\t    <option value='""")
                _v = VFFSL(SL,"element",True)['id'] # "$element['id']" on line 351, col 21
                if _v is not None: write(_filter(_v, rawExpr="$element['id']")) # from line 351, col 21.
                write("""' selected>""")
                _v = VFFSL(SL,"element",True)['text'] # "$element['text']" on line 351, col 46
                if _v is not None: write(_filter(_v, rawExpr="$element['text']")) # from line 351, col 46.
                write('''</option>
''')
            else: # generated from line 352, col 4
                write("""\t    <option value='""")
                _v = VFFSL(SL,"element",True)['id'] # "$element['id']" on line 353, col 21
                if _v is not None: write(_filter(_v, rawExpr="$element['id']")) # from line 353, col 21.
                write("""'>""")
                _v = VFFSL(SL,"element",True)['text'] # "$element['text']" on line 353, col 37
                if _v is not None: write(_filter(_v, rawExpr="$element['text']")) # from line 353, col 37.
                write('''</option>
''')
        write('''      </select>
    </td>
  </tr>

''')
        if not VFFSL(SL,"blockinfo",True)['blockid']: # generated from line 360, col 3
            write("""  <tr>
    <td>&nbsp;</td>
    <td>or <input class='blocktype2' type='text' name='newreason' value='-- Create new blockreason --'></td>
  </tr>
""")
        write("""
  <tr>
    <td class='red'>Path to mailfile</td>
    <td><input class='blocktype' type='text' name='mailfile' value='""")
        _v = VFFSL(SL,"blockinfo",True)['mailfile'] # "$blockinfo['mailfile']" on line 369, col 69
        if _v is not None: write(_filter(_v, rawExpr="$blockinfo['mailfile']")) # from line 369, col 69.
        write("""'></td>
  </tr>

  <tr>
    <td>Path to inputfile</td>
    <td><input class='blocktype' type='text' name='inputfile' value='""")
        _v = VFFSL(SL,"blockinfo",True)['inputfile'] # "$blockinfo['inputfile']" on line 374, col 70
        if _v is not None: write(_filter(_v, rawExpr="$blockinfo['inputfile']")) # from line 374, col 70.
        write("""'></td>
  </tr>

  <tr>
    <td>Block pursuit</td>
    <td>
""")
        if VFFSL(SL,"blockinfo",True)['determined'] == 'y': # generated from line 380, col 7
            write("""        <input type='radio' name='pursuit' value='n'>Open on move
        <input type='radio' name='pursuit' value='y' checked>All closed
""")
        else: # generated from line 383, col 7
            write("""        <input type='radio' name='pursuit' value='n' checked>Open on move
        <input type='radio' name='pursuit' value='y'>All closed
""")
        write('''    </td>
  </tr>

  <tr>
    <td>Exponential increase</td>
''')
        if VFFSL(SL,"blockinfo",True)['incremental'] == 'y': # generated from line 392, col 5
            write("""      <td><input type='checkbox' name='eincrease' checked></td>
""")
        else: # generated from line 394, col 5
            write("""      <td><input type='checkbox' name='eincrease'></td>
""")
        write("""  </tr>

  <tr>
    <td class='red'>Block duration</td>
    <td><input size='3' type='text' name='duration' value='""")
        _v = VFFSL(SL,"blockinfo",True)['blocktime'] # "$blockinfo['blocktime']" on line 401, col 60
        if _v is not None: write(_filter(_v, rawExpr="$blockinfo['blocktime']")) # from line 401, col 60.
        write("""'> days</td>
  </tr>

  <tr>
    <td>Active</td>
""")
        if VFFSL(SL,"blockinfo",True)['active'] == 'y': # generated from line 406, col 5
            write("""      <td><input type='checkbox' name='active' checked></td>
""")
        else: # generated from line 408, col 5
            write("""      <td><input type='checkbox' name='active'></td>
""")
        write("""  </tr>

  <tr>
    <td>User</td>
    <td><input type='text' name='user' value='""")
        _v = VFFSL(SL,"blockinfo",True)['userid'] # "$blockinfo['userid']" on line 415, col 47
        if _v is not None: write(_filter(_v, rawExpr="$blockinfo['userid']")) # from line 415, col 47.
        write("""' size='10'></td>
  </tr>

  <tr>
""")
        if VFFSL(SL,"blockinfo",True)['blockid']: # generated from line 419, col 3
            write("""    <td><input type='submit' value='Save changes'></td>
""")
        else : # generated from line 421, col 3
            write("""    <td><input type='submit' value='Make new block'></td>
""")
        write('''    <td>&nbsp;</td>
  </tr>

</form>

</table>

''')
        if VFFSL(SL,"blockinfo",True)['blockid']: # generated from line 431, col 1
            write('''  <p>Last changed ''')
            _v = VFFSL(SL,"blockinfo",True)['lastedited'] # "$blockinfo['lastedited']" on line 432, col 19
            if _v is not None: write(_filter(_v, rawExpr="$blockinfo['lastedited']")) # from line 432, col 19.
            write(''' by ''')
            _v = VFFSL(SL,"blockinfo",True)['lastedituser'] # "$blockinfo['lastedituser']" on line 432, col 47
            if _v is not None: write(_filter(_v, rawExpr="$blockinfo['lastedituser']")) # from line 432, col 47.
            write('''</p>
''')
        write('''
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def additionalCSS(self, **KWS):



        ## CHEETAH: generated from #def additionalCSS () at line 439, 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('''
  ''')
        _v = VFFSL(SL,"default_table_CSS",False)() # '$default_table_CSS()' on line 442, col 3
        if _v is not None: write(_filter(_v, rawExpr='$default_table_CSS()')) # from line 442, col 3.
        write('''

''')
        w = '300px'
        w2 = '278px'
        write('''
<style type="text/css">
  input.blocktype    { width: ''')
        _v = VFFSL(SL,"w",True) # '$w' on line 448, col 31
        if _v is not None: write(_filter(_v, rawExpr='$w')) # from line 448, col 31.
        write(''';  }
  input.blocktype2   { width: ''')
        _v = VFFSL(SL,"w2",True) # '$w2' on line 449, col 31
        if _v is not None: write(_filter(_v, rawExpr='$w2')) # from line 449, col 31.
        write('''; }
  select.blocktype   { width: ''')
        _v = VFFSL(SL,"w",True) # '$w' on line 450, col 31
        if _v is not None: write(_filter(_v, rawExpr='$w')) # from line 450, col 31.
        write(''';  }
  textarea.blocktype { width: ''')
        _v = VFFSL(SL,"w",True) # '$w' on line 451, col 31
        if _v is not None: write(_filter(_v, rawExpr='$w')) # from line 451, col 31.
        write(''';  }
  td.red             { color:red;  }

  p.red             { color: red; }

  .infobox {
    width: 800px;
    font-size: 12px;
    background-color: #eeeeee;
    padding: 0.5em;
    border: 1px solid #cccccc;
    -moz-border-radius: 12px;
  }

  .infobox h5 {
    display: inline;
    margin-top: 0px;
    margin-bottom: 0px;
    border-bottom: 1px solid rgb(51,102,153);
  }
</style>
''')
        
        ########################################
        ## 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
        
        #  Cheetah!
        #  $Id$
        # 
        #  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: John Magne Bredal <john.m.bredal@ntnu.no>
        # 
        write('''



''')
        #  Start of maincontent
        self.content(trans=trans)
        write('''


''')
        #                   Functions                   ##
        write('''


''')
        #  Print the links in the $buttons-array
        write('''

# Generic function that prints a table based on input








''')
        
        ########################################
        ## 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_ArnoldTemplate= 'writeBody'

## END CLASS DEFINITION

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


# 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=ArnoldTemplate()).run()


