<?php
/**
 * tester
 */
$user = function()
{
	$array = array();
	$info = Dever::load('component/user-state');
	if($info)
	{
		$array += $info;
	}
	return $array;
};

$template = function()
{
	$array = array();
	$info = Dever::load('component_applet/template-state');
	if($info)
	{
		$array += $info;
	}
	return $array;
};


return array
(
	# 表名
	'name' => 'version',
	# 显示给用户看的名称
	'lang' => '版本管理',
	'order' => 97,
	'end' => array
	(
		'insert' => array
		(
			'component_applet/version.update',
		),
		'update' => array
		(
			'component_applet/version.update',
		),
	),
	# 数据结构
	'struct' => array
	(
		'id' 		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> 'ID',
			'default' 	=> '',
			'desc' 		=> '',
			'match' 	=> 'is_numeric',
			'search'	=> 'order',
			//'list'		=> true,
		),

		'project_id'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '项目',
			'default' 	=> '',
			'desc' 		=> '请输入项目',
			'match' 	=> 'is_numeric',
		),

		'user'		=> array
		(
			'type' 		=> 'varchar-255',
			'name' 		=> '用户-不选择则获取所有用户',
			'default' 	=> '',
			'desc' 		=> '用户',
			'match' 	=> 'is_string',
			//'search'	=> 'order,fulltext',
			'update'	=> 'checkbox',
			'option'	=> $user,
			'list'		=> true,
		),
		
		'name'		=> array
		(
			'type' 		=> 'varchar-60',
			'name' 		=> '版本号',
			'default' 	=> '',
			'desc' 		=> '版本号',
			'match' 	=> 'is_string',
			'update'	=> 'text',
			'list'		=> true,
		),

		'template_id'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '小程序模板',
			'default' 	=> '1',
			'desc' 		=> '小程序模板',
			'match' 	=> 'is_numeric',
			'update'	=> 'select',
			'option'	=> $template,
			'list'		=> true,
		),

		'desc'		=> array
		(
			'type' 		=> 'varchar-255',
			'name' 		=> '版本描述',
			'default' 	=> '',
			'desc' 		=> '版本描述',
			'match' 	=> 'option',
			'update'	=> 'textarea',
			//'list'		=> true,
		),

		'act_id'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '活动id',
			'default' 	=> '0',
			'desc' 		=> '活动id',
			'match' 	=> 'is_numeric',
			'update'	=> 'text',
			//'list'		=> true,
		),
		
		'state'		=> array
		(
			'type' 		=> 'tinyint-1',
			'name' 		=> '状态',
			'default' 	=> '1',
			'desc' 		=> '请选择状态',
			'match' 	=> 'is_numeric',
		),

		'mdate'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '提交时间',
			'match' 	=> array('is_numeric', time()),
			'desc' 		=> '',
			'default' 	=> '',
			'list'		=> 'date("Y-m-d H:i:s", {mdate})',
		),
		
		'cdate'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '录入时间',
			'match' 	=> array('is_numeric', time()),
			'desc' 		=> '',
			# 只有insert时才生效
			'insert'	=> true,
		),
	),

	'top' => Dever::config('base', 'component')->top,

	'manage' => array
	(
		'delete' => false,
		'list_button' => array
		(
			'list' => array('日志', '"version_log&search_option_version_id={id}&oper_parent=version"'),

			'oper' => array('提审', '"component_applet/auditing.submit?id={id}"'),

			'oper3' => array('撤回', '"component_applet/unaudit.submit?id={id}"'),

			'oper1' => array('发布', '"component_applet/publish.submit?id={id}"'),

			'oper2' => array('回退', '"component_applet/revert.submit?id={id}"'),
		),
	),
);