<commit_before>
<html>
    <head>
        
<script>
var iid=1;
var icF=false;
var model=parent.stb.RDir("Model");
var menuT=new Array();
menuT=[['select',parent.t('Language:')],['select',parent.t('Country:')],['select',parent.t('City:')],['select',parent.t('Time zone:')]];
var  mid=menuT.length+2;
var City=new Object();
var index=0;var maxIn=0;
var numberC=0;
var goInd=-1;var goMax=0;
var goCity=new Object();
parent.load({"type":"stb","action":"get_locales"},
        function(langv){ 
            var dl=document.getElementById("i1");
            var options = '';
            for(var il in langv)
            {
               if(langv[il].selected==1){var selected = "selected";}else{selected = ""}
               options += '<option value="'+langv[il].value+'" '+selected+'>'+langv[il].label+'</option>';  
            }
            dl.innerHTML = options;
        });
        
parent.load({"type":"stb","action":"get_countries"},
        function(locales){ 
            var dlo=document.getElementById("i2");
            var sel=true;
            var options = '';
            for(var il in locales)
            {
               if(locales[il].selected==1){var selected = "selected";}else{selected = ""}
               options += '<option value="'+locales[il].value+'" '+selected+'>'+locales[il].label+'</option>';
            }
            dlo.innerHTML = options;
            if(sel)loadCity(dlo[dlo.selectedIndex].value);
        });

 parent.load({"type":"stb","action":"get_timezones"},
        function(timezon){ 
            var dl=document.getElementById("i4");
            var options = '';
            for(var il in timezon)
            {
               if(timezon[il].selected==1){var selected = "selected";}else{selected = ""}
               options += '<option value="'+timezon[il].value+'" '+selected+'>'+timezon[il].label+'</option>';
            }
            dl.innerHTML = options;
        });
        
function loadCity(id){
    parent.load({"type":"stb","action":"get_cities","country_id" : id},
        function(city){ 
            maxIn=0;index=0;
            var dl=document.getElementById("i3");
            City=city;
            for(var il in city)
            {
               maxIn++;
               if(city[il].selected==1){index=il;}
            }
            maxIn--;
            numberC=City[index].value;
            dl.value=City[index].label;
            changeTime(City[index].timezone);
        });
}

function changeTime(timezone)
{
    var dl=document.getElementById("i4");
    if(timezone!='')for(i=0;i<dl.length;i++){
        if(timezone==dl[i].value){dl[i].selected=true;break;}
    }
}

function onLoad()
{
        sload();
        init();
        parent.cont.focus();
        document.getElementById("i1").focus();
        document.getElementById("i5").value=parent.t('OK');
        document.getElementById("i6").value=parent.t('Cancel');
        menuT[2][0]='ic';
}

function pressKeyH(e)
{
ec = e.keyCode;<commit_msg>Fix timezones (issue #1079)<commit_after>
<html>
    <head>
        
<script>
var iid=1;
var icF=false;
var model=parent.stb.RDir("Model");
var read=JSON.parse(parent.stb.GetEnv('{"varList":["timezone_conf"]}'));
var menuT=new Array();
menuT=[['select',parent.t('Language:')],['select',parent.t('Country:')],['select',parent.t('City:')],['select',parent.t('Time zone:')]];
var  mid=menuT.length+2;
var City=new Object();
var index=0;var maxIn=0;
var numberC=0;
var goInd=-1;var goMax=0;
var goCity=new Object();
var first_load=true;
parent.load({"type":"stb","action":"get_locales"},
        function(langv){ 
            var dl=document.getElementById("i1");
            var options = '';
            for(var il in langv)
            {
               if(langv[il].selected==1){var selected = "selected";}else{selected = ""}
               options += '<option value="'+langv[il].value+'" '+selected+'>'+langv[il].label+'</option>';  
            }
            dl.innerHTML = options;
        });
        
parent.load({"type":"stb","action":"get_countries"},
        function(locales){ 
            var dlo=document.getElementById("i2");
            var sel=true;
            var options = '';
            for(var il in locales)
            {
               if(locales[il].selected==1){var selected = "selected";}else{selected = ""}
               options += '<option value="'+locales[il].value+'" '+selected+'>'+locales[il].label+'</option>';
            }
            dlo.innerHTML = options;
            if(sel)loadCity(dlo[dlo.selectedIndex].value);
        });

 parent.load({"type":"stb","action":"get_timezones"},
        function(timezon){ 
            var dl=document.getElementById("i4");
            var options = '';
            var select = 0;
            var base_select = -1;
            for(var il in timezon)
            {
               if(timezon[il].selected==1){
                   select = il;
               }
               if(timezon[il].value == read.result.timezone_conf){
                   base_select = il;
               }
               options += '<option value="'+timezon[il].value+'">'+timezon[il].label+'</option>';
            }
            dl.innerHTML = options;
            dl.getElementsByTagName("option")[base_select!=-1?base_select:select].selected=true;
        });
        
function loadCity(id){

    parent.load({"type":"stb","action":"get_cities","country_id" : id},
        function(city){ 
            maxIn=0;index=0;
            var dl=document.getElementById("i3");
            City=city;
            for(var il in city)
            {
               maxIn++;
               if(city[il].selected==1){index=il;}
            }
            maxIn--;
            numberC=City[index].value;
            dl.value=City[index].label;
            if (!first_load){
                changeTime(City[index].timezone);
            }else{
                first_load = false;
            }

        });
}

function changeTime(timezone)
{
    var dl=document.getElementById("i4");
    if(timezone!='')for(i=0;i<dl.length;i++){
        if(timezone==dl[i].value){dl[i].selected=true;break;}
    }
}

function onLoad()
{
        sload();
        init();
        parent.cont.focus();
        document.getElementById("i1").focus();
        document.getElementById("i5").value=parent.t('OK');
        document.getElementById("i6").value=parent.t('Cancel');
        menuT[2][0]='ic';
}

function pressKeyH(e)
{
ec = e.keyCode;
{'fraction_non_alphanumeric': 0.18459143968871594, 'fraction_numerical': 0.008560311284046693, 'mean_word_length': 2.213, 'pattern_counts': {'":': 17, '<': 23, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1184612', 'n_tokens_mistral': 1990, 'n_tokens_neox': 1966, 'n_words': 279}