+ add editor to product module.

+ add PO, QM, RM to product and project.
This commit is contained in:
wangchunsheng
2010-11-24 03:29:13 +00:00
parent 79aa8ae51e
commit 11c730dff5
15 changed files with 119 additions and 50 deletions
+8 -1
View File
@@ -1,3 +1,10 @@
-- 2010-11-13 project table.
ALTER TABLE `zt_project` ADD `RM` varchar(30) NOT NULL DEFAULT '' AFTER `QM`;
ALTER TABLE `zt_user` DROP `birthday` ;
ALTER TABLE `zt_user` DROP `birthyear`;
-- 2010-11-24 product table.
ALTER TABLE `zt_product` CHANGE `productOwner` `PO` VARCHAR( 30 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
CHANGE `bugOwner` `QM` VARCHAR( 30 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
ALTER TABLE `zt_product` ADD `RM` VARCHAR( 30 ) NOT NULL AFTER `QM` ;
ALTER TABLE `zt_product` ADD `createdBy` VARCHAR( 30 ) NOT NULL AFTER `whitelist` ,
ADD `createdDate` DATETIME NOT NULL AFTER `createdBy` ;
+3
View File
@@ -33,3 +33,6 @@ $config->product->search['params']['mailto'] = array('operator' => 'includ
$config->product->create->requiredFields = 'name,code';
$config->product->edit->requiredFields = 'name,code';
$config->product->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
$config->product->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools');
+2 -2
View File
@@ -69,7 +69,7 @@ class product extends control
$this->session->set('productList', $this->app->getURI(true));
/* Set product, module and query. */
$productID = $this->product->saveState($productID, key($this->products));
$productID = $this->product->saveState($productID, $this->products);
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
@@ -224,7 +224,7 @@ class product extends control
$this->view->position[] = $this->lang->product->view;
$this->view->product = $product;
$this->view->actions = $this->loadModel('action')->getList('product', $productID);
$this->view->users = $this->user->getPairs();
$this->view->users = $this->user->getPairs('noletter');
$this->view->groups = $this->loadModel('group')->getPairs();
$this->display();
+3 -1
View File
@@ -40,7 +40,9 @@ $lang->product->code = 'Code';
$lang->product->order = 'Order';
$lang->product->status = 'Status';
$lang->product->desc = 'Desc';
$lang->product->bugOwner = 'Bug Owner';
$lang->product->PO = 'Product owner';
$lang->product->QM = 'QA manager';
$lang->product->RM = 'Release manager';
$lang->product->acl = 'Access limitation';
$lang->product->whitelist = 'Whitelist';
+3 -1
View File
@@ -40,7 +40,9 @@ $lang->product->code = '产品代号';
$lang->product->order = '排序';
$lang->product->status = '状态';
$lang->product->desc = '产品描述';
$lang->product->bugOwner = 'Bug负责人';
$lang->product->PO = '产品负责人';
$lang->product->QM = '测试负责人';
$lang->product->RM = '发布负责人';
$lang->product->acl = '访问控制';
$lang->product->whitelist = '分组白名单';
+20 -12
View File
@@ -38,16 +38,17 @@ class productModel extends model
/**
* Save the product id user last visited to session.
*
* @param int $productID
* @param int $defaultProductID
* @param int $productID
* @param array $products
* @access public
* @return int
*/
public function saveState($productID, $defaultProductID)
public function saveState($productID, $products)
{
if($productID > 0) $this->session->set('product', (int)$productID);
if($productID == 0 and $this->cookie->lastProduct) $this->session->set('product', (int)$this->cookie->lastProduct);
if($productID == 0 and $this->session->product == '') $this->session->set('product', $defaultProductID);
if($productID == 0 and $this->session->product == '') $this->session->set('product', key($products));
if(!isset($products[$this->session->product])) $this->session->set('product', key($products));
return $this->session->product;
}
@@ -68,7 +69,7 @@ class productModel extends model
if($product->acl == 'open') return true;
/* Get team members. */
$teamMembers = $this->getTeamMemberPairs($product->id);
$teamMembers = $this->getTeamMemberPairs($product);
/* Private. */
if($product->acl == 'private')
@@ -156,8 +157,10 @@ class productModel extends model
{
$product = fixer::input('post')
->stripTags('name,code')
->specialChars('desc')
->setIF($this->post->acl != 'custom', 'whitelist', '')
->setDefault('status', 'normal')
->setDefault('createdBy', $this->app->user->account)
->setDefault('createdDate', helper::now())
->join('whitelist', ',')
->get();
$this->dao->insert(TABLE_PRODUCT)
@@ -183,7 +186,6 @@ class productModel extends model
$oldProduct = $this->getById($productID);
$product = fixer::input('post')
->stripTags('name,code')
->specialChars('desc')
->setIF($this->post->acl != 'custom', 'whitelist', '')
->join('whitelist', ',')
->get();
@@ -248,14 +250,20 @@ class productModel extends model
/**
* Get team members of a product from projects.
*
* @param int $productID
* @param object $product
* @access public
* @return array
*/
public function getTeamMemberPairs($productID)
public function getTeamMemberPairs($product)
{
$projects = $this->dao->select('project')->from(TABLE_PROJECTPRODUCT)->where('product')->eq($productID)->fetchPairs();
if(!$projects) return array();
return $this->dao->select('account')->from(TABLE_TEAM)->where('project')->in($projects)->fetchPairs();
$members[$product->PO] = $product->PO;
$members[$product->QM] = $product->QM;
$members[$product->RM] = $product->RM;
$members[$product->createdBy] = $product->createdBy;
$projects = $this->dao->select('project')->from(TABLE_PROJECTPRODUCT)->where('product')->eq($product->id)->fetchPairs();
if(!$projects) return $members;
$projectTeams = $this->dao->select('account')->from(TABLE_TEAM)->where('project')->in($projects)->fetchPairs();
return array_merge($members, $projectTeams);
}
}
+12 -7
View File
@@ -11,6 +11,7 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<script language='Javascript'>
function setWhite(acl)
{
@@ -23,23 +24,27 @@ function setWhite(acl)
<caption><?php echo $lang->product->create;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->product->name;?></th>
<td><?php echo html::input('name', '', "class='text-2'");?></td>
<td><?php echo html::input('name', '', "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->code;?></th>
<td><?php echo html::input('code', '', "class='text-2'");?></td>
<td><?php echo html::input('code', '', "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->bugOwner;?></th>
<td><?php echo html::select('bugOwner', $users, $this->app->user->account, "class='select-2'");?></td>
<th class='rowhead'><?php echo $lang->product->PO;?></th>
<td><?php echo html::select('PO', $users, $this->app->user->account, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->status;?></th>
<td><?php echo html::select('status', $lang->product->statusList, '', "class='select-2'");?></td>
<th class='rowhead'><?php echo $lang->product->QM;?></th>
<td><?php echo html::select('QM', $users, $this->app->user->account, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->RM;?></th>
<td><?php echo html::select('RM', $users, $this->app->user->account, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->desc;?></th>
<td><?php echo html::textarea('desc', '', "rows='5' class='area-1'");?></textarea></td>
<td><?php echo html::textarea('desc', '', "rows='8' class='area-1'");?></textarea></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->acl;?></th>
+15 -6
View File
@@ -11,6 +11,7 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<script language='Javascript'>
function setWhite(acl)
{
@@ -23,23 +24,31 @@ function setWhite(acl)
<caption><?php echo $lang->product->edit;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->product->name;?></th>
<td><?php echo html::input('name', $product->name, "class='text-2'");?></td>
<td><?php echo html::input('name', $product->name, "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->code;?></th>
<td><?php echo html::input('code', $product->code, "class='text-2'");?></td>
<td><?php echo html::input('code', $product->code, "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->bugOwner;?></th>
<td><?php echo html::select('bugOwner', $users, $product->bugOwner, "class='select-2'");?></td>
<th class='rowhead'><?php echo $lang->product->PO;?></th>
<td><?php echo html::select('PO', $users, $product->PO, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->QM;?></th>
<td><?php echo html::select('QM', $users, $product->QM, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->RM;?></th>
<td><?php echo html::select('RM', $users, $product->RM, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->status;?></th>
<td><?php echo html::select('status', $lang->product->statusList, $product->status, "class='select-2'");?></td>
<td><?php echo html::select('status', $lang->product->statusList, $product->status, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->desc;?></th>
<td><?php echo html::textarea('desc', $product->desc, "rows='5' class='area-1'");?></td>
<td><?php echo html::textarea('desc', htmlspecialchars($product->desc), "rows='8' class='area-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->acl;?></th>
+11 -3
View File
@@ -23,8 +23,16 @@
<td><?php echo $product->code;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->bugOwner;?></th>
<td><?php echo $users[$product->bugOwner];?></td>
<th class='rowhead'><?php echo $lang->product->PO;?></th>
<td><?php echo $users[$product->PO];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->QM;?></th>
<td><?php echo $users[$product->QM];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->RM;?></th>
<td><?php echo $users[$product->RM];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->status;?></th>
@@ -32,7 +40,7 @@
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->desc;?></th>
<td><?php echo nl2br($product->desc);?></td>
<td class='content'><?php echo $product->desc;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->acl;?></th>
+1
View File
@@ -12,6 +12,7 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<div class='yui-d0'>
<form method='post' target='hiddenwin'>
<table class='table-1'>
+6 -1
View File
@@ -494,6 +494,11 @@ class project extends control
$projects = array('' => '') + $this->projects;
$project = $this->project->getById($projectID);
$managers = $this->project->getDefaultManagers($projectID);
if(empty($project->PO)) $project->PO = $managers->PO;
if(empty($project->PM)) $project->PM = $this->app->user->account;
if(empty($project->QM)) $project->QM = $managers->QM;
if(empty($project->RM)) $project->RM = $managers->RM;
/* Remove current project from the projects. */
unset($projects[$projectID]);
@@ -539,7 +544,7 @@ class project extends control
$this->view->products = $this->project->getProducts($project->id);
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->actions = $this->loadModel('action')->getList('project', $projectID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
}
+2 -14
View File
@@ -2,20 +2,8 @@
/**
* The project module zh-cn file of ZenTaoMS.
*
* ZenTaoMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ZenTaoMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ZenTaoMS. If not, see <http://www.gnu.org/licenses/>.
*
* @copyright Copyright 2009-2010 青岛易软天创网络科技有限公司(www.cnezsoft.com)
* @copyright Copyright 2009-2010 QingDao Nature Easy Soft Network Technology Co,LTD (www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package project
* @version $Id$
+15
View File
@@ -258,6 +258,21 @@ class projectModel extends model
return $project;
}
/**
* Get the default managers for a project from it's related products.
*
* @param int $projectID
* @access public
* @return object
*/
public function getDefaultManagers($projectID)
{
return $this->dao->select('PO,QM,RM')->from(TABLE_PRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id = t2.product')
->where('t2.project')->eq($projectID)
->fetch();
}
/**
* Get products of a project.
*
+16
View File
@@ -38,6 +38,22 @@
<th class='rowhead'><?php echo $lang->project->status;?></th>
<td class='<?php echo $project->status;?>'><?php $lang->show($lang->project->statusList, $project->status);?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->PM;?></th>
<td><?php echo $users[$project->PM];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->PO;?></th>
<td><?php echo $users[$project->PO];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->QM;?></th>
<td><?php echo $users[$project->QM];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->RM;?></th>
<td><?php echo $users[$project->RM];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->lblStats;?></th>
<td><?php printf($lang->project->stats, $project->totalEstimate, $project->totalConsumed, $project->totalLeft, 10)?></td>
+2 -2
View File
@@ -118,10 +118,10 @@ class tree extends control
echo js::alert($this->lang->tree->successSave);
die(js::reload('parent'));
}
$module = $this->tree->getById($moduleID);
$module = $this->tree->getById($moduleID);
if($module->owner == null)
{
$module->owner = $this->loadModel('product')->getById($module->root)->bugOwner;
$module->owner = $this->loadModel('product')->getById($module->root)->QM;
}
$this->view->module = $module;
$this->view->optionMenu = $this->tree->getOptionMenu($this->view->module->root, $this->view->module->type);