public function testprogress_bar_flush()
 {
     //execute the method and test if it doesn't throw an exception.
     //this method uses flush so we cannot get and verify content printed
     try {
         progress_bar_flush(false);
         $this->assertTrue(true);
     } catch (Exception $e) {
         $this->fail();
     }
 }
Ejemplo n.º 2
0
function update_progress_bar($name, $current, $total)
{
    $percent = $current / $total * 100;
    $remain = 100 - $percent;
    $status = floor($percent);
    //scale to a larger size
    $percent *= 2;
    $remain *= 2;
    if ($remain == 0) {
        $remain = 1;
    }
    if ($status == 100) {
        echo "<script>document.getElementById('{$name}_remain_bar').style.backgroundColor='#cccccc';</script>";
    }
    if ($status == 0) {
        echo "<script>document.getElementById('{$name}_remain_bar').style.backgroundColor='#ffffff';</script>";
        echo "<script>document.getElementById('{$name}_complete_bar').style.backgroundColor='#ffffff';</script>";
    }
    if ($status > 0) {
        echo "<script>document.getElementById('{$name}_complete_bar').style.backgroundColor='#cccccc';</script>";
    }
    if ($percent == 0) {
        $percent = 1;
    }
    echo "<script>\n\t\tdocument.getElementById('{$name}_complete_bar').width='{$percent}px';\n\t\tdocument.getElementById('{$name}_complete_bar').innerHTML = '{$status}%';\n\t\tdocument.getElementById('{$name}_remain_bar').width='{$remain}px';\n\t\t</script>";
    progress_bar_flush();
}
Ejemplo n.º 3
0
 * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/.
 * If you do not agree to all of the applicable terms or do not have the
 * authority to bind the entity as an authorized representative, then do not
 * install or use this SugarCRM file.
 *
 * Copyright (C) SugarCRM Inc. All rights reserved.
 */
set_time_limit(3600);
ini_set('default_socket_timeout', 360);
global $theme, $sugar_config;
insert_popup_header($theme);
require_once 'modules/Sync/SyncHelper.php';
require_once 'soap/SoapHelperFunctions.php';
require_once 'include/utils/progress_bar_utils.php';
global $soapclient, $soap_server, $sync_modules;
progress_bar_flush();
if (isset($_GET['check_available'])) {
    echo get_form_header(translate('LBL_CHECKING_SYNC_AVAILABLE', 'Sync'), '', false);
    display_flow_bar('check_sync_available', 0.2);
    $start_time = $soapclient->call('get_gmt_time', array());
    destroy_flow_bar('check_sync_available');
    if ($start_time) {
        $_SESSION['soap_server_available'] = true;
        echo '<b>' . translate('LBL_SERVER_AVAILABLE', 'Sync') . '</b>';
        sleep(1);
        if (isset($_REQUEST['clean_sync'])) {
            echo '<script>document.location.href="index.php?action=Popup&module=Sync&clean_sync=' . $_REQUEST['clean_sync'] . '"</script>';
        } else {
            echo '<script>document.location.href="index.php?action=Popup&module=Sync";</script>';
        }
        die;