Your IP : 216.73.216.86


Current Path : /var/www/homesaver/www/bitrix/modules/webdebug.excel/admin/
Upload File :
Current File : /var/www/homesaver/www/bitrix/modules/webdebug.excel/admin/webdebug_excel_ajax_start.php

<?
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php");
require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/webdebug.excel/prolog.php');
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/webdebug.excel/include.php");
IncludeModuleLangFile(__FILE__);

$obJSPopup = new CJSPopup();
$obJSPopup->ShowTitlebar(GetMessage("WEBDEBUG_EXCEL_AJAX_WINDOW_TITLE"));

?>

<style type="text/css">
#webdebug-excel-progressbar {background:url("/bitrix/themes/.default/images/webdebug.excel/progressbar.gif") left center repeat-x; font-size:0; height:15px; margin-top:6px; overflow:hidden; width:214px;}
#webdebug-excel-warning-list {list-style:disc !important; margin:0; padding-left:24px;}
	#webdebug-excel-warning-list li {list-style:disc !important; margin:0; padding:0;}
#webdebug-excel-start-control {float:left; margin-right:20px;}
	#webdebug-excel-start-control div {margin-bottom:8px;}
		#webdebug-excel-start-control div input, #webdebug-excel-start-control div label {vertical-align:middle;}
</style>
<script type="text/javascript" src="/bitrix/js/webdebug.excel/jquery-1.8.3.min.js"></script>

<div id="webdebug-excel-start-warning" class="adm-info-message"><?=GetMessage('WEBDEBUG_EXCEL_AJAX_WARNING')?></div>

<form action="/bitrix/admin/webdebug_excel_ajax_import.php" method="post" name="webdebug_excel_ajax_start_form" id="webdebug-excel-ajax-start-form">
	<div>
		<table>
			<tbody>
				<tr>
					<td>
						<p style="margin-bottom:4px"><?=GetMessage('WEBDEBUG_EXCEL_AJAX_FIELD_PROFILE')?></p>
						<?
							$arProfiles = array();
							if (CModule::IncludeModule("webdebug.excel")) {
								$resProfiles = CWebdebugExcelProfile::GetList(array("SORT"=>"ASC"),array("ACTIVE"=>"Y"));
								while ($arProfile = $resProfiles->GetNext()) {
									$arProfiles[] = $arProfile;
								}
							}
						?>
						<script type="text/javascript">
						var WD_ExcelPath = [];
						<?foreach($arProfiles as $arProfile):?>
							<?$arProfileParams = unserialize($arProfile['~PARAMS']);?>
							WD_ExcelPath['p_<?=$arProfile['ID']?>'] = '<?=$arProfileParams['EXCELFILE']?>';
						<?endforeach?>
						</script>
						<select name="profile" id="webdebug-excel-profile-selector">
							<option value=""><?=GetMessage('WEBDEBUG_EXCEL_AJAX_FIELD_PROFILE_EMPTY')?></option>
							<?foreach($arProfiles as $arProfile):?>
								<option value="<?=$arProfile["ID"]?>"<?if($_REQUEST["default_profile"]==$arProfile["ID"]):?> selected="selected"<?endif?>>[<?=$arProfile["ID"]?>] <?=$arProfile["NAME"]?><?if(isset($_SESSION["WEBDEBUG"]["EXCEL"]["STATUS"][$arProfile["ID"]]) && is_array($_SESSION["WEBDEBUG"]["EXCEL"]["STATUS"][$arProfile["ID"]]) && !empty($_SESSION["WEBDEBUG"]["EXCEL"]["STATUS"][$arProfile["ID"]])):?><?=GetMessage('WEBDEBUG_EXCEL_AJAX_PROFILE_STARTED')?><?endif?></option>
							<?endforeach?>
						</select>
					</td>
					<td>
						<p style="margin-bottom:4px">&nbsp;</p>
						<div>
							<input type="checkbox" name="clear-status" value="Y" id="webdebug-excel-clear-status" /><label for="webdebug-excel-clear-status"><?=GetMessage('WEBDEBUG_EXCEL_AJAX_CLEAR_STATUS')?></label>
						</div>
					</td>
				</tr>
			</tbody>
		</table>		
		<p style="margin-bottom:4px"><?=GetMessage('WEBDEBUG_EXCEL_AJAX_FIELD_FILE')?></p>
		<?
			CAdminFileDialog::ShowScript(Array(
				"event" => "OpenExcelFile",
				"arResultDest" => Array("FORM_NAME" => "webdebug_excel_ajax_start_form", "FORM_ELEMENT_NAME" => "excelfile"),
				"arPath" => Array(),
				"select" => 'F',
				"operation" => 'O',
				"showUploadTab" => true,
				"showAddToMenuTab" => false,
				"fileFilter" => 'xls,xlsx',
				"allowAllFiles" => true,
				"saveConfig" => true
			));
		?>
		<input type="text" name="excelfile" id="excelfile_popup" value="" style="width:80%" />
		<input type="button" value="..." id="excelfile_open_button" onclick="OpenExcelFile()" title="<?=GetMessage('WEBDEBUG_EXCEL_AJAX_FIELD_FILE_DESC')?>" />
		<br/>
		<br/>
		
		<table style="width:100%;">
			<tbody>
				<tr>
					<td>
						<div id="webdebug-excel-start-control">
							<input type="hidden" name="start" value="Y" id="webdebug-excel-start-flag" />
							<input type="hidden" name="continue" value="N" id="webdebug-excel-continue-flag" />
							<input type="button" value="<?=GetMessage('WEBDEBUG_EXCEL_AJAX_BUTTON_START')?>" id="webdebug-excel-start-submit" />
							<input type="button" value="<?=GetMessage('WEBDEBUG_EXCEL_AJAX_BUTTON_STOP')?>" id="webdebug-excel-stop-submit" disabled="disabled" />
						</div>
					</td>
					<td>
						<div id="webdebug-excel-progressbar">&nbsp;</div>
					</td>
				</tr>
			</tbody>
		</table>
		
		
		<div style="clear:left"></div>
		<br/>
		
		<div id="webdebug-excel-ajax-container"></div>
		
	</div>
