<?php
// Copyright 1999-2017. Plesk International GmbH. All Rights Reserved.

$this->includeMigratorCss('gauge.css');
?>
<?php // Call JavaScript function to update status periodically ?>
<script type="text/javascript">
    //<![CDATA[
    Jsw.onReady(function() {
        updateSessionStatus(
            <?php echo Zend_Json::encode($this->sessionId); ?>,
            <?php echo Zend_Json::encode($this->sessionStatus); ?>
        );
        periodicUpdateSessionStatus(<?php echo json_encode($this->sessionId); ?>);
    });
    //]]>
</script>
<?php // Situation #1: migration is in progress ?>
<div id="<?php $this->sessionElemId('block-in-progress'); ?>" style="display: none;">
    <span class="migrator-gauge-block">
        <span title="" class="migrator-gauge-wrapper not_empty">
            <span class="migrator-gauge-container">
                <?php
                // Progress bar element, will have "width" CSS property set from JavaScript
                // according to the current progress
                ?>
                <span class="migrator-gauge-filled" id="<?php $this->sessionElemId('progress-bar') ?>"></span>
            </span>
        </span>
        <span class="migrator-gauge-legend" id="<?php $this->sessionElemId('text-in-progress'); ?>"></span>
    </span>
</div>
<?php // Situation #2: migration finished successfully for all subscriptions, whole server was migrated ?>
<div id="<?php $this->sessionElemId('block-all-migrated'); ?>" style="display: none;">
    <img src="<?php echo $this->migratorImage('list-of-migrations-all-subscriptions-migrated.png'); ?>">
    <span id="<?php $this->sessionElemId('text-all-migrated'); ?>"></span>
</div>
<?php // Situation #3: migration finished for some subscriptions, but not for the whole server ?>
<div id="<?php $this->sessionElemId('block-migrated'); ?>" style="display: none;">
    <span id="<?php $this->sessionElemId('text-migrated'); ?>"></span>
</div>
<?php // Situation #4: not started, for example if bad SSH password was specified and migration list was not create ?>
<div id="<?php $this->sessionElemId('block-not-started'); ?>" style="display: none;">
    <span id="<?php $this->sessionElemId('text-not-started'); ?>">-</span>
</div>