<?php
/*
	Copyright © Eleanor CMS
	URL: http://eleanor-cms.ru, http://eleanor-cms.com
	E-mail: support@eleanor-cms.ru
	Developing: Alexander Sunvas*
	Interface: Rumin Sergey
	=====
	*Pseudonym
*/
if(!defined('CMS'))die;
return array(
	'parents'=>array(
		'title'=>$lang['parent'],
		'descr'=>'',
		'type'=>'select',
		'bypost'=>&$Eleanor->sc_post,
		'load'=>function($a)
		{
			$a['value']=rtrim($a['value'],',');
			if(false!==$p=strrpos($a['value'],','))
				$a['value']=substr($a['value'],$p+1);
			return$a;
		},
		'save'=>function($a)use($mc)
		{global$Eleanor;
			$R=Eleanor::$Db->Query('SELECT `id`,`parents` FROM `'.$mc['t'].'` WHERE `id`='.(int)$a['value'].' LIMIT 1');
			if($a=$R->fetch_assoc())
				return$a['parents'] ? $a['parents'].$a['id'].',' : $a['id'].',';
			return'';
		},
		'options'=>array(
			'exclude'=>0,
			'callback'=>function($a)use($mc)
			{global$Eleanor;
				$sel=Eleanor::Option('&mdash;',0,in_array('',$a['value']),array(),2);
				if(!class_exists($mc['api'],false))
					include$Eleanor->module['path'].'api.php';
				$Plug=new$mc['api']($mc);
				$items=$Plug->GetOrderedList();
				foreach($items as $k=>&$v)
				{
					if($k==$a['options']['exclude'] or strpos(','.$v['parents'],','.$a['options']['exclude'].',')!==false)
						continue;
					$sel.=Eleanor::Option(($v['parents'] ? str_repeat('&nbsp;',substr_count($v['parents'],',')).'›&nbsp;' : '').$v['title'],$k,in_array($k,$a['value']),array(),2);
				}
				return$sel;
			},
			'extra'=>array(
				'tabindex'=>1
			),
		),
	),
	'title'=>array(
		'title'=>$lang['name'],
		'descr'=>'',
		'type'=>'input',
		'bypost'=>&$Eleanor->sc_post,
		'load'=>function($a)use(&$imgalt)
		{
			$imgalt=$a['value'];
			$r=array();
			if($a['multilang'])
				foreach(Eleanor::$langs as $k=>&$v)
				{
					$r['options'][$k]=$a['options'];
					$r['options'][$k]['extra']['id']='title-'.$k;
				}
			else
			{
				$r['options']=$a['options'];
				$r['options']['extra']['id']='title';
			}
			return$r;
		},
		'save'=>function($co)use(&$imgalt)
		{
			$imgalt=$co['value'];
			return$co['value'];
		},
		'multilang'=>Eleanor::$vars['multilang'],
		'options'=>array(
			'htmlsafe'=>true,
			'extra'=>array(
				'tabindex'=>2
			),
		),
	),
	'text'=>array(
		'title'=>$lang['content'],
		'descr'=>'',
		'type'=>'editor',
		'bypost'=>&$Eleanor->sc_post,
		'multilang'=>Eleanor::$vars['multilang'],
		'options'=>array(
			'htmlsafe'=>true,
			'imgalt'=>&$imgalt,
		),
		'extra'=>array(
			'no'=>array('tabindex'=>3)
		),
	),
	'uri'=>array(
		'title'=>'URI',
		'descr'=>'',
		'type'=>'input',
		'bypost'=>&$Eleanor->sc_post,
		'load'=>function($a)
		{
			$r=array();
			if($a['multilang'])
				foreach(Eleanor::$langs as $k=>&$v)
				{
					$r['options'][$k]=$a['options'];
					$r['options'][$k]['extra']['onfocus']='if(!$(this).val())$(this).val($(\'#title-'.$k.'\').val())';
				}
			else
			{
				$r['options']=$a['options'];
				$r['options']['extra']['onfocus']='if(!$(this).val())$(this).val($(\'#title\').val())';
			}
			return$r;
		},
		'multilang'=>Eleanor::$vars['multilang'],
		'options'=>array(
			'htmlsafe'=>true,
			'extra'=>array(
				'tabindex'=>4,
			),
		),
	),
	'pos'=>array(
		'title'=>$lang['pos'],
		'descr'=>$lang['pos_'],
		'type'=>'input',
		'bypost'=>&$Eleanor->sc_post,
		'options'=>array(
			'htmlsafe'=>true,
			'extra'=>array(
				'tabindex'=>5,
			),
		),
	),
	'status'=>array(
		'title'=>$lang['activate'],
		'descr'=>'',
		'default'=>true,
		'type'=>'check',
		'bypost'=>&$Eleanor->sc_post,
		'options'=>array(
			'extra'=>array(
				'tabindex'=>6,
			),
		),
	),
	'meta_title'=>array(
		'title'=>'Window title',
		'descr'=>'',
		'type'=>'input',
		'bypost'=>&$Eleanor->sc_post,
		'multilang'=>Eleanor::$vars['multilang'],
		'options'=>array(
			'htmlsafe'=>true,
		),
	),
	'meta_descr'=>array(
		'title'=>'Meta description',
		'descr'=>'',
		'type'=>'input',
		'bypost'=>&$Eleanor->sc_post,
		'multilang'=>Eleanor::$vars['multilang'],
		'options'=>array(
			'htmlsafe'=>true,
		),
	),
);