#!/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
from Plugins.Extensions.OpenWebif.controllers.i18n import tstrings

##################################################
## 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__ = 1644596121.721532
__CHEETAH_genTimestamp__ = 'Fri Feb 11 16:15:21 2022'
__CHEETAH_src__ = '/home/nonsolosat/openpli-dreambox-oe-core/build/tmp/work/dm520-oe-linux/enigma2-plugin-extensions-openwebif/gitAUTOINC+81b15e17ab-r0/git/plugin/controllers/views/responsive/ajax/config.tmpl'
__CHEETAH_srcLastModified__ = 'Fri Feb 11 15:59:45 2022'
__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 config(Template):

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


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

        super(config, 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 select(self, config, **KWS):



        ## CHEETAH: generated from #def select($config) at line 3, 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(u'''
<div class="row clearfix">
\t<div class="col-xs-5 align-right">
\t\t<label>''')
        _v = VFFSL(SL,"config.description",True) # u'$config.description' on line 7, col 10
        if _v is not None: write(_filter(_v, rawExpr=u'$config.description')) # from line 7, col 10.
        write(u'''</label>
\t</div>
\t<div class="col-xs-7 col-md-3">
\t\t<select class="form-control show-tick" id="''')
        _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 10, col 46
        if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 10, col 46.
        write(u'''" onchange="saveConfig(\'''')
        _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 10, col 82
        if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 10, col 82.
        write(u'''\', this.value);">
''')
        for choice in VFFSL(SL,"config.data.choices",True): # generated from line 11, col 4
            if VFFSL(SL,"config.data.current",True) == VFFSL(SL,"choice",True)[0]: # generated from line 12, col 5
                write(u'''\t\t\t\t\t<option value="''')
                _v = VFFSL(SL,"choice",True)[0] # u'$choice[0]' on line 13, col 21
                if _v is not None: write(_filter(_v, rawExpr=u'$choice[0]')) # from line 13, col 21.
                write(u'''" selected="true">''')
                _v = VFFSL(SL,"choice",True)[1] # u'$choice[1]' on line 13, col 49
                if _v is not None: write(_filter(_v, rawExpr=u'$choice[1]')) # from line 13, col 49.
                write(u'''</option>
''')
            else: # generated from line 14, col 5
                write(u'''\t\t\t\t\t<option value="''')
                _v = VFFSL(SL,"choice",True)[0] # u'$choice[0]' on line 15, col 21
                if _v is not None: write(_filter(_v, rawExpr=u'$choice[0]')) # from line 15, col 21.
                write(u'''">''')
                _v = VFFSL(SL,"choice",True)[1] # u'$choice[1]' on line 15, col 33
                if _v is not None: write(_filter(_v, rawExpr=u'$choice[1]')) # from line 15, col 33.
                write(u'''</option>
''')
        write(u'''\t\t</select>
\t</div>
</div>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def checkbox(self, config, **KWS):



        ## CHEETAH: generated from #def checkbox($config) at line 23, 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(u'''<div class="row clearfix">
\t<div class="col-xs-5 align-right">
\t\t<label>''')
        _v = VFFSL(SL,"config.description",True) # u'$config.description' on line 26, col 10
        if _v is not None: write(_filter(_v, rawExpr=u'$config.description')) # from line 26, col 10.
        write(u'''</label>
\t</div>
\t<div class="col-xs-7">
\t\t\t<div class="switch switch-col-indigo">
''')
        if VFFSL(SL,"config.data.current",True): # generated from line 30, col 3
            write(u'''\t\t\t\t<label>
\t\t\t\t\t<input type="checkbox" name="''')
            _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 32, col 35
            if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 32, col 35.
            write(u'''" id="''')
            _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 32, col 53
            if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 32, col 53.
            write(u'''" checked="checked" onclick="saveConfig(\'''')
            _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 32, col 106
            if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 32, col 106.
            write(u'''\', this.checked);">
\t\t\t\t\t<span class=\'lever switch--skinned\'></span>
\t\t\t\t</label>
''')
        else: # generated from line 35, col 3
            write(u'''\t\t\t\t<label>
\t\t\t\t\t<input type="checkbox" name="''')
            _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 37, col 35
            if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 37, col 35.
            write(u'''" id="''')
            _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 37, col 53
            if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 37, col 53.
            write(u'''" onclick="saveConfig(\'''')
            _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 37, col 88
            if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 37, col 88.
            write(u'''\', this.checked);">
\t\t\t\t\t<span class=\'lever switch--skinned\'></span>
\t\t\t\t</label>
''')
        write(u'''\t\t\t</div>
\t\t<label for="''')
        _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 42, col 15
        if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 42, col 15.
        write(u'''"></label>
\t</div>
</div>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def multicheckbox(self, config, **KWS):



        ## CHEETAH: generated from #def multicheckbox($config) at line 47, col 1.
        trans = KWS.get("trans")
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
            trans = self.transaction # is None unless self.awake() was called
        if not trans:
            trans = DummyTransaction()
            _dummyTrans = True
        else: _dummyTrans = False
        write = trans.response().write
        SL = self._CHEETAH__searchList
        _filter = self._CHEETAH__currentFilter
        
        ########################################
        ## START - generated method body
        
        write(u'''<div class="row clearfix">
\t<div class="col-xs-5 align-right">
\t\t<label>''')
        _v = VFFSL(SL,"config.description",True) # u'$config.description' on line 50, col 10
        if _v is not None: write(_filter(_v, rawExpr=u'$config.description')) # from line 50, col 10.
        write(u'''</label>
\t</div>
\t<div class="col-xs-7">
''')
        for choice in VFFSL(SL,"config.data.choices",True): # generated from line 53, col 2
            if VFFSL(SL,"choice",True) in VFFSL(SL,"config.data.current",True): # generated from line 54, col 3
                write(u'''\t\t\t<input type="checkbox" name="''')
                _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 55, col 33
                if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 55, col 33.
                write(u'''" id="''')
                _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 55, col 51
                if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 55, col 51.
                write(u'''" class="form-control chk--skinned" onclick="saveConfig(\'''')
                _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 55, col 120
                if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 55, col 120.
                write(u'''\', this.checked);" checked="checked">
''')
            else: # generated from line 56, col 3
                write(u'''\t\t\t<input type="checkbox" name="''')
                _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 57, col 33
                if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 57, col 33.
                write(u'''" id="''')
                _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 57, col 51
                if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 57, col 51.
                write(u'''" class="form-control chk--skinned" onclick="saveConfig(\'''')
                _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 57, col 120
                if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 57, col 120.
                write(u'''\', this.checked);">
''')
            write(u'''\t\t\t<label for="''')
            _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 59, col 16
            if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 59, col 16.
            write(u'''">''')
            _v = VFFSL(SL,"choice",True) # u'$choice' on line 59, col 30
            if _v is not None: write(_filter(_v, rawExpr=u'$choice')) # from line 59, col 30.
            write(u'''</label>
''')
        write(u'''\t</div>
</div>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    def number(self, config, active, **KWS):



        ## CHEETAH: generated from #def number($config, $active) at line 65, 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(u'''<div class="row clearfix">
\t<div class="col-xs-5 align-right">
\t\t<label>''')
        _v = VFFSL(SL,"config.description",True) # u'$config.description' on line 68, col 10
        if _v is not None: write(_filter(_v, rawExpr=u'$config.description')) # from line 68, col 10.
        write(u'''</label>
\t</div>
\t<div class="col-xs-7 col-md-3">
\t\t<div class="form-line">
\t\t\t<input type="number" name="''')
        _v = VFFSL(SL,"config.path",True) # u'${config.path}' on line 72, col 31
        if _v is not None: write(_filter(_v, rawExpr=u'${config.path}')) # from line 72, col 31.
        write(u'''" id="''')
        _v = VFFSL(SL,"config.path",True) # u'${config.path}' on line 72, col 51
        if _v is not None: write(_filter(_v, rawExpr=u'${config.path}')) # from line 72, col 51.
        write(u'''" value="''')
        _v = VFFSL(SL,"config.data.current",True) # u'$config.data.current' on line 72, col 74
        if _v is not None: write(_filter(_v, rawExpr=u'$config.data.current')) # from line 72, col 74.
        write(u'''" placeholder="''')
        _v = VFFSL(SL,"config.data.current",True) # u'$config.data.current' on line 72, col 109
        if _v is not None: write(_filter(_v, rawExpr=u'$config.data.current')) # from line 72, col 109.
        write(u'''" class="form-control inactive" onchange="saveConfig(\'''')
        _v = VFFSL(SL,"config.path",True) # u'$config.path' on line 72, col 183
        if _v is not None: write(_filter(_v, rawExpr=u'$config.path')) # from line 72, col 183.
        write(u'''\', this.value);">
\t\t</div>
\t</div>
</div>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        

    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
        
        write(u'''




<div id="content_main">
''')
        isactive = "active"
        write(u'''\t<div style="display:none" id="thistitleconfig">
\t\t<i class=\'material-icons material-icons-centered\'>settings</i>
\t\t''')
        _v = VFFSL(SL,"tstrings",True)['settings'] # u"$tstrings['settings']" on line 82, col 3
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['settings']")) # from line 82, col 3.
        write(u''' - ''')
        _v = VFFSL(SL,"title",True) # u'$title' on line 82, col 27
        if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 82, col 27.
        write(u'''
\t</div>
\t<div class="form-group" id="configuration">
''')
        for config in VFFSL(SL,"configs",True): # generated from line 85, col 3
            if VFFSL(SL,"config.data.type",True) == "select": # generated from line 86, col 4
                write(u'''\t\t\t\t''')
                _v = VFFSL(SL,"select",False)(VFFSL(SL,"config",True)) # u'$select($config)' on line 87, col 5
                if _v is not None: write(_filter(_v, rawExpr=u'$select($config)')) # from line 87, col 5.
                write(u'''
''')
            elif VFFSL(SL,"config.data.type",True) == "checkbox": # generated from line 88, col 4
                write(u'''\t\t\t\t''')
                _v = VFFSL(SL,"checkbox",False)(VFFSL(SL,"config",True)) # u'$checkbox($config)' on line 89, col 5
                if _v is not None: write(_filter(_v, rawExpr=u'$checkbox($config)')) # from line 89, col 5.
                write(u'''
''')
            elif VFFSL(SL,"config.data.type",True) == "multicheckbox": # generated from line 90, col 4
                write(u'''\t\t\t\t''')
                _v = VFFSL(SL,"multicheckbox",False)(VFFSL(SL,"config",True)) # u'$multicheckbox($config)' on line 91, col 5
                if _v is not None: write(_filter(_v, rawExpr=u'$multicheckbox($config)')) # from line 91, col 5.
                write(u'''
''')
            elif VFFSL(SL,"config.data.type",True) == "number": # generated from line 92, col 4
                write(u'''\t\t\t\t''')
                _v = VFFSL(SL,"number",False)(VFFSL(SL,"config",True), VFFSL(SL,"isactive",True)) # u'$number($config, $isactive)' on line 93, col 5
                if _v is not None: write(_filter(_v, rawExpr=u'$number($config, $isactive)')) # from line 93, col 5.
                write(u'''
''')
                if VFFSL(SL,"isactive",True) == "active": # generated from line 94, col 5
                    isactive = ""
        write(u'''\t</div>
</div>

<script>
\tjQuery("#configtitle").html(jQuery(\'#thistitleconfig\').html());
\tjQuery.AdminBSB.input.activate();
\tjQuery.AdminBSB.select.activate();
</script>
''')
        
        ########################################
        ## 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_config= 'respond'

## END CLASS DEFINITION

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


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


