#!/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__ = 1225031609.6312909
__CHEETAH_genTimestamp__ = 'Sun Oct 26 14:33:29 2008'
__CHEETAH_src__ = 'StatusTemplate.tmpl'
__CHEETAH_srcLastModified__ = 'Wed Jan 31 12:51:03 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 StatusTemplate(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 #def content at line 30, 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 VFFSL(SL,"prefs",True): # generated from line 31, col 1
            write('''<h2>Status page preferences</h2>
''')
            _v = VFFSL(SL,"displayPrefs",False)(VFFSL(SL,"prefs",True)) # '$displayPrefs($prefs)' on line 33, col 1
            if _v is not None: write(_filter(_v, rawExpr='$displayPrefs($prefs)')) # from line 33, col 1.
            write('''
''')
        write('''
''')
        if VFFSL(SL,"status",True): # generated from line 36, col 1
            write('''<h2>''')
            _v = VFFSL(SL,"status.title",True) # '$status.title' on line 37, col 5
            if _v is not None: write(_filter(_v, rawExpr='$status.title')) # from line 37, col 5.
            write('''</h2>

<table>
''')
            for SectionBox in VFFSL(SL,"status.sections",True): # generated from line 40, col 1
                write('''    ''')
                _v = VFFSL(SL,"displaySectionBox",False)(VFFSL(SL,"SectionBox",True)) # '$displaySectionBox($SectionBox)' on line 41, col 5
                if _v is not None: write(_filter(_v, rawExpr='$displaySectionBox($SectionBox)')) # from line 41, col 5.
                write('''
''')
            write('''</table>
''')
        write('''
''')
        if VFFSL(SL,"history",True): # generated from line 46, col 1
            write('''<h2>''')
            _v = VFFSL(SL,"history.title",True) # '$history.title' on line 47, col 5
            if _v is not None: write(_filter(_v, rawExpr='$history.title')) # from line 47, col 5.
            write('''</h2>
''')
            _v = VFFSL(SL,"displayStatusAction",False)(VFFSL(SL,"history",True)) # '$displayStatusAction($history)' on line 48, col 1
            if _v is not None: write(_filter(_v, rawExpr='$displayStatusAction($history)')) # from line 48, col 1.
            write('''
''')
            _v = VFFSL(SL,"displaySectionBoxes",False)(VFFSL(SL,"history",True)) # '$displaySectionBoxes($history)' on line 49, col 1
            if _v is not None: write(_filter(_v, rawExpr='$displaySectionBoxes($history)')) # from line 49, col 1.
            write('''
''')
        write('''
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def additionalCSS(self, **KWS):



        ## CHEETAH: generated from #def additionalCSS at line 54, 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('''<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>
''')
        _v = VFFSL(SL,"default_table_CSS",False)() # '$default_table_CSS()' on line 65, col 1
        if _v is not None: write(_filter(_v, rawExpr='$default_table_CSS()')) # from line 65, col 1.
        write('''
''')
        _v = VFFSL(SL,"default_form_CSS",False)() # '$default_form_CSS()' on line 66, col 1
        if _v is not None: write(_filter(_v, rawExpr='$default_form_CSS()')) # from line 66, col 1.
        write('''
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def displayStatusAction(self, bar, **KWS):



        ## CHEETAH: generated from #def displayStatusAction($bar) at line 70, 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="''')
        _v = VFFSL(SL,"bar.action",True) # '$bar.action' on line 71, col 19
        if _v is not None: write(_filter(_v, rawExpr='$bar.action')) # from line 71, col 19.
        write('''" method="''')
        _v = VFFSL(SL,"bar.method",True) # '$bar.method' on line 71, col 40
        if _v is not None: write(_filter(_v, rawExpr='$bar.method')) # from line 71, col 40.
        write('''">
''')
        if VFFSL(SL,"bar.selid",True): # generated from line 72, col 1
            write('''        <input type="hidden" name="''')
            _v = VFFSL(SL,"bar.typeCname",True) # '$bar.typeCname' on line 73, col 36
            if _v is not None: write(_filter(_v, rawExpr='$bar.typeCname')) # from line 73, col 36.
            write('''" value="''')
            _v = VFFSL(SL,"bar.seltype",True) # '$bar.seltype' on line 73, col 59
            if _v is not None: write(_filter(_v, rawExpr='$bar.seltype')) # from line 73, col 59.
            write('''">
''')
        write('''        <p>
            ''')
        _v = VFFSL(SL,"bar.typeText",True) # '$bar.typeText' on line 76, col 13
        if _v is not None: write(_filter(_v, rawExpr='$bar.typeText')) # from line 76, col 13.
        write('''
''')
        #  Only show the type select if no special box is selected
        if not VFFSL(SL,"bar.selid",True): # generated from line 78, col 1
            write('''            <select name="''')
            _v = VFFSL(SL,"bar.typeCname",True) # '$bar.typeCname' on line 79, col 27
            if _v is not None: write(_filter(_v, rawExpr='$bar.typeCname')) # from line 79, col 27.
            write('''" onchange="''')
            _v = VFFSL(SL,"bar.onChange",True) # '$bar.onChange' on line 79, col 53
            if _v is not None: write(_filter(_v, rawExpr='$bar.onChange')) # from line 79, col 53.
            write('''">
''')
            for value,option in VFFSL(SL,"bar.typeOptions",True): # generated from line 80, col 1
                if VFFSL(SL,"value",True) == VFFSL(SL,"bar.typeValue",True): # generated from line 81, col 1
                    write('''                <option selected value="''')
                    _v = VFFSL(SL,"value",True) # '$value' on line 82, col 41
                    if _v is not None: write(_filter(_v, rawExpr='$value')) # from line 82, col 41.
                    write('''">''')
                    _v = VFFSL(SL,"option",True) # '$option' on line 82, col 49
                    if _v is not None: write(_filter(_v, rawExpr='$option')) # from line 82, col 49.
                    write('''</option>
''')
                else: # generated from line 83, col 1
                    write('''                <option value="''')
                    _v = VFFSL(SL,"value",True) # '$value' on line 84, col 32
                    if _v is not None: write(_filter(_v, rawExpr='$value')) # from line 84, col 32.
                    write('''">''')
                    _v = VFFSL(SL,"option",True) # '$option' on line 84, col 40
                    if _v is not None: write(_filter(_v, rawExpr='$option')) # from line 84, col 40.
                    write('''</option>
''')
            write('''            </select>
''')
        write('''            ''')
        _v = VFFSL(SL,"bar.daysText",True) # '$bar.daysText' on line 89, col 13
        if _v is not None: write(_filter(_v, rawExpr='$bar.daysText')) # from line 89, col 13.
        write('''
            <select name="''')
        _v = VFFSL(SL,"bar.daysCname",True) # '$bar.daysCname' on line 90, col 27
        if _v is not None: write(_filter(_v, rawExpr='$bar.daysCname')) # from line 90, col 27.
        write('''" onchange="''')
        _v = VFFSL(SL,"bar.onChange",True) # '$bar.onChange' on line 90, col 53
        if _v is not None: write(_filter(_v, rawExpr='$bar.onChange')) # from line 90, col 53.
        write('''">
''')
        for value,option in VFFSL(SL,"bar.daysOptions",True): # generated from line 91, col 1
            if VFFSL(SL,"value",True) == VFFSL(SL,"bar.daysValue",True): # generated from line 92, col 1
                write('''                <option selected value="''')
                _v = VFFSL(SL,"value",True) # '$value' on line 93, col 41
                if _v is not None: write(_filter(_v, rawExpr='$value')) # from line 93, col 41.
                write('''">''')
                _v = VFFSL(SL,"option",True) # '$option' on line 93, col 49
                if _v is not None: write(_filter(_v, rawExpr='$option')) # from line 93, col 49.
                write('''</option>
''')
            else: # generated from line 94, col 1
                write('''                <option value="''')
                _v = VFFSL(SL,"value",True) # '$value' on line 95, col 32
                if _v is not None: write(_filter(_v, rawExpr='$value')) # from line 95, col 32.
                write('''">''')
                _v = VFFSL(SL,"option",True) # '$option' on line 95, col 40
                if _v is not None: write(_filter(_v, rawExpr='$option')) # from line 95, col 40.
                write('''</option>
''')
        write('''            </select>
        </p>                   
''')
        #  Preserve the id when it is specified
        if VFFSL(SL,"bar.selid",True): # generated from line 101, col 1
            write('''        <input type="hidden" name="''')
            _v = VFFSL(SL,"bar.idCname",True) # '$bar.idCname' on line 102, col 36
            if _v is not None: write(_filter(_v, rawExpr='$bar.idCname')) # from line 102, col 36.
            write('''" value="''')
            _v = VFFSL(SL,"bar.selid",True) # '$bar.selid' on line 102, col 57
            if _v is not None: write(_filter(_v, rawExpr='$bar.selid')) # from line 102, col 57.
            write('''">
''')
        write('''    <form>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def displaySectionBoxes(self, page, **KWS):



        ## CHEETAH: generated from #def displaySectionBoxes($page) at line 111, 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>
''')
        for section in VFFSL(SL,"page.sections",True): # generated from line 113, col 5
            write('''        ''')
            _v = VFFSL(SL,"listSectionRows",False)(VFFSL(SL,"section",True)) # '$listSectionRows($section)' on line 114, col 9
            if _v is not None: write(_filter(_v, rawExpr='$listSectionRows($section)')) # from line 114, col 9.
            write('''
''')
        write('''</table>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def listSectionRows(self, SectionBox, **KWS):



        ## CHEETAH: generated from #def listSectionRows($SectionBox) at line 120, 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('''<tr><td>

<table class="horiztable" style="width: 100%;">
    <caption id="''')
        _v = VFFSL(SL,"SectionBox.controlBaseName",True) # '$SectionBox.controlBaseName' on line 124, col 18
        if _v is not None: write(_filter(_v, rawExpr='$SectionBox.controlBaseName')) # from line 124, col 18.
        write('''">
        <span class="cornerkludge"></span>
        ''')
        _v = VFFSL(SL,"SectionBox.title",True) # '$SectionBox.title' on line 126, col 9
        if _v is not None: write(_filter(_v, rawExpr='$SectionBox.title')) # from line 126, col 9.
        write('''
    </caption>

    <tr class="header">
        <td class="leftkludge"></td>
''')
        for heading, url, style, id in VFFSL(SL,"SectionBox.headings",True): # generated from line 131, col 1
            if VFFSL(SL,"url",True): # generated from line 132, col 1
                write('''        <th><a href="''')
                _v = VFN(VFFSL(SL,"url",True),"replace",False)('&', '&amp;') # "$url.replace('&', '&amp;')" on line 133, col 22
                if _v is not None: write(_filter(_v, rawExpr="$url.replace('&', '&amp;')")) # from line 133, col 22.
                write('''">''')
                _v = VFFSL(SL,"heading",True) # '$heading' on line 133, col 50
                if _v is not None: write(_filter(_v, rawExpr='$heading')) # from line 133, col 50.
                write('''</a></th>
''')
            else: # generated from line 134, col 1
                write('''        <th>''')
                _v = VFFSL(SL,"heading",True) # '$heading' on line 135, col 13
                if _v is not None: write(_filter(_v, rawExpr='$heading')) # from line 135, col 13.
                write('''</th>
''')
        write('''        <td class="rightkludge"></td>
    </tr>

''')
        for row in VFFSL(SL,"SectionBox.rows",True): # generated from line 141, col 1
            write('''    <tr class="''')
            _v = VFFSL(SL,"rowcycler",True) # '$rowcycler' on line 142, col 16
            if _v is not None: write(_filter(_v, rawExpr='$rowcycler')) # from line 142, col 16.
            write('''">
        <td style="background: white;"></td>
''')
            #  $row[0] is sort data
            row = row[1]
            for data, url, image, style in VFFSL(SL,"row",True): # generated from line 146, col 1
                write('''        <td class="''')
                _v = VFFSL(SL,"style",True) # '$style' on line 147, col 20
                if _v is not None: write(_filter(_v, rawExpr='$style')) # from line 147, col 20.
                write('''">
''')
                if VFFSL(SL,"url",True): # generated from line 148, col 1
                    write('''            <a href="''')
                    _v = VFN(VFFSL(SL,"url",True),"replace",False)('&', '&amp;') # "$url.replace('&', '&amp;')" on line 149, col 22
                    if _v is not None: write(_filter(_v, rawExpr="$url.replace('&', '&amp;')")) # from line 149, col 22.
                    write('''">
''')
                if VFFSL(SL,"image",True): # generated from line 151, col 1
                    write('''            <img border="0" title="''')
                    _v = VFFSL(SL,"image",True)[1] # '$image[1]' on line 152, col 36
                    if _v is not None: write(_filter(_v, rawExpr='$image[1]')) # from line 152, col 36.
                    write('''" src="''')
                    _v = VFFSL(SL,"image",True)[0] # '$image[0]' on line 152, col 52
                    if _v is not None: write(_filter(_v, rawExpr='$image[0]')) # from line 152, col 52.
                    write('''" />
''')
                write('''            ''')
                _v = VFFSL(SL,"data",True) # '$data' on line 154, col 13
                if _v is not None: write(_filter(_v, rawExpr='$data')) # from line 154, col 13.
                write('''
''')
                if VFFSL(SL,"url",True): # generated from line 155, col 1
                    write('''            </a>
''')
                write('''        </td>
''')
            write('''        <td style="background: white;"></td>
    </tr>
''')
        write('''</table>

</td></tr>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def displaySectionBox(self, SectionBox, **KWS):



        ## CHEETAH: generated from #def displaySectionBox($SectionBox) at line 169, 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
        
        colscount = len(VFFSL(SL,"SectionBox.headings",True))
        write('''<tr><td>

<table id="''')
        _v = VFFSL(SL,"SectionBox.controlBaseName",True) # '$SectionBox.controlBaseName' on line 173, col 12
        if _v is not None: write(_filter(_v, rawExpr='$SectionBox.controlBaseName')) # from line 173, col 12.
        write('''" class="horiztable" style="width: 100%;">

    <caption>
        <span class="cornerkludge"></span>
        ''')
        _v = VFFSL(SL,"SectionBox.title",True) # '$SectionBox.title' on line 177, col 9
        if _v is not None: write(_filter(_v, rawExpr='$SectionBox.title')) # from line 177, col 9.
        write('''
''')
        for url, text in VFFSL(SL,"SectionBox.historyLink",True): # generated from line 178, col 5
            write('''        (<a href="''')
            _v = VFN(VFFSL(SL,"url",True),"replace",False)('&', '&amp;') # "$url.replace('&', '&amp;')" on line 179, col 19
            if _v is not None: write(_filter(_v, rawExpr="$url.replace('&', '&amp;')")) # from line 179, col 19.
            write('''">''')
            _v = VFFSL(SL,"text",True) # '$text' on line 179, col 47
            if _v is not None: write(_filter(_v, rawExpr='$text')) # from line 179, col 47.
            write('''</a>)
''')
        write('''        <br />
        <span class="subtitle">''')
        _v = VFFSL(SL,"SectionBox.summary",True) # '$SectionBox.summary' on line 182, col 32
        if _v is not None: write(_filter(_v, rawExpr='$SectionBox.summary')) # from line 182, col 32.
        write('''</span>
    </caption>

    <tr class="header">
        <td class="leftkludge"></td>
''')
        for heading, url, style, id in VFFSL(SL,"SectionBox.headings",True): # generated from line 187, col 1
            if VFFSL(SL,"url",True): # generated from line 188, col 1
                write('''        <th><a href="''')
                _v = VFN(VFFSL(SL,"url",True),"replace",False)('&', '&amp;') # "$url.replace('&', '&amp;')" on line 189, col 22
                if _v is not None: write(_filter(_v, rawExpr="$url.replace('&', '&amp;')")) # from line 189, col 22.
                write('''">''')
                _v = VFFSL(SL,"heading",True) # '$heading' on line 189, col 50
                if _v is not None: write(_filter(_v, rawExpr='$heading')) # from line 189, col 50.
                write('''</a></th>
''')
            else: # generated from line 190, col 1
                write('''        <th>''')
                _v = VFFSL(SL,"heading",True) # '$heading' on line 191, col 13
                if _v is not None: write(_filter(_v, rawExpr='$heading')) # from line 191, col 13.
                write('''</th>
''')
        write('''        <td class="rightkludge"></td>
    </tr>

''')
        for row in VFFSL(SL,"SectionBox.rows",True): # generated from line 197, col 1
            #  $row[0] is data for sorting
            row = VFFSL(SL,"row",True)[1]
            write('''    <tr class="''')
            _v = VFFSL(SL,"rowcycler",True) # '$rowcycler' on line 200, col 16
            if _v is not None: write(_filter(_v, rawExpr='$rowcycler')) # from line 200, col 16.
            write('''">
        <td style="background: white;"></td>
''')
            for col in VFFSL(SL,"row",True): # generated from line 202, col 1
                data = VFFSL(SL,"col",True)[0]
                url = VFFSL(SL,"col",True)[1]
                image = VFFSL(SL,"col",True)[2]
                style = VFFSL(SL,"col",True)[3]
                write('''        <td class="''')
                _v = VFFSL(SL,"style",True) # '$style' on line 207, col 20
                if _v is not None: write(_filter(_v, rawExpr='$style')) # from line 207, col 20.
                write('''">
''')
                if VFFSL(SL,"url",True): # generated from line 208, col 1
                    write('''            <a href="''')
                    _v = VFN(VFFSL(SL,"url",True),"replace",False)('&', '&amp;') # "$url.replace('&', '&amp;')" on line 209, col 22
                    if _v is not None: write(_filter(_v, rawExpr="$url.replace('&', '&amp;')")) # from line 209, col 22.
                    write('''">
''')
                if VFFSL(SL,"image",True): # generated from line 211, col 1
                    write('''            <img title="''')
                    _v = VFFSL(SL,"image",True)[1] # '$image[1]' on line 212, col 25
                    if _v is not None: write(_filter(_v, rawExpr='$image[1]')) # from line 212, col 25.
                    write('''" alt="''')
                    _v = VFFSL(SL,"image",True)[1] # '$image[1]' on line 212, col 41
                    if _v is not None: write(_filter(_v, rawExpr='$image[1]')) # from line 212, col 41.
                    write('''" src="''')
                    _v = VFFSL(SL,"image",True)[0] # '$image[0]' on line 212, col 57
                    if _v is not None: write(_filter(_v, rawExpr='$image[0]')) # from line 212, col 57.
                    write('''" />
''')
                write('''            ''')
                _v = VFFSL(SL,"data",True) # '$data' on line 214, col 13
                if _v is not None: write(_filter(_v, rawExpr='$data')) # from line 214, col 13.
                write('''
''')
                if VFFSL(SL,"url",True): # generated from line 215, col 1
                    write('''            </a>
''')
                write('''        </td>
''')
            write('''        <td style="background: white;"></td>
    </tr>
''')
        write('''</table>

</td></tr>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def displayPrefs(self, prefsPage, **KWS):



        ## CHEETAH: generated from #def displayPrefs($prefsPage) at line 229, 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
        
        #  move this from template to StatusPrefs.py
        write('''<p>
Add, delete or rearrange sections on your status page.
</p>

<form action="''')
        _v = VFFSL(SL,"prefsPage.formAction",True) # '$prefsPage.formAction' on line 235, col 15
        if _v is not None: write(_filter(_v, rawExpr='$prefsPage.formAction')) # from line 235, col 15.
        write('''" method="post">

<table class="header-inactive">
<tr>
<th style="width: 10px;">&nbsp;</th><th>Name</th><th>Filter</th>
</tr>

''')
        for editSection in VFFSL(SL,"prefsPage.editSectionBoxes",True): # generated from line 242, col 1
            _v = VFFSL(SL,"displayEditSectionBox",False)(VFFSL(SL,"editSection",True),VFFSL(SL,"prefsPage.radioButtonName",True)) # '$displayEditSectionBox($editSection,$prefsPage.radioButtonName)' on line 243, col 1
            if _v is not None: write(_filter(_v, rawExpr='$displayEditSectionBox($editSection,$prefsPage.radioButtonName)')) # from line 243, col 1.
            write('''
''')
        write('''
''')
        #  action bar
        write('''<tr>
<td colspan="3">
<input type="submit" name="''')
        _v = VFFSL(SL,"prefsPage.actionBarUpName",True) # '$prefsPage.actionBarUpName' on line 249, col 28
        if _v is not None: write(_filter(_v, rawExpr='$prefsPage.actionBarUpName')) # from line 249, col 28.
        write('''" value="Move selected section up">
<input type="submit" name="''')
        _v = VFFSL(SL,"prefsPage.actionBarDelName",True) # '$prefsPage.actionBarDelName' on line 250, col 28
        if _v is not None: write(_filter(_v, rawExpr='$prefsPage.actionBarDelName')) # from line 250, col 28.
        write('''" value="Delete selected section">
</td>
</tr>

</table>

''')
        #  addbar
        write('''    <p>
        <h3>Add new section</h3>
        <table>
            <tr>
                <td>''')
        _v = VFFSL(SL,"prefsPage.addBarTitle",True) # '$prefsPage.addBarTitle' on line 261, col 21
        if _v is not None: write(_filter(_v, rawExpr='$prefsPage.addBarTitle')) # from line 261, col 21.
        write('''</td>
                <td>
                    <SELECT name="''')
        _v = VFFSL(SL,"prefsPage.addBarSelectName",True) # '$prefsPage.addBarSelectName' on line 263, col 35
        if _v is not None: write(_filter(_v, rawExpr='$prefsPage.addBarSelectName')) # from line 263, col 35.
        write('''">
''')
        for value,text in VFFSL(SL,"prefsPage.addBarSelectOptions",True): # generated from line 264, col 1
            write('''                    <OPTION value="''')
            _v = VFFSL(SL,"value",True) # '$value' on line 265, col 36
            if _v is not None: write(_filter(_v, rawExpr='$value')) # from line 265, col 36.
            write('''">''')
            _v = VFFSL(SL,"text",True) # '$text' on line 265, col 44
            if _v is not None: write(_filter(_v, rawExpr='$text')) # from line 265, col 44.
            write('''</OPTION>
''')
        write('''                    </SELECT>
                </td>
                <td><input type="submit" name="''')
        _v = VFFSL(SL,"prefsPage.addBarSubmitName",True) # '$prefsPage.addBarSubmitName' on line 269, col 48
        if _v is not None: write(_filter(_v, rawExpr='$prefsPage.addBarSubmitName')) # from line 269, col 48.
        write('''" value="Add"></td>
            </tr>
            <tr>
                <td colspan="3">
                    <input type="submit" name="''')
        _v = VFFSL(SL,"prefsPage.addBarSaveName",True) # '$prefsPage.addBarSaveName' on line 273, col 48
        if _v is not None: write(_filter(_v, rawExpr='$prefsPage.addBarSaveName')) # from line 273, col 48.
        write('''" value="Save">
                </td>
            </tr>
        </table>
    </p>
''')
        if VFFSL(SL,"prefsPage.isAdmin",True): # generated from line 278, col 1
            write('''    <p>
        <h3>''')
            _v = VFFSL(SL,"prefsPage.adminHeader",True) # '$prefsPage.adminHeader' on line 280, col 13
            if _v is not None: write(_filter(_v, rawExpr='$prefsPage.adminHeader')) # from line 280, col 13.
            write('''</h3>
        <p>''')
            _v = VFFSL(SL,"prefsPage.adminHelp",True) # '$prefsPage.adminHelp' on line 281, col 12
            if _v is not None: write(_filter(_v, rawExpr='$prefsPage.adminHelp')) # from line 281, col 12.
            write('''</p>
        <p>
        <input type="submit" name="''')
            _v = VFFSL(SL,"prefsPage.addBarSaveDefName",True) # '$prefsPage.addBarSaveDefName' on line 283, col 36
            if _v is not None: write(_filter(_v, rawExpr='$prefsPage.addBarSaveDefName')) # from line 283, col 36.
            write('''" value="''')
            _v = VFFSL(SL,"prefsPage.adminButton",True) # '$prefsPage.adminButton' on line 283, col 73
            if _v is not None: write(_filter(_v, rawExpr='$prefsPage.adminButton')) # from line 283, col 73.
            write('''">
    </p>
''')
        write('''</form>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def displayEditSectionBox(self, editSectionBox, radioButtonName, **KWS):



        ## CHEETAH: generated from #def displayEditSectionBox($editSectionBox,$radioButtonName) at line 289, 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('''<tr>
<td class=header-active><input type="radio" name="''')
        _v = VFFSL(SL,"radioButtonName",True) # '$radioButtonName' on line 291, col 51
        if _v is not None: write(_filter(_v, rawExpr='$radioButtonName')) # from line 291, col 51.
        write('''" value="''')
        _v = VFFSL(SL,"editSectionBox.controlBaseName",True) # '$editSectionBox.controlBaseName' on line 291, col 76
        if _v is not None: write(_filter(_v, rawExpr='$editSectionBox.controlBaseName')) # from line 291, col 76.
        write('''"></td>
<td class=header-active>''')
        _v = VFFSL(SL,"editSectionBox.name",True) # '$editSectionBox.name' on line 292, col 25
        if _v is not None: write(_filter(_v, rawExpr='$editSectionBox.name')) # from line 292, col 25.
        write('''<br><input type="text" value="''')
        _v = VFFSL(SL,"editSectionBox.title",True) # '$editSectionBox.title' on line 292, col 75
        if _v is not None: write(_filter(_v, rawExpr='$editSectionBox.title')) # from line 292, col 75.
        write('''" name="''')
        _v = VFFSL(SL,"editSectionBox.controlBaseName",True) # '$editSectionBox.controlBaseName' on line 292, col 104
        if _v is not None: write(_filter(_v, rawExpr='$editSectionBox.controlBaseName')) # from line 292, col 104.
        write('''"></td>
<td class=header-active>
<table class=header-active cellpadding=5%>
<tr>
''')
        for heading in VFFSL(SL,"editSectionBox.filterHeadings",True): # generated from line 296, col 1
            write('''<th>''')
            _v = VFFSL(SL,"heading",True) # '$heading' on line 297, col 5
            if _v is not None: write(_filter(_v, rawExpr='$heading')) # from line 297, col 5.
            write('''</th>
''')
        write('''</tr>

<tr>
''')
        for select in VFFSL(SL,"editSectionBox.filterSelects",True): # generated from line 302, col 1
            write('''<td align="center"> 
''')
            control = VFFSL(SL,"select",True)[0]
            selects = VFFSL(SL,"select",True)[1]
            write('''<select size=4 multiple name="''')
            _v = VFFSL(SL,"control",True) # '$control' on line 306, col 31
            if _v is not None: write(_filter(_v, rawExpr='$control')) # from line 306, col 31.
            write('''">
''')
            for value,option,selected in VFFSL(SL,"selects",True): # generated from line 307, col 1
                write('''
''')
                if VFFSL(SL,"selected",True): # generated from line 309, col 1
                    write('''<option value="''')
                    _v = VFFSL(SL,"value",True) # '$value' on line 310, col 16
                    if _v is not None: write(_filter(_v, rawExpr='$value')) # from line 310, col 16.
                    write('''" selected>''')
                    _v = VFFSL(SL,"option",True) # '$option' on line 310, col 33
                    if _v is not None: write(_filter(_v, rawExpr='$option')) # from line 310, col 33.
                    write('''</option>
''')
                else: # generated from line 311, col 1
                    write('''<option value="''')
                    _v = VFFSL(SL,"value",True) # '$value' on line 312, col 16
                    if _v is not None: write(_filter(_v, rawExpr='$value')) # from line 312, col 16.
                    write('''">''')
                    _v = VFFSL(SL,"option",True) # '$option' on line 312, col 24
                    if _v is not None: write(_filter(_v, rawExpr='$option')) # from line 312, col 24.
                    write('''</option>
''')
                write('''
''')
            write('''</select>
</td>
''')
        write('''</tr>

</table>
</td>
</tr>
''')
        
        ########################################
        ## 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: 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ørgen Hoel <hansjorg@orakel.ntnu.no>
        # 
        write('''



''')
        #  This function show the select bar (type=boxes|services|?,days=1-?)
        write('''
''')
        #  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)
        write('''
''')
        #  This renders the rows in a sectionbox
        write('''
''')
        #  This renders each sectionbox
        write('''
''')
        #  This renders the preferences page
        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_StatusTemplate= 'writeBody'

## END CLASS DEFINITION

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


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


