<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');?>
<? $this->load->view($this->aSystemVar['template_viewer_root'] . '_header'); ?>

	<?= $this->validation->error_string; ?>
	<?= form_open('page/save') ?>

	<div class="colCapt">
	<?	if (!empty($data['form']['Id']))
			echo $this->lang->line('edit');
		else
			echo $this->lang->line('add');
	?>
	</div>

	<? if ( 1 < count($this->aSystemVar['lang_list']) ) : ?>
	<fieldset>
		<legend><?= $this->lang->line('langs') ?></legend>
		<select name="Lang" style="width:50%;">
		<?
			$sCurLang = empty($data['form']['Lang'])?$this->aSystemVar['cur_lang']:$data['form']['Lang'];
			foreach ($this->aSystemVar['lang_list'] as $aItem) : ?>
			<?='<option value="'.$aItem['BaseName'].'" '.($aItem['BaseName']!=$sCurLang?'':'selected="selected"').' />'.$aItem['Title'].'</option>'?>
		<? endforeach; ?>
		</select>
	</fieldset>
	<? else: ?>
		<input type="hidden" name="Lang" value="<?=$this->aSystemVar['lang_list'][0]['BaseName']?>" />
	<? endif; ?>
	<fieldset>
		<legend><?=$this->lang->line('title')?></legend>
		<? if ('' == $data['form']['BaseName'])
			$sJs = 'onkeyup="javascript:document.getElementById(\'base_name\').value=getBaseName(this.value);return false;"';
		else
			$sJs = '';
		?>
		<input type="text" class="text" name="Title" style="width:300px;" value="<?= $data['form']['Title']; ?>" <?=$sJs?> />
	</fieldset>
    <fieldset>
		<legend><?=$this->lang->line('url')?></legend>
		<input type="text" class="text" name="BaseName" id="base_name" style="width:300px;" value="<?= $data['form']['BaseName']; ?>" />
	</fieldset>
    <fieldset>
		<legend><?=$this->lang->line('content')?></legend>
		<textarea name="Content" id="page_content" style="width:100%; height:500px;"><?=$data['form']['Content'];?></textarea>
	</fieldset>
	<div class="submit">
		<input type="hidden" name="PageId" value="<?= $data['form']['Id']; ?>" />
		<input type="submit" value="<?=$this->lang->line('submit')?>" />
	</div>
	<?= form_close();?>
<? $this->load->view($this->aSystemVar['template_viewer_root'] . '_footer'); ?>