<?php
array_splice($config->deploy->view->navs, 2, 0, 'artifact');

$config->deploy->form->setting = array();
$config->deploy->form->setting['status'] = array('type' => 'int',    'required' => false, 'default' => 0);
$config->deploy->form->setting['flow']   = array('type' => 'string', 'required' => false, 'default' => '');

$config->deploy->dtable->fieldList['type']['title'] = $lang->deploy->type;
$config->deploy->dtable->fieldList['type']['type']  = 'type';
$config->deploy->dtable->fieldList['type']['show']  = true;
$config->deploy->dtable->fieldList['type']['width'] = 80;
$config->deploy->dtable->fieldList['type']['map']   = $lang->deploy->typeList;
$config->deploy->dtable->fieldList['type']['order'] = 65;

$config->deploy->dtable->fieldList['env']['title'] = $lang->deploy->env;
$config->deploy->dtable->fieldList['env']['type']  = 'text';
$config->deploy->dtable->fieldList['env']['show']  = true;
$config->deploy->dtable->fieldList['env']['width'] = 80;
$config->deploy->dtable->fieldList['env']['order'] = 10;

$config->deploy->dtable->fieldList['lastReviewedDate']['title'] = $lang->deploy->lastReviewedDate;
$config->deploy->dtable->fieldList['lastReviewedDate']['type']  = 'datetime';
$config->deploy->dtable->fieldList['lastReviewedDate']['show']  = true;
$config->deploy->dtable->fieldList['lastReviewedDate']['order'] = 70;

$config->deploy->form->create['type']          = array('type' => 'string', 'required' => true,  'default' => 'manual');
$config->deploy->form->create['env']           = array('type' => 'int', 'required' => false,  'default' => 0);
$config->deploy->form->create['host']          = array('type' => 'array', 'required' => false,  'default' => array(), 'filter' => 'join');
$config->deploy->form->create['releaseTPL']    = array('type' => 'int', 'required' => false,  'default' => 0);
$config->deploy->form->create['systemVersion'] = array('type' => 'int', 'required' => false,  'default' => 0);
$config->deploy->form->create['artifact']      = array('type' => 'string', 'required' => false,  'default' => '');

$config->deploy->form->edit['type']          = array('type' => 'string', 'required' => true,  'default' => 'manual');
$config->deploy->form->edit['env']           = array('type' => 'int', 'required' => false,  'default' => 0);
$config->deploy->form->edit['releaseTPL']    = array('type' => 'int', 'required' => false,  'default' => 0);
$config->deploy->form->edit['host']          = array('type' => 'array', 'required' => false, 'default' => array(), 'filter' => 'join');
$config->deploy->form->edit['systemVersion'] = array('type' => 'int', 'required' => false,  'default' => 0);
$config->deploy->form->edit['artifact']      = array('type' => 'string', 'required' => false,  'default' => '');

$config->deploy->actionList['recall'] = array();
$config->deploy->actionList['recall']['icon']         = 'back';
$config->deploy->actionList['recall']['hint']         = $lang->deploy->recall;
$config->deploy->actionList['recall']['url']          = helper::createLink('deploy', 'recall', "deployID={id}");
$config->deploy->actionList['recall']['data-confirm'] = $lang->deploy->notice->recall;
$config->deploy->actionList['recall']['className']    = 'ajax-submit';

$config->deploy->actionList['progress'] = array();
$config->deploy->actionList['progress']['icon']         = 'list-alt';
$config->deploy->actionList['progress']['hint']         = $lang->deploy->progress;
$config->deploy->actionList['progress']['url']          = array('module' => 'approval', 'method' => 'progress', 'params' => 'approvalID={approval}');
$config->deploy->actionList['progress']['data-toggle']  = 'modal';
$config->deploy->actionList['progress']['notLoadModel'] = true;

$config->deploy->actionList['submit']['icon']        = 'play';
$config->deploy->actionList['submit']['text']        = $lang->deploy->submit;
$config->deploy->actionList['submit']['hint']        = $lang->deploy->submit;
$config->deploy->actionList['submit']['url']         = array('module' => 'deploy', 'method' => 'submit', 'params' => 'deployID={id}');
$config->deploy->actionList['submit']['data-toggle'] = 'modal';

$config->deploy->actionList['review']['icon']        = 'glasses';
$config->deploy->actionList['review']['text']        = $lang->deploy->review;
$config->deploy->actionList['review']['hint']        = $lang->deploy->review;
$config->deploy->actionList['review']['url']         = array('module' => 'deploy', 'method' => 'review', 'params' => 'deployID={id}');
$config->deploy->actionList['review']['data-toggle'] = 'modal';

if($config->edition != 'open' && $config->edition != 'biz')
{
    $config->deploy->dtable->fieldList['actions']['list'] += $config->deploy->actionList;

    $config->deploy->dtable->fieldList['actions']['width'] = 180;

    array_splice($config->deploy->dtable->fieldList['actions']['menu'], 0, 0, array('recall|submit', 'review', 'progress'));
}

$config->deploy->review = new stdclass();
$config->deploy->review->requiredFields = '';

$config->deploy->apiError = array();
$config->deploy->apiError[] = "Exception: (1406, \"Data too long for column 'version' at row 1\")";
$config->deploy->apiError[] = "Exception: (1406, \"Data too long for column 'name' at row 1\")";
$config->deploy->apiError[] = "Exception: (1406, \"Data too long for column 'desc' at row 1\")";

$config->deploy->actions->view['mainActions'][] = 'progress';
$config->deploy->actions->view['mainActions'][] = 'review';
$config->deploy->actions->view['mainActions'][] = 'recall';
$config->deploy->actions->view['mainActions'][] = 'submit';

$config->deploy->search['fields']['type']             = $lang->deploy->type;
$config->deploy->search['fields']['env']              = $lang->deploy->env;
$config->deploy->search['fields']['lastReviewedDate'] = $lang->deploy->reviewDate;

$config->deploy->search['params']['type']             = array('operator' => '=', 'control' => 'select', 'values' => $lang->deploy->typeList);
$config->deploy->search['params']['env']              = array('operator' => '=', 'control' => 'select', 'values' => array());
$config->deploy->search['params']['lastReviewedDate'] = array('operator' => '=', 'control' => 'date',   'values' => '');

$config->deploy->helpURL = 'https://www.zentao.net/book/devops/deploy-copy-1692.html';
