#!/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__ = 1644610943.974437
__CHEETAH_genTimestamp__ = 'Fri Feb 11 20:22:23 2022'
__CHEETAH_src__ = '/home/nonsolosat/openpli-dreambox-oe-core/build/tmp/work/dm7080-oe-linux/enigma2-plugin-extensions-openwebif/gitAUTOINC+81b15e17ab-r0/git/plugin/controllers/views/responsive/ajax/settings.tmpl'
__CHEETAH_srcLastModified__ = 'Fri Feb 11 20:05:52 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 settings(Template):

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


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

        super(settings, 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
        
        write(u'''
<!-- TODO: move styles to css file -->
<style>
.theme--city-lights #bookmarks button {
  color: #f1f1f1;
  border: 1px solid rgba(241, 241, 241, 0.2);
  background-color: rgba(241, 241, 241, 0.2);
  border-radius: 2px;
}

.theme--city-lights #bookmarks button:hover { 
  background-color: rgba(241,241,241,.3);
}

.theme--city-lights #bookmarks button:active { 
  background-color: rgba(241,241,241,.1);
}

.theme--city-lights #bookmarks a {
  color: #f1f1f1;
}

#bookmarks a {
  color: #f1f1f1;
}

#bookmarks a:focus,
#bookmarks a:hover {
\ttext-decoration: none;
}

#bookmarks button {
  margin: 4px 2px 0 0;
  user-select: none;
  transition-duration: 0.2s;
}

#bookmarks .material-icons-centered {
  font-size: 20px;
  margin: 2px;
}
</style>

<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
\t<div class="card">
\t\t<div class="header">
\t\t\t<div class="row clearfix">
\t\t\t\t<div class="col-xs-12 col-sm-8 col-md-9">
\t\t\t\t\t<h2 id="configtitle"><i class="material-icons material-icons-centered">settings</i>''')
        _v = VFFSL(SL,"tstrings",True)['settings'] # u"$tstrings['settings']" on line 50, col 89
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['settings']")) # from line 50, col 89.
        write(u'''</h2>
\t\t\t\t</div>
\t\t\t\t<div class="col-xs-12 hidden-sm hidden-md hidden-lg hidden-xl">
\t\t\t\t\t<div class="row vti-vspace-20"></div>
\t\t\t\t</div>
\t\t\t\t<div class="col-xs-12 col-sm-4 col-md-3">
\t\t\t\t\t<select id="settingselection" class="form-control">
\t\t\t\t\t\t<option value="packagemenu">''')
        _v = VFFSL(SL,"tstrings",True)['packages'] # u"$tstrings['packages']" on line 57, col 35
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['packages']")) # from line 57, col 35.
        write(u'''</option>
\t\t\t\t\t\t<option value="bookmarksmenu">''')
        _v = VFFSL(SL,"tstrings",True)['bookmarks'] # u"$tstrings['bookmarks']" on line 58, col 37
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['bookmarks']")) # from line 58, col 37.
        write(u'''</option>
''')
        for sec in VFFSL(SL,"configsections",True): # generated from line 59, col 5
            write(u'''\t\t\t\t\t<option value="''')
            _v = VFFSL(SL,"sec",True)['key'] # u"$sec['key']" on line 60, col 21
            if _v is not None: write(_filter(_v, rawExpr=u"$sec['key']")) # from line 60, col 21.
            write(u'''">''')
            _v = VFFSL(SL,"sec",True)["description"] # u'$sec["description"]' on line 60, col 34
            if _v is not None: write(_filter(_v, rawExpr=u'$sec["description"]')) # from line 60, col 34.
            write(u'''</option>
''')
        write(u'''\t\t\t\t\t</select>
\t\t\t\t</div>
\t\t\t</div>
\t\t</div>
\t\t<div class="body" >
\t\t\t<div id="content_main" class="m-t-40">
\t\t\t\t<div id="info">
\t\t\t\t\t<div id="scontent"></div>
\t\t\t\t\t<div style="display:none" id="thistitlebookmarks">
\t\t\t\t\t\t<i class=\'material-icons material-icons-centered\'>settings</i>
\t\t\t\t\t\t''')
        _v = VFFSL(SL,"tstrings",True)['settings'] # u"$tstrings['settings']" on line 72, col 7
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['settings']")) # from line 72, col 7.
        write(u''' - ''')
        _v = VFFSL(SL,"tstrings",True)['bookmarks'] # u"$tstrings['bookmarks']" on line 72, col 31
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['bookmarks']")) # from line 72, col 31.
        write(u'''
\t\t\t\t\t</div>
\t\t\t\t\t<div id="bookmarks" class="m-t--20" style="display:none;">
\t\t\t\t\t\t<div id="content_main2">
\t\t\t\t\t\t\t<table id="configuration" class="table table-striped table-hover form-group" style="width: auto;">
\t\t\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t\t\t<th colspan="100%">''')
        _v = VFFSL(SL,"tstrings",True)['bookmarks'] # u"$tstrings['bookmarks']" on line 78, col 29
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['bookmarks']")) # from line 78, col 29.
        write(u'''</th>
\t\t\t\t\t\t\t\t</tr>
''')
        for location in VFFSL(SL,"locations",True): # generated from line 80, col 1
            write(u'''\t\t\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t\t\t<td>
\t\t\t\t\t\t\t\t\t\t<i class="material-icons material-icons-centered">folder_open</i>
''')
            dirs = VFN(VFFSL(SL,"location",True),"split",False)("/")[1:]
            for dir in VFFSL(SL,"dirs",True): # generated from line 85, col 2
                write(u'''\t\t\t\t\t\t\t\t\t\t<span class="p-r-5 p-l-5">/</span>
\t\t\t\t\t\t\t\t\t\t''')
                _v = VFFSL(SL,"dir",True) # u'$dir' on line 87, col 11
                if _v is not None: write(_filter(_v, rawExpr=u'$dir')) # from line 87, col 11.
                write(u'''
''')
            write(u'''\t\t\t\t\t\t\t\t\t</td>
\t\t\t\t\t\t\t\t\t<td>
\t\t\t\t\t\t\t\t\t\t<a href="#" onclick="deleteBookmark(\'''')
            _v = VFFSL(SL,"location",True) # u'$location' on line 91, col 48
            if _v is not None: write(_filter(_v, rawExpr=u'$location')) # from line 91, col 48.
            write(u'''\'); return false;" title="">
\t\t\t\t\t\t\t\t\t\t\t<div>
\t\t\t\t\t\t\t\t\t\t\t\t<i class=\'material-icons material-icons-centered\'>remove</i>
\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t</a>
\t\t\t\t\t\t\t\t\t</td>
\t\t\t\t\t\t\t\t</tr>
''')
        write(u'''\t\t\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t\t\t<th colspan="100%">''')
        _v = VFFSL(SL,"tstrings",True)['new_bookmark'] # u"$tstrings['new_bookmark']" on line 100, col 29
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['new_bookmark']")) # from line 100, col 29.
        write(u'''</th>
\t\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t\t\t<td><!-- TODO: i10n -->
\t\t\t\t\t\t\t\t\t\t<div class=form-line>
\t\t\t\t\t\t\t\t\t\t\t<input type="text" name="addbookmarktext" value="" id="addbookmarktext" placeholder="''')
        _v = VFFSL(SL,"tstrings",True)['bookmark_path'] # u"$tstrings['bookmark_path']" on line 105, col 97
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['bookmark_path']")) # from line 105, col 97.
        write(u'''" required class="form-control inactive">
\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t</td>
\t\t\t\t\t\t\t\t\t<td>
\t\t\t\t\t\t\t\t\t\t<a href="#" onclick="addBookmark(); return false;">
\t\t\t\t\t\t\t\t\t\t\t<div>
\t\t\t\t\t\t\t\t\t\t\t\t<i class=\'material-icons material-icons-centered\'>add</i>
\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t</a>
\t\t\t\t\t\t\t\t\t</td>
\t\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t</table>
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t\t<div style="display:none" id="thistitlepackages"><i class=\'material-icons material-icons-centered\'>settings</i>''')
        _v = VFFSL(SL,"tstrings",True)['settings'] # u"$tstrings['settings']" on line 119, col 117
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['settings']")) # from line 119, col 117.
        write(u''' - ''')
        _v = VFFSL(SL,"tstrings",True)['packages'] # u"$tstrings['packages']" on line 119, col 141
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['packages']")) # from line 119, col 141.
        write(u'''</div>
\t\t\t\t\t<div id=\'packages\' style="display:none;">
\t\t\t\t\t\t<div id="content_main2">
\t\t\t\t\t\t\t<div class="row clearfix">
\t\t\t\t\t\t\t\t<div class="col-xs-12">
\t\t\t\t\t\t\t\t\t<ul class="nav nav-tabs" >
\t\t\t\t\t\t\t\t\t\t<li><a data-toggle="tab" href=\'#tab\' class="pkgbtn" id=\'pkgbtn1\' >''')
        _v = VFFSL(SL,"tstrings",True)['update'] # u"$tstrings['update']" on line 125, col 77
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['update']")) # from line 125, col 77.
        write(u'''</a></li>
\t\t\t\t\t\t\t\t\t\t<li><a data-toggle="tab" href=\'#tab\' class="pkgbtn" id=\'pkgbtn2\' >''')
        _v = VFFSL(SL,"tstrings",True)['installed'] # u"$tstrings['installed']" on line 126, col 77
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['installed']")) # from line 126, col 77.
        write(u'''</a></li>
\t\t\t\t\t\t\t\t\t\t<li><a data-toggle="tab" href=\'#tab\' class="pkgbtn" id=\'pkgbtn3\' >''')
        _v = VFFSL(SL,"tstrings",True)['all'] # u"$tstrings['all']" on line 127, col 77
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['all']")) # from line 127, col 77.
        write(u'''</a></li>
\t\t\t\t\t\t\t\t\t\t<li><a data-toggle="tab" href=\'#tab\' class="pkgbtn" id=\'pkgbtn4\' >''')
        _v = VFFSL(SL,"tstrings",True)['more'] # u"$tstrings['more']" on line 128, col 77
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['more']")) # from line 128, col 77.
        write(u'''</a></li>
\t\t\t\t\t\t\t\t\t</ul>
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div class="row clearfix" id="pkgmore">
\t\t\t\t\t\t\t\t<div class="col-xs-12">
\t\t\t\t\t\t\t\t\t<div class="card">
\t\t\t\t\t\t\t\t\t\t<div class="body" >
\t\t\t\t\t\t\t\t\t\t\t<div class="row clearfix">
\t\t\t\t\t\t\t\t\t\t\t\t<div class="col-xs-12">
\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="row clearfix align-center">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="col-xs-12 col-sm-6 col-md-4">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button id="updatefeed" type="button" class="btn waves-effect responsivebtn btn--skinned">''')
        _v = VFFSL(SL,"tstrings",True)['update_feed'] # u"$tstrings['update_feed']" on line 140, col 106
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['update_feed']")) # from line 140, col 106.
        write(u'''</button>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="col-xs-12 col-sm-6 col-md-4">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button id="upgrade" type="button" class="btn waves-effect responsivebtn btn--skinned">''')
        _v = VFFSL(SL,"tstrings",True)['upgrade_packages'] # u"$tstrings['upgrade_packages']" on line 143, col 103
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['upgrade_packages']")) # from line 143, col 103.
        write(u'''</button>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span id="pkguploadOne">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="col-xs-12 col-sm-6 col-md-4">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button id="selectfile" type="button" class="btn waves-effect responsivebtn btn--skinned">''')
        _v = VFFSL(SL,"tstrings",True)['select_ipk_upload'] # u"$tstrings['select_ipk_upload']" on line 147, col 107
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['select_ipk_upload']")) # from line 147, col 107.
        write(u'''</button>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t</span>
\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t<span id="pkguploadTwo">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="row clearfix">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="col-xs-12">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class="material-icons material-icons-centered">folder_open</i>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t''')
        _v = VFFSL(SL,"tstrings",True)['uploaded_files'] # u"$tstrings['uploaded_files']" on line 155, col 17
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['uploaded_files']")) # from line 155, col 17.
        write(u''':
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="row clearfix">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="col-xs-12">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ul id=\'tmpfiles\'></ul>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<form id="uploadpkg" style="display:none" action="uploadpkg" method="post" enctype="multipart/form-data" encoding="multipart/form-data">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type="file" name="rfile" id="rfile" maxlength="100000">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type="hidden" name="filename" id="filename">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</form>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t</span>
\t\t\t\t\t\t\t\t\t\t\t\t\t<div id="resulttext"></div>
\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div class="row clearfix" id="tblpackages">
\t\t\t\t\t\t\t\t<div class="col-xs-12">
\t\t\t\t\t\t\t\t\t<div class="tab-content">
\t\t\t\t\t\t\t\t\t\t<div class="card">
\t\t\t\t\t\t\t\t\t\t\t<div class="body" >
\t\t\t\t\t\t\t\t\t\t\t\t<div class="tab-pane active" id="tab">
\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="row clearfix form-group">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="col-xs-1 align-right">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\'material-icons material-icons-centered\'>search</i>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="col-xs-6 col-sm-4 align-left">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="form-line"><!-- TODO: i10n -->
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type="text" name="searchpk" id="searchpk" class="form-control inactive" placeholder="SEARCH ...">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="row clearfix">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ul id="packagelist">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="col-xs-12 align-center">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="loader">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="preloader">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="spinner-layer spinner--skinned pl--skinned">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="circle-clipper left">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="circle"></div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="circle-clipper right">
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class="circle"></div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<p>''')
        _v = VFFSL(SL,"tstrings",True)['loading'] # u"$tstrings['loading']" on line 205, col 21
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['loading']")) # from line 205, col 21.
        write(u'''...</p>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ul>
\t\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t</div>
\t\t</div>
\t</div>
</div>

<script>
\tvar str_db = "''')
        _v = VFFSL(SL,"tstrings",True)['delete_bookmark'] # u"$tstrings['delete_bookmark']" on line 225, col 16
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['delete_bookmark']")) # from line 225, col 16.
        write(u'''";

\t// TODO minimize js

\tvar filteredpkg;
\tvar filterval = \'\';

\tvar thisspinner = "<div class=\'col-xs-12 align-center\'><div class=\'loader\'><div class=\'preloader\'><div class=\'spinner-layer pl\'><div--skinned class=\'circle-clipper left\'><div class=\'circle\'></div></div><div class=\'circle-clipper right\'><div class=\'circle\'></div></div></div></div><p>" + tstr_loading + "...</p></div>";

\tfunction prepareUpload() {
\t\tvar fn = jQuery(this).val();
\t\tfn = fn.replace(\'C:\\\\fakepath\\\\\',\'\');
\t\tswal({
\t\t\t\ttitle: tstrings_upload_package,
\t\t\t\ttext: fn,
\t\t\t\ttype: "warning",
\t\t\t\tshowCancelButton: true,
\t\t\t\tconfirmButtonColor: "#DD6B55",
\t\t\t\tconfirmButtonText: tstrings_yes,
\t\t\t\tcancelButtonText: tstrings_no_cancel,
\t\t\t\tcloseOnConfirm: true,
\t\t\t\tcloseOnCancel: true
\t\t\t}, function (isConfirm) {
\t\t\t\tif (isConfirm) {
\t\t\t\t\tvar frm = document.forms["uploadpkg"];
\t\t\t\t\tfrm.filename.value = fn;

\t\t\t\t\tjQuery(\'form#uploadpkg\')
\t\t\t\t\t\t.unbind(\'submit\')
\t\t\t\t\t\t.submit(function (e) 
\t\t\t\t\t{
\t\t\t\t\t\tvar formData = new FormData(this);
\t\t\t\t\t\tjQuery.ajax({
\t\t\t\t\t\t\turl: \'/ipkg/upload\',
\t\t\t\t\t\t\ttype: \'POST\',
\t\t\t\t\t\t\tdata: formData,
\t\t\t\t\t\t\tmimeType:"multipart/form-data",
\t\t\t\t\t\t\tcontentType: false,
\t\t\t\t\t\t\tcache: false,
\t\t\t\t\t\t\tprocessData:false,
\t\t\t\t\t\t\tdataType: \'json\',
\t\t\t\t\t\t\tsuccess: function (data, textStatus, jqXHR) {
\t\t\t\t\t\t\t\tvar r = data.Result;
\t\t\t\t\t\t\t\tif (r[0]!=true) {
\t\t\t\t\t\t\t\t\talert(tstrings_upload_error + ": " + r[1]);
\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t\tShowPackages(\'pkgbtn4\');
\t\t\t\t\t\t\t},
\t\t\t\t\t\t\terror: function (jqXHR, textStatus, errorThrown) {
\t\t\t\t\t\t\t\talert(tstrings_upload_error + ": " + errorThrown);
\t\t\t\t\t\t\t\tShowPackages(\'pkgbtn4\');
\t\t\t\t\t\t\t}
\t\t\t\t\t\t});
\t\t\t\t\t\te.preventDefault();
\t\t\t\t\t\ttry {
\t\t\t\t\t\t\te.unbind();
\t\t\t\t\t\t} catch(e){}
\t\t\t\t\t});
\t\t\t\t\tjQuery(\'form#uploadpkg\').submit();
\t\t\t\t} else {
\t\t\t\t\tswal(tstrings_cancelled, tstrings_upload_package, "error");
\t\t\t\t}
\t\t\t});
\t}
\tfunction getPkgFilename(){
\t\tvar frm = document.forms["form_uploadpkg"];
\t\tfrm.filename.value = frm.file.value;
\t}

\tfunction ShowFilterPackages()
\t{
\t\tvar row=\'\';
\t\tjQuery.each( filteredpkg, function( key, val ) {
\t\t\tvar name = val[\'name\'];
\t\t\tvar desc = val[\'d\'];
\t\t\tif(filterval=== \'\' || name.toLowerCase().search(filterval.toLowerCase()) !== -1 || desc.toLowerCase().search(filterval.toLowerCase()) !== -1) {
\t\t\t\tvar upd = (val[\'u\'] == \'0\') ? "":val[\'u\'];
\t\t\t\tvar i = val[\'i\'];
\t\t\t\tvar sel = (i == \'1\') ? "class=\'installed\' ":"";
\t\t\t\tif(i == \'1\' && val[\'u\'] != \'0\')
\t\t\t\t\ti = \'2\';
\t\t\t\tvar ico = (i == \'1\') ? "delete_forever":"get_app";
\t\t\t\tif(upd!=\'\') {
\t\t\t\t\tupd = " -> " + upd;
\t\t\t\t\tico = "system_update"
\t\t\t\t}
\t\t\t\trow += "<li "+sel+"data-i=\'"+i+"\' data-n=\'"+name+"\'><a href=\'#\' class=\'list-group-item list-group-item-action\'><i class=\'material-icons material-icons-centered\'>" + ico + "</i><div>" + name +" (" + val[\'v\'] + upd +")<br><span>" + desc + "</span></div></a></li>";
\t\t\t}
\t\t});
\t\tjQuery("#packagelist").html(row);
\t\t
\t\tjQuery(\'#packagelist > li\').click( function () {
\t\t\task(jQuery(this),false);
\t\t});
\t}

\tfunction FillPackages(pkgs,mode)
\t{
\t\tvar _update = jQuery.grep(pkgs, function(v) {
\t\t\treturn (v.u != \'0\');
\t\t});
\t\tvar _installed = jQuery.grep(pkgs, function(v) {
\t\t\treturn (v.i == \'1\');
\t\t});

\t\tif (mode == \'pkgbtn1\')
\t\t\tfilteredpkg = _update.slice();
\t\telse if (mode == \'pkgbtn2\') {
\t\t\tfilteredpkg = _installed.slice();
\t\t} else
\t\t\tfilteredpkg = pkgs.slice();

\t\tShowFilterPackages();

\t}

\tfunction ask(obj,man)
\t{
\t\t\tvar pk = jQuery(obj).html();
\t\tvar i = jQuery(obj).data(\'i\');
\t\tif(!man) {
\t\t\tpk = jQuery(obj).data(\'n\');
\t\t}
\t\t
\t\tvar cmd = \'\';

\t\tif(i==\'1\') {
\t\t\tconfirm_txt = tstrings_remove_package
\t\t\tcmd = \'remove&package=\' + pk;
\t\t} else if (i==\'2\') {
\t\t\tconfirm_txt = tstrings_update_package
\t\t\t\tcmd = \'install&package=\' + pk;
\t\t} else {
\t\t\tconfirm_txt = tstrings_install_package
\t\t\tcmd = \'install&package=\' + pk;
\t\t}
\t\t
\t\tif(cmd != \'\')
\t\t{
\t\t\tswal({
\t\t\t\ttitle: confirm_txt,
\t\t\t\ttext: pk,
\t\t\t\ttype: "warning",
\t\t\t\tshowCancelButton: true,
\t\t\t\tconfirmButtonColor: "#DD6B55",
\t\t\t\tconfirmButtonText: tstrings_yes,
\t\t\t\tcancelButtonText: tstrings_no_cancel,
\t\t\t\tcloseOnConfirm: true,
\t\t\t\tcloseOnCancel: true
\t\t\t}, function (isConfirm) {
\t\t\t\tif (isConfirm) {
\t\t\t\t\tAction(\'/ipkg?command=\'+cmd,\'true\');
\t\t\t\t\tjQuery("#tblpackages").hide();
\t\t\t\t\tjQuery("#pkgmore").show();
\t\t\t\t\tjQuery(\'#pkgbtn4\').prop(\'checked\', true); 
\t\t\t\t} else {
\t\t\t\t\tswal(tstrings_cancelled, confirm_txt, "error");
\t\t\t\t}
\t\t\t});
\t\t}
\t}

\tfunction Action(action,rl)
\t{
\t\tjQuery(\'#pkgbtn4\').click();
\t\tjQuery(\'#resulttext\').html(thisspinner);
\t\tjQuery.ajax({
\t\t\turl: action,
\t\t\tsuccess: function ( data ) {
\t\t\t\tvar txt = data.replace(\'<html><body>\',\'\').replace(\'</body></html>\',\'\').replace(/<br>/g,\'\');
\t\t\t\tjQuery(\'#resulttext\').html(\'<pre>\' + txt + \'</pre>\');
\t\t\t\tif(rl !== undefined) {
\t\t\t\t\tSetLSValue(\'pkg-date\',\'\');
\t\t\t\t}
\t\t\t},
\t\t\terror: function ( data ) {
\t\t\t\tvar txt = data.replace(\'<html><body>\',\'\').replace(\'</body></html>\',\'\').replace(/<br>/g,\'\');
\t\t\t\tjQuery(\'#resulttext\').html(data);;
\t\t\t}
\t\t});
\t}

\tfunction ShowPackages(mode)
\t{
\t\tjQuery("#tblpackages").hide();
\t\tif (mode == \'pkgbtn4\') {
\t\t\tjQuery("#pkgmore").show();
\t\t\tjQuery(\'#tmpfiles\').empty();
\t\t\tjQuery.ajax({
\t\t\t\turl: \'/ipkg?command=tmp\',
\t\t\t\tdataType: \'json\',
\t\t\t\tsuccess: function (data) {
\t\t\t\t\tvar files = \'\';
\t\t\t\t\tjQuery.each( data.ipkfiles, function( key, val ) {
\t\t\t\t\t\tfiles += "<li><a href=\'#\' class=\'list-group-item list-group-item-action\'><i class=\'material-icons material-icons-centered\'>get_app</i><span>/tmp/" + val[\'name\'] + "</span></a></li>";
\t\t\t\t\t});
\t\t\t\t\tjQuery(\'#tmpfiles\').html(files);
\t\t\t\t\tjQuery(\'#tmpfiles > li \').click( function () {
\t\t\t\t\t\task(jQuery(this).parent().find(\'span\'),true);
\t\t\t\t\t});
\t\t\t\t\tif ( files === \'\' ) {
\t\t\t\t\t\tjQuery(\'#pkguploadTwo\').hide();
\t\t\t\t\t} else {
\t\t\t\t\t\tjQuery(\'#pkguploadTwo\').show();
\t\t\t\t\t}
\t\t\t\t\t
\t\t\t\t}
\t\t\t});
\t\t\treturn;
\t\t}

\t\tjQuery("#pkgmore").hide();
\t\tjQuery("#tblpackages").show();

\t\tvar date = new Date();
\t\tdate = date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()+date.getHours();

\t\tvar cache = GetLSValue(\'pkg-date\',\'\')
\t\tif(cache === date) {
\t\t\tcache = GetLSValue(\'pkg-data\',null);
\t\t\tif(cache != null) {
\t\t\t\tvar pkgs = JSON.parse(cache);
\t\t\t\tFillPackages(pkgs,mode);
\t\t\t\treturn;
\t\t\t}
\t\t}

\t\tjQuery.ajax({
\t\t\turl: \'/ipkg?command=listall\',
\t\t\tdataType: \'json\',
\t\t\tsuccess: function ( data ) {
\t\t\t\tvar sdata = JSON.stringify(data);
\t\t\t\tSetLSValue(\'pkg-date\',date);
\t\t\t\tSetLSValue(\'pkg-data\',sdata);
\t\t\t\tFillPackages(data,mode);
\t\t\t}
\t\t});
\t}

\tjQuery(function() {
\t\tjQuery(\'#settingselection\').on(\'change\', function (e) {
\t\t\tvar optionSelected = jQuery("option:selected", this);
\t\t\tvar valueSelected = this.value;
\t\t\tjQuery("#bookmarks").hide();
\t\t\tjQuery("#scontent").hide();
\t\t\tjQuery("#packages").hide();
\t\t\tif(valueSelected == \'packagemenu\')
\t\t\t{
\t\t\t\tjQuery("#packages").show();
\t\t\t\tShowPackages(\'pkgbtn4\');
\t\t\t\tjQuery("#configtitle").html(jQuery(\'#thistitlepackages\').html());
\t\t\t\tdocument.getElementById("pkgbtn4").click();
\t\t\t}
\t\t\telse if(valueSelected == \'bookmarksmenu\')
\t\t\t{
\t\t\t\tjQuery("#configtitle").html(jQuery(\'#thistitlebookmarks\').html());
\t\t\t\tjQuery("#bookmarks").show();
\t\t\t} else {
\t\t\t\tjQuery("#scontent").show();
\t\t\t\tjQuery("#scontent").load(\'ajax/config?section=\' + valueSelected, function () {
\t\t\t\t\tjQuery("#scontent").find("#content_main").attr("id","content_main1");
\t\t\t\t});
\t\t\t}
\t\t});

\t\tjQuery(\'#settingselection\').val(\'usage\');

\t\tjQuery("#scontent").load(\'ajax/config?section=usage\', function () {
\t\t\tjQuery("#scontent").find("#content_main").attr("id","content_main1");
\t\t});

\t\tjQuery(\'#tb2\').buttonset();
\t\tjQuery(\'#tb3\').buttonset();
\t\tjQuery(\'.pkgbtn\').click(function () { ShowPackages(jQuery(this).attr(\'id\')); });
\t\tjQuery(\'#selectfile\').click(function () {jQuery("#rfile").trigger(\'click\'); });
\t\tjQuery(\'#rfile\').change(prepareUpload);
\t\tjQuery(\'#updatefeed\').click(function () {
\t\t\tAction(\'/ipkg?command=update\',true); });
\t\tjQuery(\'#upgrade\').click(function () {
\t\t\tAction(\'/ipkg?command=upgrade\',\'true\'); });
\t\t
\t\tjQuery(\'#searchpk\').focus(function () { 
\t\t\tif (jQuery(this).val() === \'...\') {
\t\t\t\tjQuery(this).val(\'\');
\t\t\t}
\t\t}).keyup(function (){
\t\t\tif (jQuery(this).data(\'val\') !== this.value) {
\t\t\t\tfilterval=this.value;
\t\t\t\tShowFilterPackages();
\t\t\t}
\t\t\tjQuery(this).data(\'val\', this.value);
\t\t}); /*.blur(function (){
\t\t\tfilterval=\'\';
\t\t\tjQuery(this).data(\'val\', \'\');
\t\t\tif (jQuery(this).val() === \'\') {
\t\t\t\tjQuery(this).val(\'...\');
\t\t\t}
\t\t});
\t\t*/
\t});

\tfunction deleteBookmark(bm) {
\t\tif (confirm(str_db + \' (\' + bm + \') ?\') === false) {
\t\t\treturn;
\t\t}

\t\tjQuery.ajax({
\t\t\turl: "/api/removelocation?dirname=" + bm,
\t\t\tdataType: "json",
\t\t\tsuccess: function(loc) {
\t\t\t\tif (loc.result)
\t\t\t\t\tload_maincontent_spin("/ajax/settings");
\t\t\t\telse
\t\t\t\t\talert(loc.message);
\t\t\t}
\t\t});
\t}

\tfunction addBookmark() {
\t\tbm = jQuery("#addbookmarktext").val();

\t\tif(bm.length==0 || bm.includes(" ")) {
\t\t\talert("Path Error");
\t\t\treturn;
\t\t}

\t\tjQuery.ajax({
\t\t\turl: "/api/addlocation?dirname=" + bm,
\t\t\tdataType: "json",
\t\t\tsuccess: function(loc) {
\t\t\t\tif (loc.result)
\t\t\t\t\tload_maincontent_spin("/ajax/settings");
\t\t\t\telse
\t\t\t\t\talert(loc.message);
\t\t\t}
\t\t});
\t}

\tjQuery.AdminBSB.input.activate();

''')
        if VFFSL(SL,"allowipkupload",True): # generated from line 565, col 1
            write(u'''\tvar noupload=true;
''')
        else: # generated from line 567, col 1
            write(u'''\tjQuery(function() {
\t\tjQuery("#pkguploadOne").hide();
\t\tjQuery("#pkguploadTwo").hide();
\t});
\tvar noupload = false;
''')
        write(u'''</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_settings= 'respond'

## END CLASS DEFINITION

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


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


