<a href="{url}" class="btn btn-default btn-xs" title="назад"><img src="/skins/default/images/icons/simple_arrow_left.png" alt="назад" /></a>

	<form action="#" method="post" id="change_form" class="form-horizontal">
		<p>
			<input type="hidden" name="token" value="{$_user->token}" />
			{if $node->id}<input name="tree_id" type="hidden" value="{$node->id}" />{/if}
		</p>
		<div class="form-group" style="display:none">
			<label class="col-lg-3 control-label">id</label>
			<div class="col-lg-6">
				{$node->id}
			</div>
		</div>
		<div class="form-group">
			<label class="col-lg-3 control-label" for="name">Название</label>
			<div class="col-lg-6">
				<input required="required" type="text" placeholder="Название" value="{$smarty.post.name|default:$node->name|escape}" name="name" id="name" class="form-control">
			</div>
		</div>
		<div class="form-group">
			<label class="col-lg-3 control-label" for="parent">Родитель</label>
			<div class="col-lg-6">
				<select name="parent_id" id="parent" class="form-control">
					<option value="0">&nbsp;</option>
					{html_options options=$parent_select selected=$smarty.post.parent_id|default:$node->parent_id}
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-lg-3 control-label" for="symlink">Ссылка на</label>
			<div class="col-lg-6">
				<select name="symlink" id="symlink" class="form-control"  onchange="change_view()">
					<option value="0">&nbsp;</option>
					{html_options options=$symlink_select selected=$smarty.post.symlink|default:$node->symlink}
				</select>
			</div>
		</div>
		<div class="form-group additional">
			<label class="col-lg-3 control-label" for="path">Путь</label>
			<div class="col-lg-6">
				<input type="text" placeholder="/some/url" value="{$smarty.post.path|default:$node->path|escape}" name="path" id="path" class="form-control">
			</div>
		</div>
		<div class="form-group additional">
			<div class="col-lg-offset-3 col-lg-6">
				<div class="checkbox">
					<label>
						{$checked=($smarty.server.REQUEST_METHOD=='POST')?$smarty.post.external:$node->external}
						<input type="checkbox" name="external"{if $checked} checked="checked"{/if} />
						Оставить путь без преобразований
					</label>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-lg-3 control-label" for="template">Шаблон</label>
			<div class="col-lg-6">
				<select name="template" id="template" class="form-control">
					<option value="">&nbsp;</option>
					{html_options options=$templates selected=$smarty.post.template|default:$node->template}
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-lg-3 control-label" for="params">Параметры</label>
			<div class="col-lg-6">
				<input type="text" placeholder="param1=var1&param2=var2&..." value="{$smarty.post.params|default:$node->params|escape}" name="params" id="params" class="form-control">
			</div>
		</div>
		{if count($langs)>1}
			<div class="form-group">
				<label class="col-lg-3 control-label" for="lang_id">Язык</label>
				<div class="col-lg-6">
					<select name="lang_id" id="lang_id" class="form-control">
						<option value="0">&nbsp;</option>
						{html_options options=$langs selected=$smarty.post.lang_id|default:$node->lang_id}
					</select>
				</div>
			</div>
		{/if}
		
		<div class="form-group">
			<label class="col-lg-3 control-label">Модули</label>
			<div class="col-lg-6">
				<div class="checkbox" id="modules">
					{foreach $modules_list as $module}
						{if $module.checked && $module.component}{$current_component=$module.id}{/if}
						<div>
							<label>
								<input type="checkbox" name="module[{$module.id}]" {if $module.checked} checked="checked"{/if} {if $module.component}onclick="check_component(this)" class="component"{/if} />
								{$module.name|escape} {if $module.component}<img src="/skins/default/images/icons/simple_component.png" class="icon" title="компонент" alt="компонент" />{/if}
								<br />
							</label>
						</div>
					{/foreach}
				</div>
			</div>
		</div>

		<div class="form-group">
			<div class="col-lg-offset-3 col-lg-6">
				<input type="submit" class="btn btn-default" value="Сохранить" />
			</div>
		</div>
	</form>
</div>
<script type="text/javascript">
	function check_component(current)
	{
		$('#modules .component').each(function(){
		   $(this).attr('disabled', (current.checked)?'disabled':false)
		});
		current.disabled=false;
	}
	
	function change_view()
	{
		$('#change_form .additional').each(function(index, item){
			item.style.display=($('#symlink').val()>0)?'none':'';
		});
	}
	
	$( document ).ready(function(){
		change_view();
		{if $current_component}check_component(document.getElementById('change_form')['module[{$current_component}]']);{/if}
	});
</script>