#!/usr/bin/env python




##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
    import builtins as builtin
except ImportError:
    import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
from Cheetah.Template import Template
from Cheetah.DummyTransaction import *
from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
from Cheetah.CacheRegion import CacheRegion
import Cheetah.Filters as Filters
import Cheetah.ErrorCatchers as ErrorCatchers

##################################################
## MODULE CONSTANTS
VFFSL=valueFromFrameOrSearchList
VFSL=valueFromSearchList
VFN=valueForName
currentTime=time.time
__CHEETAH_version__ = '2.4.4'
__CHEETAH_versionTuple__ = (2, 4, 4, 'development', 0)
__CHEETAH_genTime__ = 1364979193.596823
__CHEETAH_genTimestamp__ = 'Wed Apr  3 17:53:13 2013'
__CHEETAH_src__ = '/home/fermi/Work/Model/tmsingle/openpli3.0/build-tmsingle/tmp/work/mips32el-oe-linux/enigma2-plugin-extensions-openwebif-0.1+git1+279a2577c3bc6defebd4bf9e61a046dcf7f37c01-r0.72/git/plugin/controllers/views/ajax/channels.tmpl'
__CHEETAH_srcLastModified__ = 'Wed Apr  3 17:10:17 2013'
__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 channels(Template):

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


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

        super(channels, self).__init__(*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 respond(self, trans=None):



        ## CHEETAH: main method generated for this template
        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
        
        for channel in VFFSL(SL,"channels",True): # generated from line 1, col 1
            write(u'''\t\t\t<table width="100%">
\t\t\t\t<tbody>
\t\t\t\t\t<tr class="channel_tr">\t
\t\t\t\t\t\t<div style="padding-top: 3px">\t\t\t\t\t\t\t\t
\t\t\t\t\t\t<div style="border-top: 1px dotted #4297d7;">\t\t\t\t\t
\t\t\t\t\t\t<div class="channel_left">
''')
            name = VFN(VFFSL(SL,"channel.name",True),"replace",False)("'", r"\'")
            write(u'''\t\t\t\t\t\t\t<a href="#" onclick="zapChannel(\'''')
            _v = VFFSL(SL,"channel.ref",True) # u'$channel.ref' on line 9, col 41
            if _v is not None: write(_filter(_v, rawExpr=u'$channel.ref')) # from line 9, col 41.
            write(u"""', '""")
            _v = VFFSL(SL,"name",True) # u'$name' on line 9, col 57
            if _v is not None: write(_filter(_v, rawExpr=u'$name')) # from line 9, col 57.
            write(u'''\'); return false" title="Zap to ''')
            _v = VFFSL(SL,"channel.name",True) # u'$channel.name' on line 9, col 94
            if _v is not None: write(_filter(_v, rawExpr=u'$channel.name')) # from line 9, col 94.
            write(u'''">''')
            _v = VFFSL(SL,"channel.name",True) # u'$channel.name' on line 9, col 109
            if _v is not None: write(_filter(_v, rawExpr=u'$channel.name')) # from line 9, col 109.
            write(u'''</a><br />
\t\t\t\t\t\t</div>
\t\t\t\t\t\t<div class="channel_right">
\t\t\t\t\t\t\t<a href="#" onclick="open_epg_pop(\'''')
            _v = VFFSL(SL,"channel.ref",True) # u'$channel.ref' on line 12, col 43
            if _v is not None: write(_filter(_v, rawExpr=u'$channel.ref')) # from line 12, col 43.
            write(u'''\')">
\t\t\t\t\t\t\t<img src="../images/ico_epg.png" title="Show EPG for ''')
            _v = VFFSL(SL,"channel.name",True) # u'$channel.name' on line 13, col 61
            if _v is not None: write(_filter(_v, rawExpr=u'$channel.name')) # from line 13, col 61.
            write(u'''" border="0">
\t\t\t\t\t\t\t</a>
\t\t\t\t\t\t\t<a target="_blank" href=\'/web/stream.m3u?ref=''')
            _v = VFFSL(SL,"channel.ref",True) # u'$channel.ref' on line 15, col 53
            if _v is not None: write(_filter(_v, rawExpr=u'$channel.ref')) # from line 15, col 53.
            write(u'''&name=''')
            _v = VFFSL(SL,"channel.name",True) # u'$channel.name' on line 15, col 71
            if _v is not None: write(_filter(_v, rawExpr=u'$channel.name')) # from line 15, col 71.
            write(u'''\'>
\t\t\t\t\t\t\t<img align="top" src="../images/ico_stream.png" title="Stream ''')
            _v = VFFSL(SL,"channel.name",True) # u'$channel.name' on line 16, col 70
            if _v is not None: write(_filter(_v, rawExpr=u'$channel.name')) # from line 16, col 70.
            write(u'''" border="0">
\t\t\t\t\t\t\t</a>
\t\t\t\t\t\t</div>
\t\t\t\t\t
''')
            if VFN(VFFSL(SL,"channel",True),"has_key",False)('now_title'): # generated from line 20, col 1
                write(u'''\t\t\t\t\t\t\t\t\t\t\t\t
\t\t\t\t\t\t<div class="channel_left">
\t\t\t\t\t\t<div style="margin-bottom: 2px">\t\t\t\t\t\t
\t\t\t\t\t\t\t''')
                _v = VFFSL(SL,"channel.now_begin",True) # u'$channel.now_begin' on line 24, col 8
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.now_begin')) # from line 24, col 8.
                write(u''' - ''')
                _v = VFFSL(SL,"channel.now_end",True) # u'$channel.now_end' on line 24, col 29
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.now_end')) # from line 24, col 29.
                write(u''' &nbsp;&nbsp;&nbsp;
\t\t\t\t\t\t<a href=\'#\' onClick="toggle_chan_des(\'''')
                _v = VFFSL(SL,"channel.now_ev_id",True) # u'$channel.now_ev_id' on line 25, col 45
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.now_ev_id')) # from line 25, col 45.
                write(u"""', '""")
                _v = VFFSL(SL,"channel.ref",True) # u'$channel.ref' on line 25, col 67
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.ref')) # from line 25, col 67.
                write(u"""', '""")
                _v = VFFSL(SL,"channel.now_idp",True) # u'$channel.now_idp' on line 25, col 83
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.now_idp')) # from line 25, col 83.
                write(u'''\'); return false" title="''')
                _v = VFFSL(SL,"channel.now_title",True) # u'$channel.now_title' on line 25, col 124
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.now_title')) # from line 25, col 124.
                write(u''' description">''')
                _v = VFFSL(SL,"channel.now_title",True) # u'$channel.now_title' on line 25, col 156
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.now_title')) # from line 25, col 156.
                write(u'''</a>
\t\t\t\t\t\t</div>
\t\t\t\t\t\t</div>
\t\t\t\t\t\t<div class="channel_right">
\t\t\t\t\t\t\t+''')
                _v = VFFSL(SL,"channel.now_left",True) # u'$channel.now_left' on line 29, col 9
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.now_left')) # from line 29, col 9.
                write(u''' min
\t\t\t\t\t\t</div>
\t\t\t\t\t\t<div class="channel_desc" id="''')
                _v = VFFSL(SL,"channel.now_idp",True) # u'$channel.now_idp' on line 31, col 37
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.now_idp')) # from line 31, col 37.
                write(u'''">no description available</div>
\t\t\t\t\t\t<div class="channel_content">
\t\t\t\t\t\t\t<div class="meter-wrap">
\t\t\t\t\t\t\t<div class="meter-value" style="background-color: #F68014; width: ''')
                _v = VFFSL(SL,"channel.progress",True) # u'${channel.progress}' on line 34, col 74
                if _v is not None: write(_filter(_v, rawExpr=u'${channel.progress}')) # from line 34, col 74.
                write(u'''px;"></div></div>
\t\t\t\t\t\t</div>\t\t\t\t
\t\t\t\t\t\t<div class="channel_left">
\t\t\t\t\t\t\t''')
                _v = VFFSL(SL,"channel.next_begin",True) # u'$channel.next_begin' on line 37, col 8
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.next_begin')) # from line 37, col 8.
                write(u''' - ''')
                _v = VFFSL(SL,"channel.next_end",True) # u'$channel.next_end' on line 37, col 30
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.next_end')) # from line 37, col 30.
                write(u''' &nbsp;&nbsp;&nbsp;
\t\t\t\t\t\t<a href=\'#\' onClick="toggle_chan_des(\'''')
                _v = VFFSL(SL,"channel.next_ev_id",True) # u'$channel.next_ev_id' on line 38, col 45
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.next_ev_id')) # from line 38, col 45.
                write(u"""', '""")
                _v = VFFSL(SL,"channel.ref",True) # u'$channel.ref' on line 38, col 68
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.ref')) # from line 38, col 68.
                write(u"""', '""")
                _v = VFFSL(SL,"channel.next_idp",True) # u'$channel.next_idp' on line 38, col 84
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.next_idp')) # from line 38, col 84.
                write(u'''\'); return false" title="''')
                _v = VFFSL(SL,"channel.next_title",True) # u'$channel.next_title' on line 38, col 126
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.next_title')) # from line 38, col 126.
                write(u''' description">''')
                _v = VFFSL(SL,"channel.next_title",True) # u'$channel.next_title' on line 38, col 159
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.next_title')) # from line 38, col 159.
                write(u'''</a>
\t\t\t\t\t\t</div>\t
\t\t\t\t\t\t<div class="channel_right">
\t\t\t\t\t\t\t''')
                _v = VFFSL(SL,"channel.next_duration",True) # u'$channel.next_duration' on line 41, col 8
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.next_duration')) # from line 41, col 8.
                write(u''' min
\t\t\t\t\t\t</div>\t\t\t\t\t\t\t
\t\t\t\t\t\t<div class="channel_desc" id="''')
                _v = VFFSL(SL,"channel.next_idp",True) # u'$channel.next_idp' on line 43, col 37
                if _v is not None: write(_filter(_v, rawExpr=u'$channel.next_idp')) # from line 43, col 37.
                write(u'''">no description available</div>
\t\t\t\t\t\t</div>
''')
            write(u'''\t\t\t\t\t</tr>
\t\t\t\t</tbody>
\t\t\t</table>
''')
        write(u'''
''')
        
        ########################################
        ## 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_channels= 'respond'

## END CLASS DEFINITION

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


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


