<?php
/*
|--------------------------------------------------------------------------
| opt.php 记录字段的表
|--------------------------------------------------------------------------
*/
# 定义几个常用的选项
$option = array
(
	1 => '显示',
	2 => '不显示',
);

$info = Dever::load('manage/project.get');

$path = $info['manage']['path'];

if(isset($info['manage']['setup']))
{
	$path = $info['manage']['setup'];
}
 
# 获取project
$project = function() use ($info)
{
	$data = array();
	foreach($info as $k => $v)
	{
		$k = $v['lib'];
		$data[$k]['id'] = $v['name'];
		$data[$k]['name'] = $v['lang'];
	}

	return $data;
};

return array
(
	# 表名
	'name' => 'node',
	# 显示给用户看的名称
	'lang' => '节点记录表',
	'menu' => false,
	'desc' => Dever::markdown('**本表记录所有模板用到的html节点：**
	1. 请点击更新节点，获取最新的节点列表。 
	2. 根据本记录表的内容，可以方便的开发一套新的模板。'),
	# 数据结构
	'struct' => array
	(
		'id' 		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> 'ID',
			'default' 	=> '',
			'desc' 		=> '',
			'match' 	=> 'is_numeric',
			'search'	=> 'order',
			//'list'		=> true,
		),
		
		'project'		=> array
		(
			'type' 		=> 'varchar-30',
			'name' 		=> '项目',
			'default' 	=> '',
			'desc' 		=> '请选择项目',
			'match' 	=> 'is_string',
			'update'	=> 'select',
			'search'	=> 'select',
			'option'	=> $project,
			'list'		=> true,
		),
		
		'service'		=> array
		(
			'type' 		=> 'varchar-32',
			'name' 		=> '模板业务-请输入模板业务',
			'default' 	=> '',
			'desc' 		=> '请选择模板业务',
			'match' 	=> 'is_string',
			'update'	=> 'text',
			'search'	=> 'fulltext',
			'list'		=> true,
		),
		
		'template'		=> array
		(
			'type' 		=> 'varchar-255',
			'name' 		=> '模板名',
			'default' 	=> '',
			'desc' 		=> '请输入模板名',
			'match' 	=> 'is_string',
			'update'	=> 'text',
			'search'	=> 'fulltext',
			'list'		=> true,
		),

		'key'			=> array
		(
			'type' 		=> 'varchar-500',
			'name' 		=> '节点标识',
			'default' 	=> '',
			'desc' 		=> '请输入节点标识',
			'match' 	=> 'is_string',
			'update'	=> 'text',
			'search'	=> 'fulltext',
			'list'		=> true,
		),
		
		'value'			=> array
		(
			'type' 		=> 'text-255',
			'name' 		=> '节点的值',
			'default' 	=> '',
			'desc' 		=> '节点的值',
			'match' 	=> 'is_string',
			'update'	=> 'text',
			'list'		=> true,
		),

		'state'		=> array
		(
			'type' 		=> 'tinyint-1',
			'name' 		=> '数据是否存在',
			'default' 	=> '1',
			'desc' 		=> '请选择数据是否存在',
			'match' 	=> 'is_numeric',
			'option' 	=> $option,
			'update'	=> 'radio',
			//'list'		=> true,
		),
		
		'cdate'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '录入时间',
			'match' 	=> array('is_numeric', time()),
			'desc' 		=> '',
			# 只有insert时才生效
			'insert'	=> true,
			//'list'		=> 'date("Y-m-d H:i:s", {cdate})',
		),
	),
	
	'manage' => array
	(
		'edit' => false,
		'insert' => false,
		'button' => array
		(
			'更新节点' => 'manage/node.update',
		)
	),
);
