#!/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__ = 1644596120.97836
__CHEETAH_genTimestamp__ = 'Fri Feb 11 16:15:20 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/ajax/edittimer.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 edittimer(Template):

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


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

        super(edittimer, 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'''<style>
.t,.t2,.t3 { display:table;width: 100%; padding-bottom:10px;background-image:none;}
.t3.ui-widget-content,.t2.ui-widget-content,.t.ui-widget-content { border:none;}
.t3 > div,.t > div,.t2 > div { display:table-cell;}
.t > div:first-child { width: 150px;vertical-align:top;}
.t2 div{ width: 50%;}
.t3 div{ width: 33%;}
#enabled,#justplay,#always_zap,#timerend,#cbradio,#rcb,#sep1,#timerbegin {margin-left:5px;}
#justplay,#always_zap,#sep1,#timerbegin {margin-right:5px;}
#repeatdays > label,#tagsnew > label { line-height:.9em;padding-left:10px;padding-right:10px; }
#repeatdays span.ui-icon { display:none! important; }
#bouquet_select-menu {max-height: 300px;}
</style>
<form>
<div>
\t<div class="t ui-widget-content">
\t\t<div>''')
        _v = VFFSL(SL,"tstrings",True)['enabled'] # u"$tstrings['enabled']" on line 18, col 8
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['enabled']")) # from line 18, col 8.
        write(u''':<input type="checkbox" name="enabled" id="enabled" value="0" /></div>
\t\t<div>''')
        _v = VFFSL(SL,"tstrings",True)['just_play'] # u"$tstrings['just_play']" on line 19, col 8
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['just_play']")) # from line 19, col 8.
        write(u''':<input type="checkbox" name="justplay" id="justplay" value="0" /><span id="sep1">/</span>
\t\t''')
        _v = VFFSL(SL,"tstrings",True)['zap_record'] # u"$tstrings['zap_record']" on line 20, col 3
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['zap_record']")) # from line 20, col 3.
        write(u''':<input type="checkbox" name="always_zap" id="always_zap" value="0" />
''')
        if VFFSL(SL,"pipzap",True): # generated from line 21, col 3
            write(u'''\t\t<br>
\t\t''')
            _v = VFFSL(SL,"tstrings",True)['pipifposible'] # u"$tstrings['pipifposible']" on line 23, col 3
            if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['pipifposible']")) # from line 23, col 3.
            write(u''': <input type="checkbox" name="pipzap" id="pipzap" value="0" />
''')
        else: # generated from line 24, col 3
            write(u'''\t\t<input type="checkbox" name="pipzap" id="pipzap" value="0" style="display:none"/>
''')
        write(u'''\t\t</div>
\t</div>

\t<div class="t ui-widget-content">
\t\t<div>''')
        _v = VFFSL(SL,"tstrings",True)['name'] # u"$tstrings['name']" on line 31, col 8
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['name']")) # from line 31, col 8.
        write(u''':</div>
\t\t<div><input type="text" name="timername" id="timername" style="width:100%;" class="text ui-widget-content ui-corner-all" /></div>
\t</div>
\t<div class="t ui-widget-content">
\t\t<div>''')
        _v = VFFSL(SL,"tstrings",True)['description'] # u"$tstrings['description']" on line 35, col 8
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['description']")) # from line 35, col 8.
        write(u''':</div>
\t\t<div><textarea name="description" id="description" style="width:100%; height: 50px;" class="text ui-widget-content ui-corner-all" /></div>
\t</div>
\t<div class="t ui-widget-content">
\t\t<div>''')
        _v = VFFSL(SL,"tstrings",True)['channel'] # u"$tstrings['channel']" on line 39, col 8
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['channel']")) # from line 39, col 8.
        write(u''':
\t\t<label style="display:none;"><input class="cbtvr" id="cbtv" type="checkbox" name="group1[]" /> ''')
        _v = VFFSL(SL,"tstrings",True)['tv'] # u"$tstrings['tv']" on line 40, col 98
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['tv']")) # from line 40, col 98.
        write(u''' </label>
\t\t<span id="rcb">(''')
        _v = VFFSL(SL,"tstrings",True)['radio'] # u"$tstrings['radio']" on line 41, col 19
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['radio']")) # from line 41, col 19.
        write(u''':<input class="cbtvr" id="cbradio" type="checkbox" name="group1[]" />)</span>
\t\t</div>
\t\t<div>
\t\t<select id="bouquet_select" name="bouquet_select" style="width:100%;">
\t\t\t<option value="0">''')
        _v = VFFSL(SL,"tstrings",True)['nothing'] # u"$tstrings['nothing']" on line 45, col 22
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['nothing']")) # from line 45, col 22.
        write(u'''</option>
\t\t</select></div>
\t</div>

\t<div class="t ui-widget-content">
\t\t<div>''')
        _v = VFFSL(SL,"tstrings",True)['time'] # u"$tstrings['time']" on line 50, col 8
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['time']")) # from line 50, col 8.
        write(u''':</div>
\t\t<div>''')
        _v = VFFSL(SL,"tstrings",True)['start'] # u"$tstrings['start']" on line 51, col 8
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['start']")) # from line 51, col 8.
        write(u''':<input type="text" name="timerbegin" id="timerbegin" value="" class="text ui-widget-content ui-corner-all" />&nbsp;
\t\t''')
        _v = VFFSL(SL,"tstrings",True)['end'] # u"$tstrings['end']" on line 52, col 3
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['end']")) # from line 52, col 3.
        write(u''':<input type="text" name="timerend" id="timerend" value="" class="text ui-widget-content ui-corner-all" /></div>
\t</div>


\t<div class="t ui-widget-content">
\t\t<div>''')
        _v = VFFSL(SL,"tstrings",True)['repeated'] # u"$tstrings['repeated']" on line 57, col 8
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['repeated']")) # from line 57, col 8.
        write(u''':</div>
\t\t<div>
\t\t<span id="repeatdays" style="margin: 5px;">
''')
        i = 0
        for day in [VFFSL(SL,"tstrings",True)['mo'], VFFSL(SL,"tstrings",True)['tu'], VFFSL(SL,"tstrings",True)['we'], VFFSL(SL,"tstrings",True)['th'], VFFSL(SL,"tstrings",True)['fr'], VFFSL(SL,"tstrings",True)['sa'], VFFSL(SL,"tstrings",True)['su']]: # generated from line 61, col 3
            value = 2 ** VFFSL(SL,"i",True)
            write(u'''\t\t\t<label for="day''')
            _v = VFFSL(SL,"i",True) # u'$i' on line 63, col 19
            if _v is not None: write(_filter(_v, rawExpr=u'$i')) # from line 63, col 19.
            write(u'''">''')
            _v = VFFSL(SL,"day",True) # u'$day' on line 63, col 23
            if _v is not None: write(_filter(_v, rawExpr=u'$day')) # from line 63, col 23.
            write(u'''</label><input type="checkbox" name="repeated" id="day''')
            _v = VFFSL(SL,"i",True) # u'$i' on line 63, col 81
            if _v is not None: write(_filter(_v, rawExpr=u'$i')) # from line 63, col 81.
            write(u'''" value="''')
            _v = VFFSL(SL,"value",True) # u'$value' on line 63, col 92
            if _v is not None: write(_filter(_v, rawExpr=u'$value')) # from line 63, col 92.
            write(u'''" />
''')
            i = VFFSL(SL,"i",True)+1
        write(u'''\t\t</span>
\t\t</div>
\t</div>

\t<div class="t ui-widget-content">
\t\t<div>''')
        _v = VFFSL(SL,"tstrings",True)['location'] # u"$tstrings['location']" on line 71, col 8
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['location']")) # from line 71, col 8.
        write(u''':</div>
\t\t<div>
\t\t<select id="dirname" name="dirname">
\t\t\t<option value="None">''')
        _v = VFFSL(SL,"tstrings",True)['default'] # u"$tstrings['default']" on line 74, col 25
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['default']")) # from line 74, col 25.
        write(u'''</option>
\t\t</select>
\t\t</div>
\t</div>

\t<div class="t ui-widget-content">
\t\t<div>''')
        _v = VFFSL(SL,"tstrings",True)['after_event'] # u"$tstrings['after_event']" on line 80, col 8
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['after_event']")) # from line 80, col 8.
        write(u''':</div>
\t\t<div>
\t\t<select id="afterevent" name="afterevent">
\t\t\t<option value="0">''')
        _v = VFFSL(SL,"tstrings",True)['nothing'] # u"$tstrings['nothing']" on line 83, col 22
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['nothing']")) # from line 83, col 22.
        write(u'''</option>
\t\t\t<option value="1">''')
        _v = VFFSL(SL,"tstrings",True)['standby'] # u"$tstrings['standby']" on line 84, col 22
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['standby']")) # from line 84, col 22.
        write(u'''</option>
\t\t\t<option value="2">''')
        _v = VFFSL(SL,"tstrings",True)['shutdown'] # u"$tstrings['shutdown']" on line 85, col 22
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['shutdown']")) # from line 85, col 22.
        write(u'''</option>
\t\t\t<option value="3" selected="">''')
        _v = VFFSL(SL,"tstrings",True)['auto'] # u"$tstrings['auto']" on line 86, col 34
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['auto']")) # from line 86, col 34.
        write(u'''</option>
\t\t</select>
\t\t</div>
\t</div>

\t<div class="timerlist_row" id="has_vpsplugin1">
\t\t<span class="timerlist_row_l">''')
        _v = VFFSL(SL,"tstrings",True)['vps'] # u"$tstrings['vps']" on line 92, col 33
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['vps']")) # from line 92, col 33.
        write(u''':</span>
\t\t<span style="margin: 5px;">
\t\t\t<input type="checkbox" name="vpsplugin_enabled" id="vpsplugin_enabled" value="0" />
\t\t</span>
\t\t<span id="has_vpsplugin2" class="timerlist_row_r">''')
        _v = VFFSL(SL,"tstrings",True)['safe_mode'] # u"$tstrings['safe_mode']" on line 96, col 53
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['safe_mode']")) # from line 96, col 53.
        write(u''':</span>
\t\t<span style="margin: 5px;">
\t\t\t<input type="checkbox" name="vpsplugin_safemode" id="vpsplugin_safemode" value="0" />
\t\t</span>
\t</div>

''')
        if VFFSL(SL,"autoadjust",True): # generated from line 102, col 2
            write(u'''\t<div class="t ui-widget-content">
\t\t<div>VTi Extras:</div>
\t\t<div>
\t\t\t''')
            _v = VFFSL(SL,"tstrings",True)['autoadjust'] # u"$tstrings['autoadjust']" on line 106, col 4
            if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['autoadjust']")) # from line 106, col 4.
            write(u''': <input type="checkbox" id="autoadjust" value="1" />
\t\t\t''')
            _v = VFFSL(SL,"tstrings",True)['allow_duplicate'] # u"$tstrings['allow_duplicate']" on line 107, col 4
            if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['allow_duplicate']")) # from line 107, col 4.
            write(u''': <input type="checkbox" id="allow_duplicate" value="1" />
\t\t</div>
\t</div>
''')
        else: # generated from line 110, col 2
            write(u'''\t<input type="checkbox" name="autoadjust" id="autoadjust" value="0" style="display:none" />
\t<input type="checkbox" name="allow_duplicate" id="allow_duplicate" value="0" style="display:none" />
''')
        write(u'''\t
\t<div class="timerlist_row">
\t\t<span class="timerlist_row_l">''')
        _v = VFFSL(SL,"tstrings",True)['tags'] # u"$tstrings['tags']" on line 116, col 33
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['tags']")) # from line 116, col 33.
        write(u''':</span>
\t\t<span id="tagsnew" style="margin:5px">
\t\t</span>
\t</div>

\t<div class="t ui-widget-content">
\t\t<div>''')
        _v = VFFSL(SL,"tstrings",True)['recordingtype'] # u"$tstrings['recordingtype']" on line 122, col 8
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['recordingtype']")) # from line 122, col 8.
        write(u''':</div>
\t\t<div>
\t\t<select id="recordingtype" name="recordingtype">
\t\t\t<option value="">''')
        _v = VFFSL(SL,"tstrings",True)['default'] # u"$tstrings['default']" on line 125, col 21
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['default']")) # from line 125, col 21.
        write(u'''</option>
\t\t\t<option value="normal">''')
        _v = VFFSL(SL,"tstrings",True)['normal'] # u"$tstrings['normal']" on line 126, col 27
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['normal']")) # from line 126, col 27.
        write(u'''</option>
\t\t\t<option value="descrambled">''')
        _v = VFFSL(SL,"tstrings",True)['descrambledecm'] # u"$tstrings['descrambledecm']" on line 127, col 32
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['descrambledecm']")) # from line 127, col 32.
        write(u'''</option>
\t\t\t<option value="scrambled">''')
        _v = VFFSL(SL,"tstrings",True)['scrambledecm'] # u"$tstrings['scrambledecm']" on line 128, col 30
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['scrambledecm']")) # from line 128, col 30.
        write(u'''</option>
\t\t</select>
\t\t</div>
\t</div>
\t
\t<div id="errorbox" class="timerlist_row" style="color: red;">
\t\t<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;"> 
\t\t\t<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
\t\t\t<span id="error"></span>
\t\t</div>
\t</div>
</div>
</form>

<script type="text/javascript">


initTimerEditBegin();

$(\'.cbtvr\').click(function() {
\t$(\'input[name="\' + this.name + \'"]\').not(this).prop(\'checked\', false);
\tinitTimerBQ($(\'#cbradio\').is(\':checked\'));
});

$(\'#vpsplugin_enabled\').click(function() { checkVPS();});

$(\'#always_zap\').click(function() {
\t$(\'#justplay\').prop("disabled",$(\'#always_zap\').is(\':checked\'));
});

$(\'#timerend\').datetimepicker({
\ttimeText: tstr_time,
\thourText: tstr_hour,
\tminuteText: tstr_minute,
\tcurrentText: tstr_now,
\tcloseText: tstr_done,
\tmonthNames: [tstr_january, tstr_february, tstr_march, tstr_april, tstr_may, tstr_june, tstr_july, tstr_august, tstr_september, tstr_october, tstr_november, tstr_december],
\tdayNames: [tstr_sunday, tstr_monday, tstr_tuesday, tstr_wednesday, tstr_thursday, tstr_friday, tstr_saturday, tstr_sunday],
\tdayNamesMin: [tstr_su, tstr_mo, tstr_tu, tstr_we, tstr_th, tstr_fr, tstr_sa, tstr_su],
\t
\tdateFormat: \'dd.mm.yy\',
\ttimeFormat: \'HH:mm\',
\tonClose: function(dateText, inst) {
\t\tif (!timeredit_begindestroy && $(\'#timerbegin\').val() != \'\' && 
\t\t\t$(\'#timerbegin\').datetimepicker(\'getDate\') > $(this).datetimepicker(\'getDate\')) {
\t\t\t\t$(\'#error\').text(tstr_start_after_end);
\t\t\t\t$(\'#errorbox\').show();
\t\t}
\t\telse
\t\t\t$(\'#errorbox\').hide();
\t}
});

$(\'#repeatdays\').buttonset();

$(function() {
\t$("#bouquet_select").chosen({disable_search_threshold: 10,no_results_text: "Oops, nothing found!",width: "100%"});

\t$(".chosen-container .chosen-drop").addClass(\'ui-widget-content\');
\tif (theme == \'eggplant\' || theme == \'vader\')
\t{
\t\t$(".chosen-container .chosen-drop").css(\'background-image\',\'none\');
\t}

});


var h = ($(window).height() > 700) ? 620:520;
var w = ($(window).width() > 800) ? 740:650;

$(\'#editTimerForm\').dialog({
\tautoOpen: false,
\theight: h,
\twidth: w,
\tmodal: true,
\tbuttons: [
\t\t\t{text: tstr_save,
\t\t\tclick: function() {
\t\t\t\tvar enddate = new Date($(\'#timerend\').datetimepicker(\'getDate\'));
\t\t\t\tvar repeated = 0;
\t\t\t\t$(\'[name="repeated"]:checked\').each(function() {
\t\t\t\t\trepeated += parseInt($(this).val());
\t\t\t\t});
\t\t\t\tvar tags = "";
\t\t\t\t$(\'#tagsnew\').children("input:checked").each(function() {
\t\t\t\t\tif(tags!="")
\t\t\t\t\t\ttags+=" ";
\t\t\t\t\ttags += $(this).val();
\t\t\t\t});

\t\t\t\tvar urldata = { sRef: $(\'#bouquet_select\').val(),
\t\t\t\t\tend: Math.round(enddate.getTime() / 1000),
\t\t\t\t\tname: $(\'#timername\').val(),
\t\t\t\t\tdescription: $(\'#description\').val(),
\t\t\t\t\tdisabled: ($(\'#enabled\').is(\':checked\')?"0":"1"),
\t\t\t\t\tafterevent: $(\'#afterevent\').val(),
\t\t\t\t\tallow_duplicate: ($(\'#allow_duplicate\').is(\':checked\')?"1":"0"),
\t\t\t\t\tautoadjust: ($(\'#autoadjust\').is(\':checked\')?"1":"0"),
\t\t\t\t\ttags: tags,
\t\t\t\t\trepeated: repeated };

\t\t\t\tif($(\'#recordingtype\').val() != "") {
\t\t\t\t\turldata["recordingtype"] = $(\'#recordingtype\').val();\t\t\t\t\t
\t\t\t\t}

\t\t\t\tif($(\'#always_zap\').is(\':checked\')) {
\t\t\t\t\turldata["always_zap"] = "1";
\t\t\t\t\turldata["justplay"] = "0";
\t\t\t\t}
\t\t\t\telse {
\t\t\t\t\turldata["always_zap"] = "0";
\t\t\t\t\turldata["justplay"] = $(\'#justplay\').is(\':checked\')?"1":"0";
\t\t\t\t\tif($(\'#justplay\').is(\':checked\')) {
\t\t\t\t\t\turldata["pipzap"] = $(\'#pipzap\').is(\':checked\')?"1":"0";
\t\t\t\t\t}
\t\t\t\t}

\t\t\t\tif ($(\'#dirname\').val() != \'None\')
\t\t\t\t\turldata["dirname"] = $(\'#dirname\').val();
\t\t\t\tif (!$(\'#has_vpsplugin1\').is(\':hidden\'))
\t\t\t\t{
\t\t\t\t\turldata["vpsplugin_enabled"] = ($(\'#vpsplugin_enabled\').is(\':checked\')?"1":"0");
\t\t\t\t\turldata["vpsplugin_overwrite"] = ($(\'#vpsplugin_safemode\').is(\':checked\')?"0":"1");
\t\t\t\t}
\t\t\t\tif (!timeredit_begindestroy) {
\t\t\t\t\tvar begindate = new Date($(\'#timerbegin\').datetimepicker(\'getDate\'));
\t\t\t\t\turldata["begin"] = Math.round(begindate.getTime() / 1000);
\t\t\t\t}
\t\t\t\telse
\t\t\t\t\turldata["begin"] = Math.round(current_begin);

\t\t\t\tvar canclose = false;
\t\t\t\tif (current_serviceref == "") {
\t\t\t\t\t$.ajax({
\t\t\t\t\t\tasync: false,
\t\t\t\t\t\turl: "/api/timeradd?",
\t\t\t\t\t\tdata: urldata,
\t\t\t\t\t\tdataType: "json",
\t\t\t\t\t\tsuccess: function(result) {
\t\t\t\t\t\t\tif (result.result) {
\t\t\t\t\t\t\t\tcanclose = true;
\t\t\t\t\t\t\t}
\t\t\t\t\t\t\telse {
\t\t\t\t\t\t\t\tif(result.conflicts)
\t\t\t\t\t\t\t\t{
\t\t\t\t\t\t\t\t\tvar conftext=\'Timer Conflicts:<br>\';
\t\t\t\t\t\t\t\t\tresult.conflicts.forEach(function(entry) {
\t\t\t\t\t\t\t\t\t\tconftext += entry.name+" / "+entry.servicename+" / "+entry.realbegin+" - "+entry.realend+"<br>";
\t\t\t\t\t\t\t\t\t});
\t\t\t\t\t\t\t\t\t$("#error").text(conftext);
\t\t\t\t\t\t\t\t} else {
\t\t\t\t\t\t\t\t\t$("#error").text(result.message);
\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t\t$("#errorbox").show();
\t\t\t\t\t\t\t}
\t\t\t\t\t\t}
\t\t\t\t\t});
\t\t\t\t}
\t\t\t\telse {
\t\t\t\t\turldata[\'channelOld\'] = current_serviceref;
\t\t\t\t\turldata[\'beginOld\'] = Math.round(current_begin);
\t\t\t\t\turldata[\'endOld\'] = Math.round(current_end);
\t\t\t\t\t$.ajax({
\t\t\t\t\t\tasync: false,
\t\t\t\t\t\turl: "api/timerchange?",
\t\t\t\t\t\tdata: urldata,
\t\t\t\t\t\tdataType: "json",
\t\t\t\t\t\tsuccess: function(result) {
\t\t\t\t\t\t\tif (result.result) {
\t\t\t\t\t\t\t\tcanclose = true;
\t\t\t\t\t\t\t}
\t\t\t\t\t\t\telse {
\t\t\t\t\t\t\t\tif(result.conflicts)
\t\t\t\t\t\t\t\t{
\t\t\t\t\t\t\t\t\tvar conftext=\'Timer Conflicts:<br>\';
\t\t\t\t\t\t\t\t\tresult.conflicts.forEach(function(entry) {
\t\t\t\t\t\t\t\t\t\tconftext += entry.name+" / "+entry.servicename+" / "+entry.realbegin+" - "+entry.realend+"<br>";
\t\t\t\t\t\t\t\t\t});
\t\t\t\t\t\t\t\t\t$("#error").text(conftext);
\t\t\t\t\t\t\t\t} else {
\t\t\t\t\t\t\t\t\t$("#error").text(result.message);
\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t\t$("#errorbox").show();
\t\t\t\t\t\t\t}
\t\t\t\t\t\t}
\t\t\t\t\t});
\t\t\t\t}

\t\t\t\tif (canclose) {
\t\t\t\t\tif (reloadTimers) load_maincontent("ajax/timers");
\t\t\t\t\t$(this).dialog("close");
\t\t\t\t}
\t\t\t}
\t\t},
\t\t{
\t\t\ttext: tstr_close,
\t\t\tclick: function() {
\t\t\t\t$(this).dialog("close");
\t\t\t}
\t\t}
\t],
\tclose: function() {
\t\treturn;
\t}
});

checkVPS();

</script>
<link rel="stylesheet" type="text/css" href="/css/chosen.min.css" />
''')
        
        ########################################
        ## 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_edittimer= 'respond'

## END CLASS DEFINITION

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


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


