+ product: add view file for create function.
This commit is contained in:
@@ -404,7 +404,7 @@ class product extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create(string $programID = '0', string $extra = '')
|
||||
public function create(string $programID = '0', string $extra = ''): void
|
||||
{
|
||||
$programID = (int)$programID;
|
||||
|
||||
@@ -412,12 +412,21 @@ class product extends control
|
||||
{
|
||||
$data = form::data($this->config->product->form->create);
|
||||
$data = $this->productZen->prepareCreateExtras($data, $this->post->acl, $this->post->uid);
|
||||
if(!$data) return $this->productZen->sendError4Create();
|
||||
if(!$data)
|
||||
{
|
||||
$this->productZen->sendError4Create();
|
||||
return;
|
||||
}
|
||||
|
||||
$productID = $this->product->create($data);
|
||||
if(!$productID) return $this->productZen->sendError4Create();
|
||||
if(!$productID)
|
||||
{
|
||||
$this->productZen->sendError4Create();
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->productZen->responseAfterCreate($productID, $data, $this->post->uid, zget($_POST, 'lineName', ''));
|
||||
$this->productZen->responseAfterCreate($productID, $data, $this->post->uid, zget($_POST, 'lineName', ''));
|
||||
return;
|
||||
}
|
||||
|
||||
$this->productZen->setCreateMenu($programID);
|
||||
|
||||
@@ -493,4 +493,17 @@ class productTao extends productModel
|
||||
if(dao::isError())return false;
|
||||
return (int)$this->dao->lastInsertID();
|
||||
}
|
||||
|
||||
/**
|
||||
* 从module表中查询所有产品线。
|
||||
* Get all product lines from module table.
|
||||
* TODO move to the MODULE module.
|
||||
*
|
||||
* @access protected
|
||||
* @return array
|
||||
*/
|
||||
protected function getProductLinesTODO(): array
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_MODULE)->where('type')->eq('line')->andWhere('deleted')->eq(0)->orderBy('`order` asc')->fetchAll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,178 @@
|
||||
<?php
|
||||
js::set('programID', $programID);
|
||||
/**
|
||||
* The create view of product of ZenTaoPMS.
|
||||
*/
|
||||
|
||||
$form = form();
|
||||
$form->buildForm($fields);
|
||||
$form->buildFormAction();
|
||||
/*
|
||||
======= Attention ======
|
||||
|
||||
$content = block();
|
||||
$content->from = $form;
|
||||
This file is generated by zin-tool, you should check the following to-do list.
|
||||
|
||||
$page = page('create');
|
||||
$page->right->content = $content;
|
||||
$page->x();
|
||||
+ Familiar with the use of these widgets in zin: .
|
||||
+ Check the following variables which used in widgets: $programOptions, $lineOptions, $POOptions, $QDOptions, $RDOptions, $reviewerOptions, $typeOptions, $aclOptions, $whitelistOptions.
|
||||
+ Check the origin code in module/product/view/create.html.php, and ensure that all features have been implemented.
|
||||
+ Check the origin js code in module/product/js/common.js and module/product/js/create.js
|
||||
+ Check the origin css code in module/product/css/common.css and module/product/css/create.css
|
||||
+ Remove the comments which starts with "zin:"
|
||||
+ Test according to the new design draft and the original implementation
|
||||
*/
|
||||
|
||||
namespace zin;
|
||||
|
||||
/* ====== Preparing and processing page data ====== */
|
||||
|
||||
/* zin: Set variables to define picker options for form */
|
||||
$programOptions = array();
|
||||
$lineOptions = array();
|
||||
$POOptions = array();
|
||||
$QDOptions = array();
|
||||
$RDOptions = array();
|
||||
$reviewerOptions = array();
|
||||
$typeOptions = array(array('value' => "normal", 'text' => "正常"), array('value' => "branch", 'text' => "多分支(适用于客户定制场景)"), array('value' => "platform", 'text' => "多平台(适用于跨平台应用开发,比如IOS、安卓、PC端等)"));
|
||||
$aclOptions = array(array('checked' => true, 'value' => "private", 'disabled' => false, 'text' => "私有(产品相关负责人、所属项目集的负责人及干系人、相关联项目的团队成员和干系人可访问)"), array('checked' => false, 'value' => "open", 'disabled' => false, 'text' => "公开(有产品视图权限,即可访问)"));
|
||||
$whitelistOptions = array();
|
||||
|
||||
|
||||
/* ====== Define the page structure with zin widgets ====== */
|
||||
|
||||
/* zin: Define the form in main content */
|
||||
formPanel
|
||||
(
|
||||
formGroup
|
||||
(
|
||||
set::width("1/3"),
|
||||
set::name("program"),
|
||||
set::label("项目集"),
|
||||
set::control("picker"),
|
||||
set::items($programOptions)
|
||||
),
|
||||
formRow
|
||||
(
|
||||
set::hidden(true),
|
||||
formGroup
|
||||
(
|
||||
set::width("1/3"),
|
||||
set::name("line"),
|
||||
set::label("产品线"),
|
||||
set::control("picker"),
|
||||
set::items($lineOptions)
|
||||
)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width("1/3"),
|
||||
set::name("name"),
|
||||
set::label("产品名称"),
|
||||
set::required(true),
|
||||
set::control("text")
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width("1/3"),
|
||||
set::name("PO"),
|
||||
set::label("产品负责人"),
|
||||
set::control("picker"),
|
||||
set::items($POOptions)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width("1/3"),
|
||||
set::name("QD"),
|
||||
set::label("测试负责人"),
|
||||
set::control("picker"),
|
||||
set::items($QDOptions)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width("1/3"),
|
||||
set::name("RD"),
|
||||
set::label("发布负责人"),
|
||||
set::control("picker"),
|
||||
set::items($RDOptions)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width("1/3"),
|
||||
set::name("reviewer[]"),
|
||||
set::label("评审人"),
|
||||
set::control(["type" =>"picker","multiple"=>true]),
|
||||
set::id("reviewer"),
|
||||
set::items($reviewerOptions)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width("1/3"),
|
||||
set::name("type"),
|
||||
set::label("产品类型"),
|
||||
set::value("normal"),
|
||||
set::control("picker"),
|
||||
set::items($typeOptions)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width("2/3"),
|
||||
set::label("产品描述"),
|
||||
inputGroup
|
||||
(
|
||||
control(set(array
|
||||
(
|
||||
'id' => "title",
|
||||
'value' => "",
|
||||
'disabled' => false,
|
||||
'type' => "text"
|
||||
))),
|
||||
"公共",
|
||||
btn(set(array
|
||||
(
|
||||
'type' => "btn",
|
||||
'text' => "保存",
|
||||
'class' => "input-group-btn"
|
||||
)))
|
||||
)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width("2/3"),
|
||||
set::name("acl"),
|
||||
set::label("访问控制"),
|
||||
set::control("radioList"),
|
||||
set::items($aclOptions)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width("1/3"),
|
||||
set::label("白名单"),
|
||||
inputGroup
|
||||
(
|
||||
control(set(array
|
||||
(
|
||||
'name' => "whitelist[]",
|
||||
'id' => "whitelist",
|
||||
'value' => NULL,
|
||||
'disabled' => false,
|
||||
'type' => "picker",
|
||||
'items' => $whitelistOptions,
|
||||
'multiple' => true
|
||||
))),
|
||||
btn(set(array
|
||||
(
|
||||
'type' => "btn",
|
||||
'icon' => "cog",
|
||||
'text' => "",
|
||||
'class' => "input-group-btn"
|
||||
))),
|
||||
btn(set(array
|
||||
(
|
||||
'type' => "btn",
|
||||
'icon' => "refresh",
|
||||
'text' => "",
|
||||
'class' => "input-group-btn"
|
||||
)))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
/* ====== Render page ====== */
|
||||
|
||||
render();
|
||||
|
||||
@@ -208,8 +208,7 @@ class productZen extends product
|
||||
protected function getProductLines(): array
|
||||
{
|
||||
/* Get all product lines. */
|
||||
/* TODO use model of module. */
|
||||
$productLines = $this->dao->select('*')->from(TABLE_MODULE)->where('type')->eq('line')->andWhere('deleted')->eq(0)->orderBy('`order` asc')->fetchAll();
|
||||
$productLines = $this->product->getProductLinesTODO();
|
||||
|
||||
/* Collect product lines of program lines. */
|
||||
$programLines = array();
|
||||
|
||||
Reference in New Issue
Block a user