GetGroupRight("sender"); if($POST_RIGHT=="D") $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); $sTableID = "tbl_sender_contact"; if($_REQUEST["action"]=="js_pull" && check_bitrix_sessid() && $POST_RIGHT>="W") { require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_js.php"); $connectorCountInfo = '('.htmlspecialcharsbx($_REQUEST['CONNECTOR_COUNT_INFO_CURR']).' '.GetMessage('CONTACT_ADM_PULL_FROM').' '.htmlspecialcharsbx($_REQUEST['CONNECTOR_COUNT_INFO_ALL']).')'; $connectorDataPage = intval($_REQUEST['CONNECTOR_PAGE']); $isShowConnectorInfo = ($connectorDataPage <= 0); $isShowNextButton = (bool) intval($_REQUEST['CONNECTOR_NEXT_EXIST']); $isPulling = false; $isUpdateList = false; $connector = null; $endpoint = $_REQUEST['CONNECTOR_ENDPOINT']; if(is_array($endpoint) && isset($endpoint['MODULE_ID']) && !empty($endpoint['CODE'])) $connector = \Bitrix\Sender\ConnectorManager::getConnector($endpoint); if($connector) { if($isShowConnectorInfo) { $countAll = $connector->getDataCount(); $message = array( "MESSAGE" => $connector->getName().($connectorCountInfo), "DETAILS" => GetMessage("CONTACT_ADM_PULL") .'#PROGRESS_BAR#' .'

'.GetMessage("CONTACT_ADM_PULL_ALL").' '.($countAll).' ' , "HTML"=>true, "TYPE"=>"PROGRESS", "PROGRESS_TOTAL" => $countAll, "PROGRESS_VALUE" => 0, "BUTTONS" => array( array( "ID" => "btn_start", "VALUE" => GetMessage("CONTACT_ADM_BTN_START"), "ONCLICK" => "Start()", ), ) ); if($isShowNextButton) { $message["BUTTONS"][] = array( "ID" => "btn_next", "VALUE" => GetMessage("CONTACT_ADM_BTN_SKIP"), "ONCLICK" => "Next()", ); } } else { $timeout = \COption::GetOptionInt("sender", "interval"); $arPullResult = \Bitrix\Sender\ContactTable::addFromConnector($connector, $connectorDataPage, $timeout); $arPullResult['COUNT_NEW'] += intval($_REQUEST['COUNTER_ADDRESS_NEW']); $arPullResult['COUNT_ERROR'] += intval($_REQUEST['COUNTER_ADDRESS_ERROR']); $message = array( "MESSAGE" => $connector->getName().($connectorCountInfo), "DETAILS" => ($arPullResult['STATUS'] ? GetMessage("CONTACT_ADM_PULLING") : GetMessage("CONTACT_ADM_PULLED")) .'#PROGRESS_BAR#' .'

'.GetMessage("CONTACT_ADM_PULL_ALL").' '.($arPullResult['COUNT_ALL']).'

' .'

'.GetMessage("CONTACT_ADM_PULL_NEW").' '.($arPullResult['COUNT_NEW']).'

' .'

'.GetMessage("CONTACT_ADM_PULL_ERROR").' '.($arPullResult['COUNT_ERROR']).'

' , "HTML"=>true, "TYPE"=>"PROGRESS", "PROGRESS_TOTAL" => $arPullResult['COUNT_ALL'], "PROGRESS_VALUE" => $arPullResult['COUNT_PROGRESS'], "BUTTONS" => array() ); if($arPullResult['STATUS']) { $message["BUTTONS"][] = array( "ID" => "btn_stop", "VALUE" => GetMessage("CONTACT_ADM_BTN_STOP"), "ONCLICK" => "Stop()", ); $message["BUTTONS"][] = array( "ID" => "btn_cont", "VALUE" => GetMessage("CONTACT_ADM_BTN_CONT"), "ONCLICK" => "Cont()", ); $isPulling = true; } else { $isUpdateList = true; } if($isShowNextButton) { $message["BUTTONS"][] = array( "ID" => "btn_next", "VALUE" => GetMessage("CONTACT_ADM_BTN_NEXT"), "ONCLICK" => "Next()", ); } ?> show(); if($isPulling) { ?>