<? $this->load->view( $this->aSystemVar['template_viewer_root'] . '_header') ?>
	<div class="colCapt">
		<?= $this->lang->line('add_category') ?>
	</div>
	<div id="breadcrumb">
		<?= anchor(base_url(true), $this->lang->line('home') ) ?>
	</div>

	<div class="formBlock">
		<div class="errorBlock">
			&nbsp;<?= $this->validation->error_string ?>
		</div>
		<div class="fSet">
			<div class="legend"><?= $this->lang->line('add_category') ?></div>
			<?= form_open_multipart('category/save')?>
				<!-- <input type="hidden" name="ParentId" value="<?=$data['Category']['ParentId']?>" /> -->
				<input type="hidden" name="CategoryId" value="<?=$data['Category']['Id']?>" />

   				<div>
					<div><?= $this->lang->line('parent_category'); ?></div>
					<select name="ParentId" style="width:50%;">
						<?// '<option value="0" ' . ( '0' != $data['Category']['Id'] ? '' : 'selected="selected"') . ' />root</option>' ?>
						<? foreach ( $data['CategoryList'] as $aCategory ) : ?>
							<?= '<option value="' . $aCategory['Id'] . '" ' . ( $aCategory['Id'] != $data['Category']['ParentId'] ? '' : 'selected="selected"') . ' />' . $aCategory['Title'] . '</option>' ?>
						<? endforeach ?>
					</select>
				</div>
				<? if ( 1 < count($this->aSystemVar['lang_list']) ) : ?>
				<div>
					<div><?= $this->lang->line('langs') ?>:</div>
					<select name="CatLang" style="width:50%;">
						<?
							$sCurLang = empty($data['Category']['CatLang'])?$this->aSystemVar['cur_lang']:$data['Category']['CatLang'];
							foreach ($this->aSystemVar['lang_list'] as $aItem) : ?>
							<?='<option value="'.$aItem['BaseName'].'" '.($aItem['BaseName']!=$sCurLang?'':'selected="selected"').' />'.$aItem['Title'].'</option>'?>
						<? endforeach; ?>
					</select>
				</div>
				<? endif; ?>

				<div class="text"><?=$this->lang->line('category_title')?></div>
				<? if ('' == $data['Category']['BaseName'])
						$sJs = 'onkeyup="javascript:document.getElementById(\'base_name\').value=getBaseName(this.value);return false;"';
					else
						$sJs = '';
				?>
				<div class="input"><input type="text" name="Title" value="<?=$data['Category']['Title']?>" class="text" style="width:50%;" <?=$sJs?> /></div>
				<div class="text"><?=$this->lang->line('basename')?><a href="javascript:void(0);" class="asynchelp" onClick="javascript: initAsyncHelp( event, '<?= site_url('async/topic/_basename');?>' ); return false;" onMouseOut="javascript: hideAsyncHelp();">[?]</a>:</div>
				<div class="input"><input type="text" name="BaseName" id="base_name" value="<?=$data['Category']['BaseName']?>" class="text" style="width:50%;" /></div>
				<div class="text"><?=$this->lang->line('description')?></div>
				<div class="input"><textarea name="Description" style="width:98%; height:80px;"><?=$data['Category']['Description']?></textarea></div>
				<div class="text"><?=$this->lang->line('keywords')?></div>
				<div class="input" style="margin-bottom:10px;"><input type="text" name="Keywords" value="<?=$data['Category']['Keywords']?>" class="text" style="width:50%;" /></div>
				<div class="text"><?=$this->lang->line('icon')?></div>
				<? if(!empty($data['Category']['IconUrl'])) : ?>
					<div>
						<span><input type="checkbox" name="DeletePic" value="<?=$data['Category']['Id']?>" style="vertical-align:middle;" id="deleteCheckBox" /></span><span style="vertical-alin:middle;"><label for="deleteCheckBox"><?= $this->lang->line('delete') ?></label></span>
					</div>
					<div>
						<img src="<?=$data['Category']['IconUrl']?>" title="pic" alt="pic" />
					</div>
				<? endif; ?>
				<div class="input"><input type="file" name="Icon" class="file"  /></div>
				<? if ( !empty($data['Category']['SecurityCode']) ): ?>
					<div class="warning"><?= $this->lang->line('WARNING')?> <?= $this->lang->line('human_only') ?></div>
					<div><img src="<?=site_url('catalog/get_security_image')?>" alt="security image" title="security image" /></div>
					<div><input type="text" name="SecurityCode" class="text" /></div>
				<? endif; ?>
				<div class="submit"><input type="submit" class="submit" value="<?= $this->lang->line('submit')?>" /></div>
			<?=form_close()?>

		</div>
	</div>
<? $this->load->view( $this->aSystemVar['template_viewer_root'] . '_footer') ?>