</form>

<script type="text/javascript">
$('#webdebug-excel-profile-selector').change(function(){
	$('#excelfile_popup').val(WD_ExcelPath['p_'+$(this).val()]);
}).change();
function WebdebugExcelShowLoader(Flag) {
	if (Flag) {
		$("#webdebug-excel-progressbar").show();
	} else {
		$("#webdebug-excel-progressbar").hide();
	}
}
WebdebugExcelShowLoader(false);
function WebdebugExcelDoImport(Timeout, Continue, Message) {
	$("#webdebug-excel-ajax-container").data("stopped","N");
	if (Message) {
		$("#webdebug-excel-ajax-container").html(Message);
	}
	setTimeout(function(){
		WebdebugExcelShowLoader(true);
		if (Continue==true) {
			$("#webdebug-excel-start-flag").val("N");
			$("#webdebug-excel-continue-flag").val("Y");
		}
		if (Continue!=false) {
			$('#webdebug-excel-clear-status').removeAttr('checked');
		}
		var Data = $("#webdebug-excel-ajax-start-form").serialize();
		var URL = $("#webdebug-excel-ajax-start-form").attr("action");
		$("#webdebug-excel-start-submit").attr("disabled","disabled");
		$("#webdebug-excel-stop-submit").removeAttr("disabled");
		$.ajax({
			url: URL,
			type: "GET",
			data: Data,
			success: function(res) {
				if ($("#webdebug-excel-ajax-container").data("stopped")!="Y") {
					$("#webdebug-excel-ajax-container").html(res);
				}
			}
		});
	},Timeout);
}
function WebdebugExcelStopImport(Message) {
	$("#webdebug-excel-start-flag").val("Y");
	$("#webdebug-excel-continue-flag").val("N");
	$("#webdebug-excel-stop-submit").attr("disabled","disabled");
	$("#webdebug-excel-start-submit").removeAttr("disabled");
	$("#webdebug-excel-ajax-container").data("stopped","Y")
	WebdebugExcelShowLoader(false);
	if (Message) {
		//alert(Message);
		$('#webdebug-excel-ajax-container').html(Message);
	}
}
$("#webdebug-excel-start-submit").click(function(){
	WebdebugExcelDoImport(0, false);
	$("#webdebug-excel-ajax-container").html("");
	return false;
});
$("#webdebug-excel-stop-submit").click(function(){
	WebdebugExcelStopImport("");
	return false;
});
</script>