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_profile_edit.php

<?
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php");
require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/webdebug.excel/install/demo.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__);

if (webdebug_excel_demo_expired()) {
	require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php");
	webdebug_excel_show_demo();
	require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin.php");
	die();
}

$ModuleRights = $APPLICATION->GetGroupRight("webdebug.excel");
if($ModuleRights=="D") {
	$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}

$APPLICATION->SetTitle(GetMessage("WEBDEBUG_EXCEL_APPLICATION_TITLE"));

require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php");

if (!webdebug_excel_demo_expired()) {
	webdebug_excel_show_demo();
}

$Time1 = WebdebugExcelGetmicrotimeX();

function WebdebugSelectBoxFromArray($Name, $Values, $Selected="", $Default="", $AddToTag="") {
	?>
	<select name="<?=$Name?>"<?if(trim($AddToTag)!=""):?> <?=trim($AddToTag)?><?endif?>>
		<?if($Default):?><option value="none"><?=$Default?></option><?endif?>
		<?foreach($Values as $Key => $Value):?>
		<option value="<?=$Key?>"<?if($Selected!="" && $Selected!="none" && $Key==$Selected):?> selected="selected"<?endif?>><?=$Value?></option>
		<?endforeach?>
	</select>
	<?
}

$MaxExecutionTime = IntVal(ini_get("max_execution_time"));

global $DB;
global $APPLICATION;

$ID = IntVal($_GET["ID"]);
$Mode = "add";
if ($ID>0) $Mode = "edit";

if (COption::GetOptionString('webdebug.excel','use_version')==2) {
	LocalRedirect('wd_excel2_profile.php?ID='.$ID.'&lang='.LANGUAGE_ID);
}

/////////////////////////////////////////////////////////////////////////////////////////////
// Defaults
/////////////////////////////////////////////////////////////////////////////////////////////
$arFields = array(
	"ACTIVE" => "Y",
	"NAME" => "",
	"SORT" => "100",
	"DESCRIPTION" => "",
);

$EmptyName = false;
if (isset($_POST["save"]) && trim($_POST["save"])!="" || isset($_POST["apply"]) && trim($_POST["apply"])!="") {
	$arSaveFields = $_POST["fields"];
	if (!isset($arSaveFields["ACTIVE"]) || $arSaveFields["ACTIVE"]=="") $arSaveFields["ACTIVE"]="N";
	if (!is_numeric($arSaveFields["SORT"])) $arSaveFields["SORT"]="100";
	if (CModule::IncludeModule("webdebug.excel")) {
		$WebdebugExcelProfile = new CWebdebugExcelProfile;
		foreach ($arFields as $Key => $Value) {
			if (!isset($arSaveFields[$Key])) {
				$arSaveFields[$Key] = $Value;
			}
		}
		$arParams = array();
		foreach($arSaveFields as $Key => $Value) {
			if (!in_array($Key, CWebdebugExcelProfile::GetAvailableFields())) {
				$arParams[$Key] = $Value;
				unset($arSaveFields[$Key]);
			}
		}
		if (!isset($arParams["DEACTIVE_MISSING"]) || trim($arParams["DEACTIVE_MISSING"])=="") $arParams["DEACTIVE_MISSING"] = "N";
		if (!isset($arParams["DEACTIVE_IF_ZERO_PRICE"]) || trim($arParams["DEACTIVE_IF_ZERO_PRICE"])=="") $arParams["DEACTIVE_IF_ZERO_PRICE"] = "N";
		if (!isset($arParams["DEACTIVE_IF_ZERO_AMOUNT"]) || trim($arParams["DEACTIVE_IF_ZERO_AMOUNT"])=="") $arParams["DEACTIVE_IF_ZERO_AMOUNT"] = "N";
		if (!isset($arParams["REDUCE"]) || trim($arParams["REDUCE"])=="") $arParams["REDUCE"] = "N";
		$arSaveFields["PARAMS"] = serialize($arParams);
		// serialize settings
		if ($Mode=="edit") {
			$Res = $WebdebugExcelProfile->Update($ID, $arSaveFields);
		} else {
			$Res = $WebdebugExcelProfile->Add($arSaveFields);
			if (is_numeric($Res)) {
				$ID = $Res;
			} elseif (trim($_POST["fields"]["NAME"])=="") {
				$EmptyName = true;
			}
		}
		if (is_numeric($Res)) {
			if (isset($_POST["save"]) && trim($_POST["save"])!="") {
				LocalRedirect("/bitrix/admin/webdebug_excel_profiles.php?lang=".LANGUAGE_ID);
			} else {
				LocalRedirect("/bitrix/admin/webdebug_excel_profile_edit.php?ID={$ID}&lang=".LANGUAGE_ID."&WebdebugExcelProfileTabControl_active_tab=".$_REQUEST["WebdebugExcelProfileTabControl_active_tab"]);
			}
		}
	} else ShowError(GetMessage("WEBDEBUG_EXCEL_ERROR_ITEM_NOT_FOUND"));
}
/////////////////////////////////////////////////////////////////////////////////////////////

if ($ID>0) {
	$Res = CWebdebugExcelProfile::GetByID($ID);
	$arFields = $Res->GetNext();
	$arFields["PARAMS"] = trim($arFields["~PARAMS"])!="" ? unserialize($arFields["~PARAMS"]) : array();
}
if ((!isset($arFields["PARAMS"])) || !is_array($arFields["PARAMS"])) {
	$arFields["PARAMS"] = array(); 
}

// Deleting Profile
if ($_GET["action"]=="delete" && IntVal($_GET["ID"])>0 && check_bitrix_sessid()) {
	$_GET["ID"] = IntVal($_GET["ID"]);
	$WebdebugExcelProfile = new CWebdebugExcelProfile;
	$WebdebugExcelProfile->Delete($_GET["ID"]);
	LocalRedirect("webdebug_excel_profiles.php?lang=".LANGUAGE_ID);
}

// MenuItem: Profiles
$aMenu[] = array(
	"TEXT"	=> GetMessage("WEBDEBUG_EXCEL_TOOLBAR_LIST_NAME"),
	"LINK"	=> "/bitrix/admin/webdebug_excel_profiles.php?lang=".LANGUAGE_ID,
	"ICON"	=> "btn_list",
	"TITLE"	=> GetMessage("WEBDEBUG_EXCEL_TOOLBAR_LIST_DESC"),
);
if ($Mode == "edit") {
	// MenuItem: Import
	global $APPLICATION;
  $aMenu[] = array(
    "TEXT" => GetMessage("WEBDEBUG_EXCEL_TOOLBAR_IMPORT_NAME"),
    "LINK" => "javascript:".$APPLICATION->GetPopupLink(
			array(
				"URL" => "/bitrix/admin/webdebug_excel_ajax_start.php?lang=".LANGUAGE_ID."&public=Y&bxpublic=Y&default_profile=".$ID."&str_URI=".urlencode($APPLICATION->GetCurPageParam("", array("clear_cache", "sessid", "login", "logout", "register", "forgot_password", "change_password", "confirm_registration", "confirm_code", "confirm_user_id", "bitrix_include_areas", "show_page_exec_time", "show_include_exec_time", "show_sql_stat", "show_link_stat")))."&site=".SITE_ID,
				"PARAMS" => array(
					'width' => COption::GetOptionString("webdebug.excel","popup_width"),
					'height' => COption::GetOptionString("webdebug.excel","popup_height"),
					'resize' => false,
					'resizable' => false,
				)
			)
		),
    "TITLE" => GetMessage("WEBDEBUG_EXCEL_TOOLBAR_IMPORT_DESC"),
    "ICON" => "btn_green",
  );
	// MenuItem: Add
	$aMenu[] = array(
		"TEXT"	=> GetMessage("WEBDEBUG_EXCEL_TOOLBAR_ADD_NAME"),
		"LINK"	=> "/bitrix/admin/webdebug_excel_profile_edit.php?lang=".LANGUAGE_ID,
		"ICON"	=> "btn_new",
		"TITLE"	=> GetMessage("WEBDEBUG_EXCEL_TOOLBAR_ADD_DESC"),
	);
	// MenuItem: Delete
	$aMenu[] = array(
		"TEXT"	=> GetMessage("WEBDEBUG_EXCEL_TOOLBAR_DELETE_NAME"),
		"LINK"	=> "javascript:if (confirm('".GetMessage("WEBDEBUG_EXCEL_TOOLBAR_DELETE_NAME_CONFIRM")."')) window.location='/bitrix/admin/webdebug_excel_profile_edit.php?action=delete&ID=".$ID."&lang=".LANGUAGE_ID."&".bitrix_sessid_get()."';",
		"ICON"	=> "btn_delete",
		"TITLE"	=> GetMessage("WEBDEBUG_EXCEL_TOOLBAR_DELETE_DESC"),
	);
}
$context = new CAdminContextMenu($aMenu);
$context->Show();
$show_property_type = COption::GetOptionString('webdebug.excel','show_property_type');
if ($EmptyName) ShowError(GetMessage('WEBDEBUG_EXCEL_ERROR_EMPTY_NAME'));
?>

