<?php /* Smarty version 2.6.26, created on 2017-04-19 09:17:48
         compiled from /home3/bargaip4/public_html/gevimmo/plugins/ipgeo/admin/ipgeo.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'cat', '/home3/bargaip4/public_html/gevimmo/plugins/ipgeo/admin/ipgeo.tpl', 42, false),array('modifier', 'version_compare', '/home3/bargaip4/public_html/gevimmo/plugins/ipgeo/admin/ipgeo.tpl', 43, false),array('modifier', 'replace', '/home3/bargaip4/public_html/gevimmo/plugins/ipgeo/admin/ipgeo.tpl', 64, false),)), $this); ?>
<!-- ipgeo tpl -->

<style>
<?php echo '

.ipgeo-p {
    font-size: 14px;
    line-height: 20px;
}
.ipgeo .red {
    font-size: 14px;
}
.ipgeo .loading-interface {
    border-top: 1px #cccccc solid;
    margin-top: 10px;
    padding-top: 18px;
    display: none;
}
.ipgeo .progress-bar {
    max-width: 600px;
    height: 5px;
    background: #e2e2e2;
    margin: 10px 0;
}
.ipgeo .progress-bar > div {
    height: 100%;
    width: 0;
    background: #748645;
    transition: width 0.2s ease;
}
.ipgeo .progress-error-message {
    margin-top: 15px;
    display: none;
}
.ipgeo .progress-error-message > li:not(:first-child) {
    padding-top: 2px;
}

'; ?>

</style>

<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<?php $this->assign('compared_version', ((is_array($_tmp=$this->_tpl_vars['config']['ipgeo_database_version'])) ? $this->_run_mod_handler('version_compare', true, $_tmp, '1.3.0') : version_compare($_tmp, '1.3.0'))); ?>

<div class="ipgeo">
    <p class="ipgeo-p">
        <?php if ($this->_tpl_vars['compared_version'] < 0): ?>
            <?php echo $this->_tpl_vars['lang']['ipgeo_remote_install_text']; ?>

        <?php else: ?>
            <?php echo $this->_tpl_vars['lang']['ipgeo_remote_update_text']; ?>

        <?php endif; ?>
    </p>

    <p class="ipgeo-p" style="padding: 10px 0 10px;">
        <span class="red"><b><?php echo $this->_tpl_vars['lang']['notice']; ?>
:</b></span>  <?php echo $this->_tpl_vars['lang']['ipgeo_remote_update_notice']; ?>

    </p>

    <?php $this->assign('replace_var', ('{')."percent".('}')); ?>

    <div><input id="install_database" <?php if ($this->_tpl_vars['compared_version'] >= 0): ?>accesskey="update"<?php endif; ?> type="button" value="<?php if ($this->_tpl_vars['compared_version'] < 0): ?><?php echo $this->_tpl_vars['lang']['install']; ?>
<?php else: ?><?php echo $this->_tpl_vars['lang']['update']; ?>
<?php endif; ?>" /></div>
    <div class="loading-interface">
        <div class="progress"><?php echo $this->_tpl_vars['lang']['ipgeo_preparing']; ?>
</div>
        <div class="progress-bar"><div></div></div>
        <div class="progress-info"><?php echo ((is_array($_tmp=$this->_tpl_vars['lang']['ipgeo_remote_update_status'])) ? $this->_run_mod_handler('replace', true, $_tmp, $this->_tpl_vars['replace_var'], '<span>0</span>') : smarty_modifier_replace($_tmp, $this->_tpl_vars['replace_var'], '<span>0</span>')); ?>
</div>
        <ul class="progress-error-message red"></ul>
    </div>
</div>

<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

<script>
lang['update'] = '<?php echo $this->_tpl_vars['lang']['update']; ?>
';

<?php echo '

$(document).ready(function(){
    var loading_interface = $(\'.ipgeo .loading-interface\');
    var progress_bar = loading_interface.find(\'.progress-bar > div\');
    var error_area = loading_interface.find(\'.progress-error-message\');
    var progress_dump = loading_interface.find(\'.progress\');
    var progress_info = loading_interface.find(\'.progress-info > span\');
    var current_file = 1;
    var total_files = 0;
    var in_progress = false;

    $.ajaxSetup({cache: false});

    var ipGeoUploadFile = function(){
        $.post(rlConfig[\'tpl_base\']+\'request.ajax.php\', {item: \'ipgeoUploadFile\', file: current_file}, function(response){
            if (response.status == \'OK\') {
                progress_dump.text(lang[\'ipgeo_file_upload_info\'].replace(\'{files}\', total_files).replace(\'{file}\', current_file));
                ipGeoImport();
            } else {
                ipGeoError(response.data);
            }
        }, \'json\');
    }

    var ipGeoImport = function(){
        $.post(rlConfig[\'tpl_base\']+\'request.ajax.php\', {item: \'ipgeoImport\'}, function(response){
            if (response[\'error\']) {
                ipGeoError(Array(response[\'error\']));
            } else if (response[\'action\'] == \'next_stack\') {
                ipGeoImport();

                response[\'progress\'] = response[\'progress\'] > 100 ? 100 : response[\'progress\'];
                progress_bar.width(response[\'progress\']+\'%\');
                progress_info.text(response[\'progress\']);
            } else if (response[\'action\'] == \'next_file\') {
                current_file++;
                progress_dump.text(lang[\'ipgeo_file_download_info\'].replace(\'{files}\', total_files).replace(\'{file}\', current_file));

                ipGeoUploadFile();
            } else if (response[\'action\'] == \'end\') {
                in_progress = false;
                printMessage(\'notice\', lang[\'ipgeo_import_completed\']);
                progress_dump.text(lang[\'ipgeo_import_completed\']);
            }
        }, \'json\')
    }

    var ipGeoError = function(data){
        for (var i in data) {
            if (typeof data[i] != \'string\')
                continue;

            error_area.append($(\'<li>\').text(data[i]));
        }
        error_area.fadeIn();
        progress_bar.css(\'width\', \'0\');
    }

    $(\'#install_database\').click(function(){
        // update mode
        if ($(this).attr(\'accesskey\') == \'update\') {
            $(this).val(lang[\'loading\']);
            var self = this;

            $.post(rlConfig[\'tpl_base\']+\'request.ajax.php\', {item: \'ipgeoCheckUpdate\'}, function(response){
                if (response.data == \'NO\') {
                    $(self).val(lang[\'update\']);
                    printMessage(\'notice\', lang[\'ipgeo_db_uptodate\']);
                } else {
                    $(self).removeAttr(\'accesskey\');
                    $(self).trigger(\'click\');
                }
            }, \'json\');
        }
        // import mode
        else {
            $(this).parent().fadeOut(function(){
                loading_interface.fadeIn(function(){
                    $.post(rlConfig[\'tpl_base\']+\'request.ajax.php\', {item: \'ipgeoPrepare\'}, function(response){
                        if (response.status == \'OK\') {
                            in_progress = true;

                            total_files = response.data.calc;
                            progress_dump.text(lang[\'ipgeo_file_download_info\'].replace(\'{files}\', total_files).replace(\'{file}\', current_file));
                            ipGeoUploadFile();
                        } else {
                            ipGeoError(response.data);
                        }
                    }, \'json\');
                });
            });
        }
    });

    $(window).bind(\'beforeunload\', function() {
        if (in_progress) {
            return \'Uploading the data is in process; closing the page will stop the process.\';
        }
    });
});

'; ?>

</script>

<!-- ipgeo tpl end -->