<?if($WebdebugExcelProfile->LAST_ERROR) ShowError($WebdebugExcelProfile->LAST_ERROR);?>

<?if(($Mode=="edit" && !empty($arFields)) || $Mode=="add"):?>
	<?
	$arTabs = array();
	$arTabs[] = array("DIV"=>"general", "TAB"=>GetMessage("WEBDEBUG_EXCEL_TAB_GENERAL_NAME"), "ICON"=>"webdebug-excel-profile-tabs-general", "TITLE"=>GetMessage("WEBDEBUG_EXCEL_TAB_GENERAL_DESC"));
	$arTabs[] = array("DIV"=>"file", "TAB"=>GetMessage("WEBDEBUG_EXCEL_TAB_FILE_NAME"), "ICON"=>"webdebug-excel-profile-tabs-general", "TITLE"=>GetMessage("WEBDEBUG_EXCEL_TAB_FILE_DESC"));
	if ($arFields["PARAMS"]["EXCELFILE"]) {
		if (is_file($_SERVER["DOCUMENT_ROOT"].$arFields["PARAMS"]["EXCELFILE"])) {
			define ("WEBDEBUG_EXCEL_FILE_LOADED",true);
			$Excel = new CWebdebugExcel($_SERVER["DOCUMENT_ROOT"].$arFields["PARAMS"]["EXCELFILE"]);
			$ExcelFileName = $arFields["PARAMS"]["EXCELFILE"];
			$arTabs[] = array("DIV"=>"settings", "TAB"=>GetMessage("WEBDEBUG_EXCEL_TAB_SETTINGS_NAME"), "ICON"=>"webdebug-excel-profile-tabs-settings", "TITLE"=>GetMessage("WEBDEBUG_EXCEL_TAB_SETTINGS_DESC"));
			$arTabs[] = array("DIV"=>"fields", "TAB"=>GetMessage("WEBDEBUG_EXCEL_TAB_FIELDS_NAME"), "ICON"=>"webdebug-excel-profile-tabs-fields", "TITLE"=>GetMessage("WEBDEBUG_EXCEL_TAB_FIELDS_DESC"));
		} else {
			ShowError(GetMessage('WEBDEBUG_EXCEL_ERROR_WRONG_FILE'));
		}
	}
	?>
	<?$APPLICATION->AddHeadString('<script type="text/javascript" src="/bitrix/js/webdebug.excel/jquery-1.8.3.min.js"></script>');?>
	<script type="text/javascript">
	function WebdebugParseInt(Value) {
		Value = parseInt(Value);
		if (isNaN(Value)) Value=0;
		return Value;
	}
	function WebdebugParseFloat(Value) {
		Value = parseFloat(Value);
		if (isNaN(Value)) Value=0;
		return Value;
	}
	/***
	@title:
	Super Simple Tabs

	@version:
	1.4

	@author:
	Andreas Lagerkvist

	@date:
	2009-09-17
	2012-02-29

	@url:
	http://andreaslagerkvist.com/jquery/super-simple-tabs/

	@license:
	http://creativecommons.org/licenses/by/3.0/

	@copyright:
	2008 Andreas Lagerkvist (andreaslagerkvist.com)

	@requires:
	jquery
	***/

	jQuery.fn.WebdebugTabs = function (conf) {
		
		var config = jQuery.extend({
			selected:	1, 				// Which tab is initially selected (hash overrides this)
			selectedClass: 'selected',
			show:		'fadeIn', 		// Show animation
			hide:		'fadeOut', 		// Hide animation
			duration:	0,				// Animation duration
			before:	function () {},	// Callback before tab has been clicked,
			after:	function () {},	// Callback after tab has been clicked,
			use_hash: true
		}, conf);

		return this.each(function () {
		
			var ul = jQuery(this);
			ul.animating = false;
			var ipl	= 'a[href^="#"]';

			// Go through all the in-page links in the ul
			// and hide all but the selected's contents
			ul.find(ipl).each(function (i) {
				var link = jQuery(this);

				if ((i + 1) === config.selected) {
					link.addClass(config.selectedClass);
				} else {
					jQuery(link.attr('href')).hide();
				}
			});

			// When clicking the UL (or anything within)
			ul.click(function (e) {
				var clicked	= jQuery(e.target);
				var link	= false;

				if (clicked.is(ipl)) {
					link = clicked;
				} else {
					var parent = clicked.parents(ipl);
					if (parent.length) {
						link = parent;
					}
				}
				
				if (!link || link.hasClass(config.selectedClass)) return false;

				// Only continue if the clicked element was an in page link
				if (link) {
					var selected = ul.find('a.'+config.selectedClass);

					if (selected.length) {
						// Remove currently .selected, hide the element it was pointing to
						if (ul.animating!==true) {
							ul.animating = true;
							config.before(link, link.attr('href'), ul.find("a").index(link), false);
							jQuery(selected.removeClass(config.selectedClass).attr('href'))[config.hide](config.duration, function () {
								// Then show the element the clicked link was pointing to
								jQuery(link.attr('href'))[config.show](config.duration, function () {
									config.after(link, link.attr('href'), ul.find("a").index(link), false);
									ul.animating = false;
								});
							});
							link.addClass(config.selectedClass);
						}
					} else {
						jQuery(link.addClass(config.selectedClass).attr('href'))[config.show](config.duration, function () {
							config.after(link, link.attr('href'), ul.find("a").index(link), false);
						});
					}

					// Update the hash
					if (config.use_hash) {
						WebdebugTabsTabsUpdateHash(link.attr('href'));
					}

					return false;
				}
			});

			if (config.use_hash) {
				// If a hash is set, click that tab
				var hash = window.location.hash;
			}

			if (config.use_hash && hash) {
				// Hide add
				ul.find('a').each(function(){
					jQuery($(this).attr("href")).hide();
				});
				// We can't simply .click() the link since that will run the show/hide animation
				jQuery(ul.find('a').removeClass(config.selectedClass).attr('href')).hide();
				jQuery(ul.find('a[href="' + hash + '"]').addClass(config.selectedClass).attr('href')).show();
				config.after(false, hash, config.selected, true);
			}
		});
	};

	// http://stackoverflow.com/questions/1489624/modifying-document-location-hash-without-page-scrolling#answer-1489802
	function WebdebugTabsTabsUpdateHash (hash) {
		hash = hash.replace( /^#/, '' );
		var fx, node = $( '#' + hash );
		if ( node.length ) {
			fx = $( '<div></div>' )
						.css({
								position:'fixed',
								left:0,
								top:0,
								visibility:'hidden'
						})
						.attr( 'id', hash )
						.appendTo( document.body );
			node.attr( 'id', '' );
		}
		document.location.hash = hash;
		if ( node.length ) {
			fx.remove();
			node.attr( 'id', hash );
		}
	}
	</script>
	<?
	function WDOptSel($Value1, $Value2) {
		if ($Value1==$Value2) {
			print ' selected="selected"';
		}
	}
	?>
	<form method="post" action="" enctype="multipart/form-data" name="post_form" id="webdebug-excel-parameters">
		<?$tabControl = new CAdminTabControl("WebdebugExcelProfileTabControl", $arTabs);?>
		<?$tabControl->Begin();?>
		<?$tabControl->BeginNextTab();?>
		<?// General settings ?>
		<tr id="tr_active">
			<td class="field-name" width="40%"><label for="webdebug-label-active"><?=GetMessage("WEBDEBUG_EXCEL_FIELD_ACTIVE")?></label>:</td>
			<td class="field-data">
				<input id="webdebug-label-active" type="checkbox" name="fields[ACTIVE]" value="Y"<?if($arFields["ACTIVE"]=="Y"):?> checked="checked"<?endif?> />
			</td>
		</tr>
		<tr id="tr_name">
			<td class="field-name" width="40%"><span class="required">*</span><?=GetMessage("WEBDEBUG_EXCEL_FIELD_NAME")?>:</td>
			<td class="field-data">
				<input type="text" name="fields[NAME]" value="<?=$arFields["NAME"]?>" size="60" maxlength="255" />
			</td>
		</tr>
		<tr id="tr_sort">
			<td class="field-name" width="40%"><?=GetMessage("WEBDEBUG_EXCEL_FIELD_SORT")?>:</td>
			<td class="field-data">
				<input type="text" name="fields[SORT]" value="<?=$arFields["SORT"]?>" size="10" maxlength="9" />
			</td>
		</tr>
		<tr id="tr_description">
			<td class="field-name" width="40%"><?=GetMessage("WEBDEBUG_EXCEL_FIELD_DESCRIPTION")?>:</td>
			<td class="field-data">
				<textarea name="fields[DESCRIPTION]" cols="47" rows="4"><?=$arFields["DESCRIPTION"]?></textarea>
			</td>
		</tr>
		<?$tabControl->BeginNextTab();?>
		<tr>
			<td class="field-name" width="40%"><?=GetMessage("WEBDEBUG_EXCEL_FILE_LABEL")?>:</td>
			<td class="field-data">
				<?
					CAdminFileDialog::ShowScript(Array(
						"event" => "OpenExcelFile",
						"arResultDest" => Array("FORM_NAME" => "post_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="fields[EXCELFILE]" id="excelfile" value="<?=$arFields["PARAMS"]["EXCELFILE"]?>" style="width:80%" />
				<input type="button" value="<?=GetMessage("WEBDEBUG_EXCEL_FILE_SELECT");?>" id="excelfile_open_button" />
				<script type="text/javascript">
					document.getElementById("excelfile_open_button").onclick = OpenExcelFile;
				</script>
			</td>
		</tr>
		<tr>
			<td class="field-name" width="40%"><?=GetMessage("WEBDEBUG_EXCEL_FILE_STEPTIME")?></td>
			<td class="field-value">
				<?
					$StepTime = 27;
					if ($MaxExecutionTime+3 > $StepTime) {
						$StepTime = $MaxExecutionTime - 3;
					}
					if ($arFields["PARAMS"]["STEPTIME"]>0) {
						$StepTime = $arFields["PARAMS"]["STEPTIME"];
					}
				?>
				<p><input type="text" name="fields[STEPTIME]" value="<?=$StepTime?>" /></p>
			</td>
		</tr>
		<tr>
			<td class="field-name" width="40%"><?=GetMessage("WEBDEBUG_EXCEL_MAX_EXECUTION_TIME")?></td>
			<td class="field-value">
				<p style="color:<?if($MaxExecutionTime>29):?>green<?else:?>red<?endif?>"><strong><?=$MaxExecutionTime?><?=GetMessage("WEBDEBUG_EXCEL_FILE_LOADTIME_SECONDS")?></strong></p>
			</td>
		</tr>
		<?if(defined("WEBDEBUG_EXCEL_FILE_LOADED") && WEBDEBUG_EXCEL_FILE_LOADED===true):?>
			<tr>
				<td class="field-name" width="40%"><?=GetMessage("WEBDEBUG_EXCEL_FILE_LOADTIME")?></td>
				<td class="field-value">
					<?$Time2 = number_format(WebdebugExcelGetmicrotimeX()-$Time1,2,".","");?>
					<p style="color:<?if($Time2>29):?>red<?else:?>green<?endif?>"><strong><?=$Time2?><?=GetMessage("WEBDEBUG_EXCEL_FILE_LOADTIME_SECONDS")?></strong></p>
				</td>
			</tr>
		<?endif?>
		<?if(defined("WEBDEBUG_EXCEL_FILE_LOADED") && WEBDEBUG_EXCEL_FILE_LOADED===true):?>
			<?$tabControl->BeginNextTab();?>
			<tr>
				<td class="field-name" width="40%"><label for="webdebug-label-deactive-missing"><?=GetMessage('WEBDEBUG_EXCEL_DEACTIVATE_MISSING')?></label></td>
				<td class="field-value">
					<input id="webdebug-label-deactive-missing" type="checkbox" name="fields[DEACTIVE_MISSING]" value="Y"<?if($arFields["PARAMS"]["DEACTIVE_MISSING"]=="Y"):?> checked="checked"<?endif?> />	
				</td>
			</tr>
			<tr>
				<td class="field-name" width="40%"><label for="webdebug-label-active-imported"><?=GetMessage('WEBDEBUG_EXCEL_ACTIVATE_IMPORTED')?></label></td>
				<td class="field-value">
					<input id="webdebug-label-active-imported" type="checkbox" name="fields[ACTIVATE_IMPORTED]" value="Y"<?if($arFields["PARAMS"]["ACTIVATE_IMPORTED"]=="Y"):?> checked="checked"<?endif?> />	
				</td>
			</tr>
			<?/*
			<tr>
				<td class="field-name" width="40%"><label for="webdebug-label-deactive-price"><?=GetMessage('WEBDEBUG_EXCEL_DEACTIVE_IF_ZERO_PRICE')?></label></td>
				<td class="field-value">
					<input id="webdebug-label-deactive-price" type="checkbox" name="fields[DEACTIVE_IF_ZERO_PRICE]" value="Y"<?if($arFields["PARAMS"]["DEACTIVE_IF_ZERO_PRICE"]=="Y"):?> checked="checked"<?endif?> />	
				</td>
			</tr>
			<tr>
				<td class="field-name" width="40%"><label for="webdebug-label-deactive-amount"><?=GetMessage('WEBDEBUG_EXCEL_DEACTIVE_IF_ZERO_AMOUNT')?></label></td>
				<td class="field-value">
					<input id="webdebug-label-deactive-amount" type="checkbox" name="fields[DEACTIVE_IF_ZERO_AMOUNT]" value="Y"<?if($arFields["PARAMS"]["DEACTIVE_IF_ZERO_AMOUNT"]=="Y"):?> checked="checked"<?endif?> />	
				</td>
			</tr>
			*/?>
			<tr>
				<td class="field-name" width="40%"><?=GetMessage('WEBDEBUG_EXCEL_CURRENCY_DEFAULT')?></td>
				<td class="field-value">
					<?$arCurrencies = CWebdebugExcel::GetCurrencyList();?>
					<select name="fields[CURRENCY]">
						<?foreach($arCurrencies as $arCurrency):?>
							<option value="<?=$arCurrency["CURRENCY"]?>"<?if(($arCurrency["CURRENCY"]==$arFields["PARAMS"]["CURRENCY"] || (trim($arFields["PARAMS"]["CURRENCY"])=="" && $arCurrency["DEFAULT"]=="Y")) || (trim($arFields["PARAMS"]["CURRENCY"])=="" && $arCurrency["CURRENCY"]=="RUB")):?> selected="selected"<?endif?>>[<?=$arCurrency["CURRENCY"]?>] <?=$arCurrency["FULL_NAME"]?></option>
						<?endforeach?>
					</select>
				</td>
			</tr>
			<tr>
				<td class="field-name" width="40%"><label for="webdebug-label-reduce"><?=GetMessage('WEBDEBUG_EXCEL_REDUCE')?></label></td>
				<td class="field-value">
					<input id="webdebug-label-reduce" type="checkbox" name="fields[REDUCE]" value="Y"<?if($arFields["PARAMS"]["REDUCE"]=="Y"):?> checked="checked"<?endif?> />	
				</td>
			</tr>
			<tr>
				<td class="field-name" width="40%"><?=GetMessage('WEBDEBUG_EXCEL_SECTION_METHOD')?></td>
				<td class="field-value">
					<select name="fields[SECTION_METHOD]" id="webdebug-select-section-method">
						<option value="method1"<?WDOptSel($arFields["PARAMS"]["SECTION_METHOD"],"method1")?>><?=GetMessage('WEBDEBUG_EXCEL_SECTION_METHOD_1')?></option>
						<option value="method2"<?WDOptSel($arFields["PARAMS"]["SECTION_METHOD"],"method2")?>><?=GetMessage('WEBDEBUG_EXCEL_SECTION_METHOD_2')?></option>
						<option value="method3"<?WDOptSel($arFields["PARAMS"]["SECTION_METHOD"],"method3")?>><?=GetMessage('WEBDEBUG_EXCEL_SECTION_METHOD_3')?></option>
					</select>
					<script>
					$("#webdebug-select-section-method").change(function(){
						$("#webdebug-row-section-colors").css("display",($(this).val()=="method2"?"table-row":"none"));
						$("#webdebug-row-section-depth").css("display",($(this).val()=="method1"?"table-row":"none"));
					});
					</script>
				</td>
			</tr>
			<tr id="webdebug-row-section-depth"<?if(in_array($arFields["PARAMS"]["SECTION_METHOD"],array('method2','method3'))):?> style="display:none"<?endif?>>
				<td class="field-name" width="40%"><?=GetMessage('WEBDEBUG_EXCEL_MAX_DEPTH')?></td>
				<td class="field-value">
					<input type="text" name="fields[MAX_DEPTH]" id="max_depth" value="<?=$arFields["PARAMS"]["MAX_DEPTH"]?>" size="10" maxlength="3" />
				</td>
			</tr>
			<tr id="webdebug-row-section-colors"<?if($arFields["PARAMS"]["SECTION_METHOD"]!="method2"):?> style="display:none"<?endif?>>
				<td class="field-name" width="40%"><?=GetMessage('WEBDEBUG_EXCEL_SECTION_COLOR')?></td>
				<td class="field-value">
					<textarea name="fields[SECTION_COLOR]" cols="60" rows="5"><?=$arFields["PARAMS"]["SECTION_COLOR"]?></textarea>
				</td>
			</tr>
			<tr>
				<td class="field-name" width="40%"><label for="webdebug-label-rename"><?=GetMessage('WEBDEBUG_EXCEL_REWRITE_NAME')?></label></td>
				<td class="field-value">
					<input id="webdebug-label-rename" type="checkbox" name="fields[RENAME]" value="Y"<?if($arFields["PARAMS"]["RENAME"]=="Y"):?> checked="checked"<?endif?> />	
				</td>
			</tr>
			<tr>
				<td class="field-name" width="40%"><label for="webdebug-label-recode"><?=GetMessage('WEBDEBUG_EXCEL_REWRITE_CODE')?></label></td>
				<td class="field-value">
					<input id="webdebug-label-recode" type="checkbox" name="fields[RECODE]" value="Y"<?if($arFields["PARAMS"]["RECODE"]=="Y"):?> checked="checked"<?endif?> />	
				</td>
			</tr>
			<tr>
				<td class="field-name" width="40%"><label for="webdebug-label-skip-multisection"><?=GetMessage('WEBDEBUG_EXCEL_SKIP_MULTISECTION')?></label></td>
				<td class="field-value">
					<input id="webdebug-label-skip-multisection" type="checkbox" name="fields[SKIP_MULTISECTION]" value="Y"<?if($arFields["PARAMS"]["SKIP_MULTISECTION"]=="Y"):?> checked="checked"<?endif?> />	
				</td>
			</tr>
			<tr>
				<td class="field-name" width="40%"><label for="webdebug-label-use-offers"><?=GetMessage('WEBDEBUG_EXCEL_USE_OFFERS')?></label></td>
				<td class="field-value">
					<input id="webdebug-label-use-offers" type="checkbox" name="fields[USE_OFFERS]" value="Y"<?if($arFields["PARAMS"]["USE_OFFERS"]=="Y"):?> checked="checked"<?endif?> />	
				</td>
			</tr>
			<tr>
				<td class="field-name" width="40%"><label for="webdebug-label-use-offers"><?=GetMessage('WEBDEBUG_EXCEL_DATE_FORMAT')?></label></td>
				<td class="field-value">
					<select name="fields[DATE_FORMAT]" id="webdebug-select-date-format">
						<option value="short"<?WDOptSel($arFields["PARAMS"]["DATE_FORMAT"],"short")?>><?=GetMessage('WEBDEBUG_EXCEL_DATE_FORMAT_SHORT')?></option>
						<option value="full"<?WDOptSel($arFields["PARAMS"]["DATE_FORMAT"],"full")?>><?=GetMessage('WEBDEBUG_EXCEL_DATE_FORMAT_FULL')?></option>
					</select>
				</td>
			</tr>
			<tr>
				<td class="field-name" width="40%"><label for="webdebug-label-use-html-formatting"><?=GetMessage('WEBDEBUG_EXCEL_USE_HTML_FORMATTING')?></label></td>
				<td class="field-value">
					<input id="webdebug-label-use-html-formatting" type="checkbox" name="fields[USE_HTML_FORMATTING]" value="Y"<?if($arFields["PARAMS"]["USE_HTML_FORMATTING"]=="Y"):?> checked="checked"<?endif?> />	
				</td>
			</tr>
			<?$tabControl->BeginNextTab();?>
			<tr>
				<td>
					<?
						$arSheets = $Excel->GetSheetList();
						if (!is_array($arSheets)) $arSheets = array();
					?>
					<div>
						<style type="text/css">
							#webdebug-excel-sheet-list {display:block; list-style:none; margin:0; padding:0;}
								#webdebug-excel-sheet-list li {display:inline-block; float:left; margin:0 10px 4px 0;}
									#webdebug-excel-sheet-list li a {display:inline-block;}
							.webdebug-excel-conformity-table {border:1px solid #f1f1f1; border-color:#f1f1f1 #ccd5d7 #cfd8d9 #cfd8da; border-radius:4px 4px 0 0; border-collapse:collapse; width:100%;}
								.webdebug-excel-conformity-table td {border:1px solid #cfd8da; border-bottom:1px solid #d0d7d8; font-size:13px; padding:6px 10px 12px 10px; vertical-align:middle; text-align:left; text-shadow:0 1px #fff;}
								.webdebug-excel-conformity-table td:first-child {text-align:left!important;}
								.webdebug-excel-conformity-table tr.header td {font-weight:bold; text-align:center;}
						</style>
						<ul id="webdebug-excel-sheet-list">
							<?foreach($arSheets as $SheetIndex => $strSheet):?>
								<li>
									<a href="#sheet_<?=$SheetIndex?>" class="adm-btn"<?if($arFields["PARAMS"]["SHEET_{$SheetIndex}_ACTIVE"]=="N"):?> style="color:red"<?endif?>><?=$strSheet?></a>
								</li>
							<?endforeach?>
						</ul>
						<div style="clear:left"></div>
						<div>
							<?$arIBlocks = $Excel->GetIBlockList(true);?>
							<?$arPrices = $Excel->GetPriceTypeList();?>
							<?$arStores = $Excel->GetStoresTypeList();?>
							<?foreach($arSheets as $SheetIndex => $strSheet):?>
								<?
								$ColumnAndHeaderValuesAreSet = $arFields["PARAMS"]["HEADER_COLUMN_".$SheetIndex]>=0 
																						&& $arFields["PARAMS"]["HEADER_ROW_".$SheetIndex]>=0 
																						&& $arFields["PARAMS"]["ELEMENT_COLUMN_".$SheetIndex]>=0 
																						&& $arFields["PARAMS"]["ELEMENT_ROW_".$SheetIndex]>=0
																						&& $arFields["PARAMS"]["IBLOCK_ID_FOR_SHEET_".$SheetIndex]
																						&& $arFields["PARAMS"]["SHEET_{$SheetIndex}_ACTIVE"]!="N";
								?>
								<div id="sheet_<?=$SheetIndex?>">
									<h2><?=GetMessage('WEBDEBUG_EXCEL_SHEET')?> "<?=$strSheet?>"</h2>
									<?if(!$ColumnAndHeaderValuesAreSet):?>
										<div class="adm-info-message"><?=GetMessage('WEBDEBUG_EXCEL_WARNING_PROFILE_NOT_SET')?></div>
									<?endif?>
									<div>
										<table>
											<tbody>
												<tr>
													<td width="25%">
														<p><?=GetMessage('WEBDEBUG_EXCEL_IMPORT_THIS_SHEET')?></p>
														<select name="fields[SHEET_<?=$SheetIndex?>_ACTIVE]">
															<option value="Y"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_ACTIVE"],"Y")?>><?=GetMessage('WEBDEBUG_EXCEL_BOOL_Y')?></option>
															<option value="N"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_ACTIVE"],"N")?>><?=GetMessage('WEBDEBUG_EXCEL_BOOL_N')?></option>
														</select><br/>
													</td>
													<td width="75%" colspan="3">
														<p><?=GetMessage('WEBDEBUG_EXCEL_INFOBLOCK')?></p>
														<select name="fields[IBLOCK_ID_FOR_SHEET_<?=$SheetIndex?>]">
															<option value=""><?=GetMessage('WEBDEBUG_EXCEL_INFOBLOCK_EMPTY')?></option>
															<?foreach($arIBlocks as $arIBlockType):?>
																<optgroup label="<?=$arIBlockType["NAME"]?>">
																	<?foreach($arIBlockType["ITEMS"] as $arIBlock):?>
																		<option value="<?=$arIBlock["ID"]?>"<?if($arIBlock["ID"]==$arFields["PARAMS"]["IBLOCK_ID_FOR_SHEET_".$SheetIndex]):?> selected="selected"<?endif?>>[<?=$arIBlock["ID"]?>] <?=$arIBlock["NAME"]?></option>
																	<?endforeach?>
																</optgroup>
															<?endforeach?>
														</select><br/>
													</td>
												</tr>
												<tr>
													<td width="25%">
														<p><?=GetMessage('WEBDEBUG_EXCEL_OPTION_HEADER_COLUMN')?></p>
														<div><input type="text" size="16" name="fields[HEADER_COLUMN_<?=$SheetIndex?>]" value="<?=$arFields["PARAMS"]["HEADER_COLUMN_".$SheetIndex]?>"/></div>
													</td>
													<td width="25%">
														<p><?=GetMessage('WEBDEBUG_EXCEL_OPTION_HEADER_ROW')?></p>
														<div><input type="text" size="16" name="fields[HEADER_ROW_<?=$SheetIndex?>]" value="<?=$arFields["PARAMS"]["HEADER_ROW_".$SheetIndex]?>"/></div>
													</td>
													<td width="25%">
														<p><?=GetMessage('WEBDEBUG_EXCEL_OPTION_ELEMENT_COLUMN')?></p>
														<div><input type="text" size="16" name="fields[ELEMENT_COLUMN_<?=$SheetIndex?>]" value="<?=$arFields["PARAMS"]["ELEMENT_COLUMN_".$SheetIndex]?>"/></div>
													</td>
													<td width="25%">
														<p><?=GetMessage('WEBDEBUG_EXCEL_OPTION_ELEMENT_ROW')?></p>
														<div><input type="text" size="16" name="fields[ELEMENT_ROW_<?=$SheetIndex?>]" value="<?=$arFields["PARAMS"]["ELEMENT_ROW_".$SheetIndex]?>"/></div>
													</td>
												</tr>
											</tbody>
										</table>
									</div>
									<?if($ColumnAndHeaderValuesAreSet):?>
										<?$arHeaders = $Excel->GetSheetHeaders($SheetIndex, $arFields["PARAMS"]["HEADER_COLUMN_".$SheetIndex]-1, $arFields["PARAMS"]["HEADER_ROW_".$SheetIndex]);?>
										<?$arIBlockProps = $Excel->GetIBlockProps($arFields["PARAMS"]["IBLOCK_ID_FOR_SHEET_".$SheetIndex])?>
										<table>
											<tbody>
												<tr>
													<td width="50%">
														<p><?=GetMessage('WEBDEBUG_EXCEL_OPTION_HEADER_UNIQ')?></p>
														<select name="fields[HEADER_UNIQ_<?=$SheetIndex?>]">
															<option value=""><?=GetMessage('WEBDEBUG_EXCEL_OPTION_ELEMENT_ROW_EMPTY')?></option>
															<?foreach($arHeaders as $HeaderIndex => $arHeader):?>
																<option value="<?=$arHeader["COLUMN"]?>"<?if($arHeader["COLUMN"]==$arFields["PARAMS"]["HEADER_UNIQ_".$SheetIndex]):?> selected="selected"<?endif?>><?=$arHeader["NAME"]?></option>
															<?endforeach?>
														</select><br/><br/>
													</td>
													<td width="50%">	</td>
												</tr>
											</tbody>
										</table>
										<br/>
										<table style="width:100%;"><tbody><tr class="heading"><td colspan="3" style="border-bottom:0"><?=($arFields['PARAMS']['USE_OFFERS']=='Y'?GetMessage('WEBDEBUG_EXCEL_CORRESPONDENCE_TABLE_OFFERS'):GetMessage('WEBDEBUG_EXCEL_CORRESPONDENCE_TABLE'))?></td></tr></tbody></table>
										<?/*<br/>*/?>
										<p><?=GetMessage("WEBDEBUG_EXCEL_COLUMN_COUNT")?> <b><?=count($arHeaders)?></b>.</p>
										<?/*<br/>*/?>
										<?
											$NameDetermined = false;
											foreach ($arHeaders as $HeaderIndex => $arHeader) {
												if ($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader['COLUMN']}"]=="NAME") {
													$NameDetermined = true;
													break;
												}
											}
											if (!$NameDetermined) {
												print BeginNote();
												ShowError(GetMessage('WEBDEBUG_EXCEL_ERROR_NAME_IS_NOT_DETERMINED'));
												print EndNote();
											}
										?>
										<table style="border-collapse:collapse; width:100%;" class="webdebug-excel-conformity-table" style="border-top:none">
											<tbody>
												<tr class="header">
													<td><?=GetMessage('WEBDEBUG_EXCEL_CORRESPONDENCE_TABLE_COLUMN')?></td>
													<td><?=GetMessage('WEBDEBUG_EXCEL_CORRESPONDENCE_TABLE_CONFORMITY')?></td>
													<td><?=GetMessage('WEBDEBUG_EXCEL_CORRESPONDENCE_TABLE_VALUETYPE')?></td>
													<td style="width:100px"><?=GetMessage('WEBDEBUG_EXCEL_CORRESPONDENCE_TABLE_SEPARATOR')?></td>
												</tr>
												<?foreach($arHeaders as $HeaderIndex => $arHeader):?>
													<tr>
														<td><?=$arHeader["NAME"]?></td>
														<td>
															<?$ParamKey = "SHEET_".$SheetIndex."_COLUMN_".$arHeader["COLUMN"];?>
															<?$ParamVal = $arFields["PARAMS"][$ParamKey];?>
															<select name="fields[SHEET_<?=$SheetIndex?>_COLUMN_<?=$arHeader["COLUMN"]?>]" style="width:100%">
																<option value=""><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_EMPTY')?></option>
																<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_GROUP_LOGIC')?>">
																	<option value="SKIP_FLAG"<?WDOptSel($ParamVal,"SKIP_FLAG")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_SKIP')?></option>
																</optgroup>
																<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_GROUP_IBLOCK')?>">
																	<option value="NAME"<?WDOptSel($ParamVal,"NAME")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_NAME')?></option>
																	<option value="CODE"<?WDOptSel($ParamVal,"CODE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_CODE')?></option>
																	<option value="SORT"<?WDOptSel($ParamVal,"SORT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_SORT')?></option>
																	<option value="PREVIEW_TEXT"<?WDOptSel($ParamVal,"PREVIEW_TEXT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_PREVIEW_TEXT')?></option>
																	<option value="PREVIEW_TEXT_TYPE"<?WDOptSel($ParamVal,"PREVIEW_TEXT_TYPE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_PREVIEW_TEXT_TYPE')?></option>
																	<option value="DETAIL_TEXT"<?WDOptSel($ParamVal,"DETAIL_TEXT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_DETAIL_TEXT')?></option>
																	<option value="DETAIL_TEXT_TYPE"<?WDOptSel($ParamVal,"DETAIL_TEXT_TYPE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_DETAIL_TEXT_TYPE')?></option>
																	<option value="PREVIEW_PICTURE"<?WDOptSel($ParamVal,"PREVIEW_PICTURE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_PREVIEW_PICTURE')?></option>
																	<option value="DETAIL_PICTURE"<?WDOptSel($ParamVal,"DETAIL_PICTURE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_DETAIL_PICTURE')?></option>
																</optgroup>
																<?if($arFields["PARAMS"]["SECTION_METHOD"]!="method2" && IntVal($arFields["PARAMS"]["MAX_DEPTH"])>=1):?>
																	<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_GROUP_SECTION')?>">
																		<?if($arFields["PARAMS"]["SECTION_METHOD"]=="method1"):?>
																			<?for($i=1;$i<=IntVal($arFields["PARAMS"]["MAX_DEPTH"]);$i++):?>
																				<option value="SECTION<?=$i?>"<?WDOptSel($ParamVal,"SECTION".$i)?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_SECTION_LEFT')?><?=$i?><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_SECTION_RIGHT')?></option>
																			<?endfor?>
																		<?endif?>
																	</optgroup>
																<?endif?>
																<?if(Cmodule::IncludeModule("catalog")):?>
																	<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_GROUP_CATALOG')?>">
																		<?foreach($arPrices as $arPrice):?>
																			<option value="PRICE_<?=$arPrice["ID"]?>"<?WDOptSel($ParamVal,"PRICE_".$arPrice["ID"])?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_PRICE')?> "<?=$arPrice["NAME_LANG"]?>"</option>
																		<?endforeach?>
																		<option value="CURRENCY"<?WDOptSel($ParamVal,"CURRENCY")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_CURRENCY')?></option>
																		<option value="QUANTITY"<?WDOptSel($ParamVal,"QUANTITY")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_QUANTITY')?></option>
																		<option value="WEIGHT"<?WDOptSel($ParamVal,"WEIGHT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_WEIGHT')?></option>
																		<option value="LENGTH"<?WDOptSel($ParamVal,"LENGTH")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_LENGTH')?></option>
																		<option value="WIDTH"<?WDOptSel($ParamVal,"WIDTH")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_WIDTH')?></option>
																		<option value="HEIGHT"<?WDOptSel($ParamVal,"HEIGHT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_HEIGHT')?></option>
																		<?foreach($arStores as $arStore):?>
																			<option value="STORE_<?=$arStore["ID"]?>"<?WDOptSel($ParamVal,"STORE_".$arStore["ID"])?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_STORE')?> "<?=$arStore["TITLE"]?>"<?if($arStore["ACTIVE"]!="Y"):?><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_STORE_NOT_ACTIVE')?><?endif?></option>
																		<?endforeach?>
																	</optgroup>
																<?endif?>
																<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_GROUP_PROPERTIES')?><?if(empty($arIBlockProps)):?><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_GROUP_PROPERTIES_EMPTY')?><?endif?>">
																	<?foreach($arIBlockProps as $arProp):?>
																		<option value="PROPERTY_<?=$arProp["ID"]?>"<?WDOptSel($ParamVal,"PROPERTY_".$arProp["ID"])?>><?=$arProp["NAME"]?> [<?=($arProp["CODE"]?$arProp["CODE"]:$arProp["ID"])?><?if($show_property_type!="N"):?>, <?=$arProp["PROPERTY_TYPE"]?><?endif?>]</option>
																	<?endforeach?>
																</optgroup>
															</select>
														</td>
														<td>
															<select name="fields[SHEET_<?=$SheetIndex?>_COLUMN_<?=$arHeader["COLUMN"]?>_TYPE]" style="width:100%">
																<option value="TEXT"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"TEXT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_DEFAULT')?></option>
																<option value="HTML"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"HTML")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_HTML')?></option>
																<option value="INTEGER"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"INTEGER")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_INTEGER')?></option>
																<option value="FLOAT"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"FLOAT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_FLOAT')?></option>
																<option value="FLAG"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"FLAG")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_FLAG')?></option>
																<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_GROUP_LIST')?>">
																	<option value="LIST_XML_ID"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"LIST_XML_ID")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_LIST_XML_ID')?></option>
																	<option value="LIST_VALUE"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"LIST_VALUE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_LIST_VALUE')?></option>
																</optgroup>
																<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_GROUP_ELEMENT')?>">
																	<option value="ELEMENT_ID"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"ELEMENT_ID")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_ELEMENT_ID')?></option>
																	<option value="ELEMENT_CODE"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"ELEMENT_CODE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_ELEMENT_CODE')?></option>
																	<option value="ELEMENT_NAME"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"ELEMENT_NAME")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_ELEMENT_NAME')?></option>
																	<option value="ELEMENT_EXTERNAL"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"ELEMENT_EXTERNAL")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_ELEMENT_EXTERNAL')?></option>
																</optgroup>
																<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_GROUP_SECTION')?>">
																	<option value="SECTION_ID"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"SECTION_ID")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_SECTION_ID')?></option>
																	<option value="SECTION_CODE"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"SECTION_CODE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_SECTION_CODE')?></option>
																	<option value="SECTION_NAME"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"SECTION_NAME")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_SECTION_NAME')?></option>
																	<option value="SECTION_EXTERNAL"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"SECTION_EXTERNAL")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_SECTION_EXTERNAL')?></option>
																</optgroup>
															</select>
														</td>
														<td>
															<input type="text" size="5" maxlength="10" style="text-align:center; width:90%;" name="fields[SHEET_<?=$SheetIndex?>_COLUMN_<?=$arHeader["COLUMN"]?>_SEPARATOR]" value="<?=$arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_SEPARATOR"]?>" />
														</td>
													</tr>
												<?endforeach?>
											</tbody>
										</table>
										<br/>
										<?if($arFields['PARAMS']['USE_OFFERS']=='Y' && $arFields['PARAMS']['SECTION_METHOD']=='method2'):?>
											<?
												$NameDetermined = false;
												foreach ($arHeaders as $HeaderIndex => $arHeader) {
													if ($arFields["PARAMS"]["SHEET_{$SheetIndex}_P_COLUMN_{$arHeader['COLUMN']}"]=="NAME") {
														$NameDetermined = true;
														break;
													}
												}
												if (!$NameDetermined) {
													print BeginNote();
													ShowError(GetMessage('WEBDEBUG_EXCEL_ERROR_NAME_IS_NOT_DETERMINED'));
													print EndNote();
												}
											?>
											<?$arIBlockProps = $Excel->GetIBlockProps($Excel->GetOffersProductIBlock($arFields["PARAMS"]["IBLOCK_ID_FOR_SHEET_".$SheetIndex]));?>
											<table style="width:100%;"><tbody><tr class="heading"><td colspan="3" style="border-bottom:0"><?=GetMessage('WEBDEBUG_EXCEL_CORRESPONDENCE_TABLE_PARENT_PRODUCT')?></td></tr></tbody></table>
											<br/>
											<table style="border-collapse:collapse; width:100%;" class="webdebug-excel-conformity-table" style="border-top:none">
												<tbody>
													<tr class="header">
														<td><?=GetMessage('WEBDEBUG_EXCEL_CORRESPONDENCE_TABLE_COLUMN')?></td>
														<td><?=GetMessage('WEBDEBUG_EXCEL_CORRESPONDENCE_TABLE_CONFORMITY')?></td>
														<td><?=GetMessage('WEBDEBUG_EXCEL_CORRESPONDENCE_TABLE_VALUETYPE')?></td>
														<td style="width:100px"><?=GetMessage('WEBDEBUG_EXCEL_CORRESPONDENCE_TABLE_SEPARATOR')?></td>
													</tr>
													<?foreach($arHeaders as $HeaderIndex => $arHeader):?>
														<tr>
															<td><?=$arHeader["NAME"]?></td>
															<td>
																<?$ParamKey = "SHEET_".$SheetIndex."_P_COLUMN_".$arHeader["COLUMN"];?>
																<?$ParamVal = $arFields["PARAMS"][$ParamKey];?>
																<select name="fields[SHEET_<?=$SheetIndex?>_P_COLUMN_<?=$arHeader["COLUMN"]?>]" style="width:100%">
																	<option value=""><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_EMPTY')?></option>
																	<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_GROUP_LOGIC')?>">
																		<option value="SKIP_FLAG"<?WDOptSel($ParamVal,"SKIP_FLAG")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_SKIP')?></option>
																	</optgroup>
																	<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_GROUP_IBLOCK')?>">
																		<option value="NAME"<?WDOptSel($ParamVal,"NAME")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_NAME')?></option>
																		<option value="CODE"<?WDOptSel($ParamVal,"CODE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_CODE')?></option>
																		<option value="SORT"<?WDOptSel($ParamVal,"SORT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_SORT')?></option>
																		<option value="PREVIEW_TEXT"<?WDOptSel($ParamVal,"PREVIEW_TEXT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_PREVIEW_TEXT')?></option>
																		<option value="PREVIEW_TEXT_TYPE"<?WDOptSel($ParamVal,"PREVIEW_TEXT_TYPE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_PREVIEW_TEXT_TYPE')?></option>
																		<option value="DETAIL_TEXT"<?WDOptSel($ParamVal,"DETAIL_TEXT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_DETAIL_TEXT')?></option>
																		<option value="DETAIL_TEXT_TYPE"<?WDOptSel($ParamVal,"DETAIL_TEXT_TYPE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_DETAIL_TEXT_TYPE')?></option>
																		<option value="PREVIEW_PICTURE"<?WDOptSel($ParamVal,"PREVIEW_PICTURE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_PREVIEW_PICTURE')?></option>
																		<option value="DETAIL_PICTURE"<?WDOptSel($ParamVal,"DETAIL_PICTURE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_DETAIL_PICTURE')?></option>
																	</optgroup>
																	<?if(Cmodule::IncludeModule("catalog")):?>
																		<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_GROUP_CATALOG')?>">
																			<?foreach($arPrices as $arPrice):?>
																				<option value="PRICE_<?=$arPrice["ID"]?>"<?WDOptSel($ParamVal,"PRICE_".$arPrice["ID"])?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_PRICE')?> "<?=$arPrice["NAME_LANG"]?>"</option>
																			<?endforeach?>
																			<option value="CURRENCY"<?WDOptSel($ParamVal,"CURRENCY")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_CURRENCY')?></option>
																			<option value="QUANTITY"<?WDOptSel($ParamVal,"QUANTITY")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_QUANTITY')?></option>
																			<option value="WEIGHT"<?WDOptSel($ParamVal,"WEIGHT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_WEIGHT')?></option>
																			<option value="LENGTH"<?WDOptSel($ParamVal,"WEIGHT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_LENGTH')?></option>
																			<option value="WIDTH"<?WDOptSel($ParamVal,"WEIGHT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_WIDTH')?></option>
																			<option value="HEIGHT"<?WDOptSel($ParamVal,"HEIGHT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_HEIGHT')?></option>
																			<?foreach($arStores as $arStore):?>
																				<option value="STORE_<?=$arStore["ID"]?>"<?WDOptSel($ParamVal,"STORE_".$arStore["ID"])?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_STORE')?> "<?=$arStore["TITLE"]?>"<?if($arStore["ACTIVE"]!="Y"):?><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_STORE_NOT_ACTIVE')?><?endif?></option>
																			<?endforeach?>
																		</optgroup>
																	<?endif?>
																	<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_GROUP_PROPERTIES')?><?if(empty($arIBlockProps)):?><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_GROUP_PROPERTIES_EMPTY')?><?endif?>">
																		<?foreach($arIBlockProps as $arProp):?>
																			<option value="PROPERTY_<?=$arProp["ID"]?>"<?WDOptSel($ParamVal,"PROPERTY_".$arProp["ID"])?>><?=$arProp["NAME"]?> [<?=($arProp["CODE"]?$arProp["CODE"]:$arProp["ID"])?><?if($show_property_type!="N"):?>, <?=$arProp["PROPERTY_TYPE"]?><?endif?>]</option>
																		<?endforeach?>
																	</optgroup>
																</select>
															</td>
															<td>
																<select name="fields[SHEET_<?=$SheetIndex?>_P_COLUMN_<?=$arHeader["COLUMN"]?>_TYPE]" style="width:100%">
																	<option value="TEXT"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_P_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"TEXT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_DEFAULT')?></option>
																	<option value="HTML"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_P_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"HTML")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_HTML')?></option>
																	<option value="INTEGER"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_P_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"INTEGER")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_INTEGER')?></option>
																	<option value="FLOAT"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_P_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"FLOAT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_FLOAT')?></option>
																	<option value="FLAG"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_P_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"FLAG")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_FLAG')?></option>
																	<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_GROUP_LIST')?>">
																		<option value="LIST_XML_ID"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_P_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"LIST_XML_ID")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_LIST_XML_ID')?></option>
																		<option value="LIST_VALUE"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_P_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"LIST_VALUE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_LIST_VALUE')?></option>
																	</optgroup>
																	<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_GROUP_ELEMENT')?>">
																		<option value="ELEMENT_ID"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_P_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"ELEMENT_ID")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_ELEMENT_ID')?></option>
																		<option value="ELEMENT_CODE"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_P_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"ELEMENT_CODE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_ELEMENT_CODE')?></option>
																		<option value="ELEMENT_NAME"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_P_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"ELEMENT_NAME")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_ELEMENT_NAME')?></option>
																		<option value="ELEMENT_EXTERNAL"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_P_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"ELEMENT_EXTERNAL")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_ELEMENT_EXTERNAL')?></option>
																	</optgroup>
																	<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_GROUP_SECTION')?>">
																		<option value="SECTION_ID"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"SECTION_ID")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_SECTION_ID')?></option>
																		<option value="SECTION_CODE"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"SECTION_CODE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_SECTION_CODE')?></option>
																		<option value="SECTION_NAME"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"SECTION_NAME")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_SECTION_NAME')?></option>
																		<option value="SECTION_EXTERNAL"<?WDOptSel($arFields["PARAMS"]["SHEET_{$SheetIndex}_COLUMN_{$arHeader["COLUMN"]}_TYPE"],"SECTION_EXTERNAL")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_TYPE_SECTION_EXTERNAL')?></option>
																	</optgroup>
																</select>
															</td>
															<td>
																<input type="text" size="5" maxlength="10" style="text-align:center; width:90%;" name="fields[SHEET_<?=$SheetIndex?>_P_COLUMN_<?=$arHeader["COLUMN"]?>_SEPARATOR]" value="<?=$arFields["PARAMS"]["SHEET_{$SheetIndex}_P_COLUMN_{$arHeader["COLUMN"]}_SEPARATOR"]?>" />
															</td>
														</tr>
													<?endforeach?>
												</tbody>
											</table>
											<br/>
										<?endif?>
										
										<?/* *********************************** */?>
										<?if($arFields['PARAMS']['SECTION_METHOD']=='method2'):?>
											<?$arIBlockSectionProps = $Excel->GetIBlockSectionProps($arFields["PARAMS"]["IBLOCK_ID_FOR_SHEET_".$SheetIndex]);?>
											<table style="width:100%;"><tbody><tr class="heading"><td colspan="3" style="border-bottom:0"><?=GetMessage('WEBDEBUG_EXCEL_CORRESPONDENCE_TABLE_SECTION')?></td></tr></tbody></table>
											<br/>
											<table style="border-collapse:collapse; width:100%;" class="webdebug-excel-conformity-table" style="border-top:none">
												<tbody>
													<tr class="header">
														<td><?=GetMessage('WEBDEBUG_EXCEL_CORRESPONDENCE_TABLE_COLUMN')?></td>
														<td><?=GetMessage('WEBDEBUG_EXCEL_CORRESPONDENCE_TABLE_CONFORMITY')?></td>
													</tr>
													<?foreach($arHeaders as $HeaderIndex => $arHeader):?>
														<tr>
															<td><?=$arHeader["NAME"]?></td>
															<td>
																<?$ParamKey = "SHEET_".$SheetIndex."_S_COLUMN_".$arHeader["COLUMN"];?>
																<?$ParamVal = $arFields["PARAMS"][$ParamKey];?>
																<select name="fields[SHEET_<?=$SheetIndex?>_S_COLUMN_<?=$arHeader["COLUMN"]?>]" style="width:100%">
																	<option value=""><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_EMPTY')?></option>
																	<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_GROUP_IBLOCK_SECTION')?>">
																		<option value="NAME"<?WDOptSel($ParamVal,"NAME")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_NAME')?></option>
																		<option value="CODE"<?WDOptSel($ParamVal,"CODE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_CODE')?></option>
																		<option value="SORT"<?WDOptSel($ParamVal,"SORT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_SORT')?></option>
																		<option value="DETAIL_TEXT"<?WDOptSel($ParamVal,"DETAIL_TEXT")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_DETAIL_TEXT')?></option>
																		<option value="DETAIL_TEXT_TYPE"<?WDOptSel($ParamVal,"DETAIL_TEXT_TYPE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_DETAIL_TEXT_TYPE')?></option>
																		<option value="PREVIEW_PICTURE"<?WDOptSel($ParamVal,"PREVIEW_PICTURE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_PREVIEW_PICTURE')?></option>
																		<option value="DETAIL_PICTURE"<?WDOptSel($ParamVal,"DETAIL_PICTURE")?>><?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_DETAIL_PICTURE')?></option>
																	</optgroup>
																	<optgroup label="<?=GetMessage('WEBDEBUG_EXCEL_FIELD_ACTION_GROUP_IBLOCK_SECTION_PROPS')?>">
																		<?foreach($arIBlockSectionProps as $arIBlockSectionProp):?>
																			<option value="<?=$arIBlockSectionProp['FIELD_NAME']?>"><?=$arIBlockSectionProp['FIELD_NAME']?></option>
																		<?endforeach?>
																	</optgroup>
																</select>
															</td>
														</tr>
													<?endforeach?>
												</tbody>
											</table>
											<br/>
										<?endif?>
										<?/* *********************************** */?>
										
										<div style="text-align:right">
											<input type="button" value="<?=GetMessage('WEBDEBUG_EXCEL_CLEAR_PARAMS')?>" id="webdebug-reset-button" />
											<script>
											$('#webdebug-reset-button').click(function(){
												$('.webdebug-excel-conformity-table select').val('');
												$('.webdebug-excel-conformity-table input[type=text]').val('');
											});
											</script>
										</div>
										<?if(!$ColumnAndHeaderValuesAreSet):?>
											<?$arIBlockTranslitSettings = CWebdebugExcel::GetIBlockTranslitSettings($arFields["PARAMS"]["IBLOCK_ID_FOR_SHEET_".$SheetIndex]);?>
											<?if($arIBlockTranslitSettings["IS_REQUIRED"]=="Y" || $arIBlockTranslitSettings["TRANSLITERATION"]=="Y"):?>
												<div class="adm-info-message"><?=GetMessage('WEBDEBUG_EXCEL_WARNING_AUTOCODE')?></div>
											<?endif?>
										<?endif?>
									<?endif?>
								</div>
							<?endforeach?>
							<?#$Excel->p($arFields);?>
						</div>
						<script type="text/javascript">
						$("#webdebug-excel-sheet-list").WebdebugTabs({
							show:"fadeIn",
							use_hash:true,
							duration:50,
							selectedClass:"adm-btn-green"
						});
						</script>
					</div>
				</td>
			</tr>
		<?endif?>
		<?$tabControl->Buttons(array("disabled"=>false,"back_url"=>"webdebug_excel_profiles.php?lang=".LANG));?>
		<?$tabControl->End();?>
	</form>
<?elseif($Mode=="edit" && empty($arFields)):?>
	<?ShowError(GetMessage("WEBDEBUG_EXCEL_ERROR_ITEM_NOT_FOUND"))?>
<?endif?>

<?
/////////////////////////////////////////////////////////////////////////////////////////////
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin.php");
?>