* Move stage method to zentaopms.

This commit is contained in:
Yagami
2020-08-17 14:41:58 +08:00
parent 5ab40d872f
commit 4fe2e5f278
16 changed files with 328 additions and 99 deletions
+2 -1
View File
@@ -193,7 +193,8 @@ define('TABLE_RELATION', '`' . $config->db->prefix . 'relation`');
define('TABLE_REPOHISTORY', '`' . $config->db->prefix . 'repohistory`');
define('TABLE_REPOFILES', '`' . $config->db->prefix . 'repofiles`');
define('TABLE_REPOBRANCH', '`' . $config->db->prefix . 'repobranch`');
if(!defined('TABLE_LANG')) define('TABLE_LANG', '`' . $config->db->prefix . 'lang`');
if(!defined('TABLE_LANG')) define('TABLE_LANG', '`' . $config->db->prefix . 'lang`');
if(!defined('TABLE_STAGE')) define('TABLE_STAGE', '`' . $config->db->prefix . 'stage`');
$config->objectTables['product'] = TABLE_PRODUCT;
$config->objectTables['story'] = TABLE_STORY;
+21
View File
@@ -36,3 +36,24 @@ ALTER TABLE `zt_usergroup` ADD `program` text NOT NULL;
ALTER TABLE `zt_userview` ADD `programs` mediumtext COLLATE 'utf8_general_ci' NOT NULL AFTER `account`;
ALTER TABLE `zt_user` ADD `type` char(30) NOT NULL AFTER `account`;
CREATE TABLE `zt_stage` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`percent` varchar(255) NOT NULL,
`type` varchar(255) NOT NULL,
`createdBy` varchar(30) NOT NULL,
`createdDate` datetime NOT NULL,
`editedBy` varchar(30) NOT NULL,
`editedDate` datetime NOT NULL,
`deleted` enum('0','1') NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `zt_stage` (`name`,`percent`,`type`,`createdBy`,`createdDate`,`editedBy`,`editedDate`,`deleted`) VALUES
('需求','10','request','admin','2020-02-08 21:08:30','admin','2020-02-12 13:50:27','0'),
('设计','10','design','admin','2020-02-08 21:08:30','admin','2020-02-12 13:50:27','0'),
('开发','50','dev','admin','2020-02-08 21:08:30','admin','2020-02-12 13:50:27','0'),
('测试','15','qa','admin','2020-02-08 21:08:30','admin','2020-02-12 13:50:27','0'),
('发布','10','release','admin','2020-02-08 21:08:30','admin','2020-02-12 13:50:27','0'),
('总结评审','5','review','admin','2020-02-08 21:08:45','admin','2020-02-12 13:50:27','0');
-4
View File
@@ -9,8 +9,6 @@ class programplan extends control
public function commonAction($programID, $productID = 0, $extra = '')
{
//$this->loadModel('project')->saveState($programID, array());
$products = $this->loadModel('product')->getPairs($programID);
$productID = $this->product->saveState($productID, $products);
$this->product->setMenu($products, $productID, 0, 0, '', $extra);
@@ -89,7 +87,6 @@ class programplan extends control
$this->view->stages = $stages;
$this->view->plans = $plans;
$this->view->planID = $planID;
$this->view->documentList = $this->programplan->getDocumentList();
$this->view->type = 'lists';
$this->display();
@@ -116,7 +113,6 @@ class programplan extends control
$this->app->loadLang('stage');
$this->view->title = $this->lang->programplan->edit;
$this->view->position[] = $this->lang->programplan->edit;
$this->view->documentList = $this->programplan->getDocumentList();
$this->view->parentStage = $this->programplan->getParentStageList($planID, $plan->product);
$this->view->plan = $plan;
$this->view->isParent = $this->programplan->isParent($planID);
+2 -43
View File
@@ -3,30 +3,7 @@ class programplanModel extends model
{
public function setMenu($programID, $productID)
{
$baselines = "";
$subMenu = array();
if(!empty($baselines))
{
foreach($baselines as $id => $version)
{
$link = array();
$link['module'] = 'programplan';
$link['method'] = 'browse';
$link['vars'] = "program=$programID&productID=$productID&type=gantt&orderBy=id_desc&baselineID=$id";
$menu = new stdclass();
$menu->name = $id;
$menu->link = $link;
$menu->text = $version;
$menu->subModule = '';
$menu->alias = '';
$menu->hidden = false;
$subMenu[$id] = $menu;
}
$this->lang->programplan->menu->gantt['subMenu'] = $subMenu;
$this->lang->programplan->menu->gantt['class'] = 'dropdown dropdown-hover';
}
return true;
}
public function getByID($planID)
@@ -92,22 +69,11 @@ class programplanModel extends model
public function getPlans($programID = 0, $productID = 0, $orderBy = 'id_asc')
{
$plans = $this->getList($programID, $productID, 0, 'all', $orderBy);
$documentList = $this->getDocumentList();
$plans = $this->getList($programID, $productID, 0, 'all', $orderBy);
$parents = array();
foreach($plans as $planID => $plan)
{
$document = '';
if(!empty($plan->output))
{
$output = explode(',', $plan->output);
foreach($output as $title) if(isset($documentList[$title])) $document .= $documentList[$title];
}
$plan->output = empty($plan->output) ? '' : $document;
$plan->parent == 0 ? $parents[$planID] = $plan : $children[$plan->parent][] = $plan;
}
@@ -719,13 +685,6 @@ class programplanModel extends model
->fetchPairs();
}
public function getDocumentList()
{
return $document = $this->dao->select('*')->from(TABLE_OUTPUT)
->where('deleted')->eq(0)
->fetchPairs('id', 'name');
}
public function isParent($planID)
{
$children = $this->dao->select('id')->from(TABLE_PROJECT)->where('parent')->eq($planID)->andWhere('deleted')->eq('0')->fetch();
+1 -6
View File
@@ -21,7 +21,6 @@
<th class='w-110px required'><?php echo $lang->programplan->end;?></th>
<th class='w-110px'><?php echo $lang->programplan->realStarted;?></th>
<th class='w-110px'><?php echo $lang->programplan->realFinished;?></th>
<th class='w-110px'><?php echo $lang->programplan->output;?></th>
<th class="w-90px"> <?php echo $lang->actions;?></th>
</tr>
</thead>
@@ -43,7 +42,6 @@
<td><input type='text' name='end[]' id='end<?php echo $i;?>' value='' class='form-control form-date' /></td>
<td><input type='text' name='realStarted[]' id='realStarted<?php echo $i;?>' value='' class='form-control form-date' /></td>
<td><input type='text' name='realFinished[]' id='realFinished<?php echo $i;?>' value='' class='form-control form-date' /></td>
<td><?php echo html::select("output[$i][]", $documentList, '', "class='form-control chosen' multiple");?></td>
<td class='c-actions text-center'>
<a href='javascript:;' onclick='addItem(this)' class='btn btn-link'><i class='icon-plus'></i></a>
<a href='javascript:;' onclick='deleteItem(this)' class='btn btn-link'><i class='icon icon-close'></i></a>
@@ -72,7 +70,6 @@
<td><input type='text' name='realStarted[] ' id='realStarted<?php echo $i;?>' value='<?php echo $plan->realStarted;?>' class='form-control form-date' /></td>
<td><input type='text' name='realFinished[]' id='realFinished<?php echo $i;?>' value='<?php echo $plan->realFinished;?>' class='form-control form-date' /></td>
<?php $option = empty($plan->output) ? 0 : explode(',', $plan->output);?>
<td><?php echo html::select("output[$i][]", $documentList, $option, "class='form-control chosen' multiple");?></td>
<td class='c-actions text-center'>
<a href='javascript:;' onclick='addItem(this)' class='btn btn-link'><i class='icon-plus'></i></a>
</td>
@@ -96,7 +93,6 @@
<td><input type='text' name='end[]' id='end<?php echo $i;?>' value='' class='form-control form-date' /></td>
<td><input type='text' name='realStarted[] ' id='realStarted<?php echo $i;?>' value='' class='form-control form-date' /></td>
<td><input type='text' name='realFinished[]' id='realFinished<?php echo $i;?>' value='' class='form-control form-date' /></td>
<td><?php echo html::select("output[$i][]", $documentList, '', "class='form-control chosen' multiple");?></td>
<td class='c-actions text-center'>
<a href='javascript:;' onclick='addItem(this)' class='btn btn-link'><i class='icon-plus'></i></a>
<a href='javascript:;' onclick='deleteItem(this)' class='btn btn-link'><i class='icon icon-close'></i></a>
@@ -107,7 +103,7 @@
</tbody>
<tfoot>
<tr>
<?php $colspan = $planID == 0 ? 10 : 9;?>
<?php $colspan = $planID == 0 ? 9 : 8;?>
<td colspan='<?php echo $colspan?>' class='text-center form-actions'><?php echo html::submitButton() . ' ' . html::backButton(); ?></td>
</tr>
</tfoot>
@@ -132,7 +128,6 @@
<td><input type='text' name='end[]' id='end<?php echo $i;?>' class='form-control form-date' /></td>
<td><input type='text' name='realStarted[] ' id='realStarted<?php echo $i;?>' class='form-control form-date' /></td>
<td><input type='text' name='realFinished[]' id='realFinished<?php echo $i;?>' class='form-control form-date' /></td>
<td><?php echo html::select("output[$i][]", $documentList, '', "class='form-control chosen ' multiple");?></td>
<td class='c-actions text-center'>
<a href='javascript:;' onclick='addItem(this)' class='btn btn-link'><i class='icon-plus'></i></a>
<a href='javascript:;' onclick='deleteItem(this)' class='btn btn-link'><i class='icon icon-close'></i></a>
-4
View File
@@ -61,10 +61,6 @@ js::set('parentID', $plan->parent);
<th><?php echo $lang->programplan->realFinished;?> </th>
<td><?php echo html::input('realFinished', $plan->realFinished, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->programplan->output;?> </th>
<td colspan='2'><?php echo html::select('output[]', $documentList, $plan->output, "class='form-control chosen ' multiple");?></td>
</tr>
<tr>
<td colspan='4' class='form-actions text-center'><?php echo html::submitButton() . html::backButton()?></td>
</tr>
-41
View File
@@ -1,41 +0,0 @@
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.9~svn20110310 //
afterFinish gantt.html.php /^ var afterFinish = function(canvas)$/;" j
afterFinish gantt.html.php /^ var afterFinish = function(url)$/;" j
canvas.onerror gantt.html.php /^ canvas.onerror = function()$/;" j
columns list.html.php /^ $columns = 0;$/;" v
delayHandleFullscreen gantt.html.php /^ var delayHandleFullscreen = function()$/;" j
drawGanttToCanvas gantt.html.php /^function drawGanttToCanvas(exportType, sucessCallback, errorCallback)$/;" f
exportGantt gantt.html.php /^function exportGantt(exportType)$/;" f
gantt.templates.grid_file gantt.html.php /^ gantt.templates.grid_file = function(item) {$/;" j
gantt.templates.grid_folder gantt.html.php /^ gantt.templates.grid_folder = function(item) {$/;" j
gantt.templates.scale_cell_class gantt.html.php /^ gantt.templates.scale_cell_class = function(date)$/;" j
gantt.templates.timeline_cell_class gantt.html.php /^ gantt.templates.timeline_cell_class = function(item, date)$/;" j
ganttContainer gantt.html.php /^ var $ganttContainer = $('#ganttContainer');$/;" v
ganttDataArea gantt.html.php /^ var $ganttDataArea = $ganttView.find('.gantt_data_area');$/;" v
ganttDridData gantt.html.php /^ var $ganttDridData = $ganttView.find('.gantt_grid_data');$/;" v
ganttView gantt.html.php /^ var $ganttView = $('#ganttView');$/;" v
getByIdForGantt gantt.html.php /^function getByIdForGantt(list, id)$/;" f
getRemoteScript gantt.html.php /^function getRemoteScript(url, sucessCallback, errorCallback)$/;" f
grid_file gantt.html.php /^ gantt.templates.grid_file = function(item) {$/;" j
grid_folder gantt.html.php /^ gantt.templates.grid_folder = function(item) {$/;" j
handleFullscreen gantt.html.php /^ var handleFullscreen = function()$/;" j
mainContent gantt.html.php /^ var $mainContent = $('#mainContent');$/;" v
onerror gantt.html.php /^ canvas.onerror = function()$/;" j
resizeGanttView gantt.html.php /^ var resizeGanttView = function()$/;" j
scale_cell_class gantt.html.php /^ gantt.templates.scale_cell_class = function(date)$/;" j
setting list.html.php /^ $setting = $this->datatable->getSetting('programplan');$/;" v
success gantt.html.php /^ success: function(result)$/;" j
task gantt.html.php /^ var $task = $(this).closest('.gantt_row_task');$/;" v
template gantt.html.php /^ {name: 'percent', align: 'center', resize: true, width:70, template: function(plan)$/;" j
timeline_cell_class gantt.html.php /^ gantt.templates.timeline_cell_class = function(item, date)$/;" j
toggle list.html.php /^ var $toggle = $(this);$/;" v
updateCriticalPath gantt.html.php /^function updateCriticalPath()$/;" f
updateProgress gantt.html.php /^function updateProgress(progress)$/;" f
vars list.html.php /^ $vars = "programID=$programID&productID=$productID&type=lists&orderBy=%s";$/;" v
widths list.html.php /^ $widths = $this->datatable->setFixedFieldWidth($setting);$/;" v
zoomTasks gantt.html.php /^function zoomTasks(node)$/;" f
+92
View File
@@ -0,0 +1,92 @@
<?php
class stage extends control
{
public function browse()
{
$this->view->title = $this->lang->stage->common . $this->lang->colon . $this->lang->stage->browse;
$this->view->position[] = $this->lang->stage->common;
$this->view->position[] = $this->lang->stage->browse;
$this->display();
}
public function create()
{
if($_POST)
{
$stageID = $this->stage->create();
$response['result'] = 'success';
$response['message'] = $this->lang->saveSuccess;
if(!$stageID)
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
$this->send($response);
}
$this->loadModel('action')->create('stage', $stageID, 'Opened');
$response['locate'] = inlink('browse');
$this->send($response);
}
$this->view->title = $this->lang->stage->common . $this->lang->colon . $this->lang->stage->create;
$this->view->position[] = $this->lang->stage->common;
$this->view->position[] = $this->lang->stage->create;
$this->display();
}
public function edit($stageID = 0)
{
$stage = $this->stage->getByID($stageID);
if($_POST)
{
$changes = $this->stage->update($stageID);
$response['result'] = 'success';
$response['message'] = $this->lang->saveSuccess;
if(dao::isError())
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
$this->send($response);
}
$actionID = $this->loadModel('action')->create('stage', $stageID, 'Edited');
if(!empty($changes)) $this->action->logHistory($actionID, $changes);
$response['locate'] = inlink('view', "stageID=$stageID");
$this->send($response);
}
$this->view->title = $this->lang->stage->common . $this->lang->colon . $this->lang->stage->edit;
$this->view->position[] = $this->lang->stage->common;
$this->view->position[] = $this->lang->stage->edit;
$this->view->stage = $stage;
$this->display();
}
public function setType()
{
$this->loadModel('custom');
if($_POST)
{
$data = fixer::input('post')->get();
$this->custom->deleteItems("lang=all&module=stage&section=typeList");
foreach($data->keys as $index => $key)
{
$value = $data->values[$index];
if(!$value or !$key) continue;
$this->custom->setItem("all.stage.typeList.{$key}", $value);
}
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('stage', 'settype')));
}
$this->view->title = $this->lang->stage->common . $this->lang->colon . $this->lang->stage->setType;
$this->view->position[] = $this->lang->stage->common;
$this->view->position[] = $this->lang->stage->setType;
$this->display();
}
}
@@ -0,0 +1 @@
<script> $('#toList').closest('tr').remove(); </script>
@@ -0,0 +1 @@
<script> $('#toList').closest('tr').remove(); </script>
+24
View File
@@ -0,0 +1,24 @@
<?php
/* Actions. */
$lang->stage->browse = '浏览列表';
$lang->stage->create = '新建';
$lang->stage->batchCreate = '批量新建';
$lang->stage->edit = '编辑';
$lang->stage->delete = '删除';
$lang->stage->view = '阶段详情';
/* Fields. */
$lang->stage->common = '阶段';
$lang->stage->name = '阶段名称';
$lang->stage->type = '阶段分类';
$lang->stage->percent = '工作量比例';
$lang->stage->setType = '设置类型';
$lang->stage->typeList['request'] = '需求';
$lang->stage->typeList['design'] = '设计';
$lang->stage->typeList['dev'] = '开发';
$lang->stage->typeList['qa'] = '测试';
$lang->stage->typeList['release'] = '发布';
$lang->stage->typeList['review'] = '总结评审';
$lang->stage->typeList['other'] = '其他';
+34
View File
@@ -0,0 +1,34 @@
<?php
class stageModel extends model
{
public function create()
{
$stage = fixer::input('post')
->add('createdBy', $this->app->user->account)
->add('createdDate', helper::today())
->get();
$this->dao->insert(TABLE_STAGE)->data($stage)->autoCheck()->exec();
if(!dao::isError()) return $this->dao->lastInsertID();
return false;
}
public function getStages()
{
return $this->dao->select('*')->from(TABLE_STAGE)->where('deleted')->eq(0)->fetchAll('id');
}
public function getPairs()
{
$stages = $this->getStages();
$pairs = array();
foreach($stages as $stageID => $stage)
{
$pairs[$stageID] = $stage->name;
}
return $pairs;
}
}
+8
View File
@@ -0,0 +1,8 @@
<?php include '../../common/view/header.html.php';?>
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-right">
<?php common::printLink('stage', 'batchCreate', "", "<i class='icon icon-plus'></i>" . $lang->stage->batchCreate, '', "class='btn btn-primary'");?>
<?php common::printLink('stage', 'create', "", "<i class='icon icon-plus'></i>" . $lang->stage->create, '', "class='btn btn-primary'");?>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
+39
View File
@@ -0,0 +1,39 @@
<?php include '../../common/view/header.html.php';?>
<div id="mainContent" class="main-content fade">
<div class="center-block">
<div class="main-header">
<h2><?php echo $lang->stage->create;?></h2>
</div>
<form class="load-indicator main-form form-ajax" method='post' enctype='multipart/form-data' id='dataform'>
<table class="table table-form">
<tbody>
<tr>
<th><?php echo $lang->stage->name;?></th>
<td><?php echo html::input('name', '', "class='form-control'");?></td>
<td></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->stage->percent;?></th>
<td>
<div class='input-group'>
<?php echo html::input('percent', '', "class='form-control'");?>
<span class='input-group-addon'>%</span>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->stage->type;?></th>
<td><?php echo html::select('type', $lang->stage->typeList, '', "class='form-control chosen'");?></td>
</tr>
<tr>
<td></td>
<td colspan='3' class='form-actions'>
<?php echo html::submitButton() . html::backButton();?>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<?php include '../../common/view/footer.html.php';?>
+39
View File
@@ -0,0 +1,39 @@
<?php include '../../common/view/header.html.php';?>
<div id="mainContent" class="main-content fade">
<div class="center-block">
<div class="main-header">
<h2><?php echo $lang->stage->edit;?></h2>
</div>
<form class="load-indicator main-form form-ajax" method='post' enctype='multipart/form-data' id='dataform'>
<table class="table table-form">
<tbody>
<tr>
<th><?php echo $lang->stage->name;?></th>
<td><?php echo html::input('name', $stage->name, "class='form-control'");?></td>
<td></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->stage->percent;?></th>
<td>
<div class='input-group'>
<?php echo html::input('percent', $stage->percent, "class='form-control'");?>
<span class='input-group-addon'>%</span>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->stage->type;?></th>
<td><?php echo html::select('type', $lang->stage->typeList, $stage->type, "class='form-control chosen'");?></td>
</tr>
<tr>
<td></td>
<td colspan='3' class='form-actions'>
<?php echo html::submitButton() . html::backButton();?>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<?php include '../../common/view/footer.html.php';?>
+64
View File
@@ -0,0 +1,64 @@
<?php include '../../common/view/header.html.php';?>
<?php
$itemRow = <<<EOT
<tr class='text-left'>
<td>
<input type='text' class="form-control" autocomplete="off" value="" name="keys[]">
</td>
<td>
<input type='text' class="form-control" value="" autocomplete="off" name="values[]">
</td>
<td class='c-actions'>
<a href="javascript:void(0)" class='btn btn-link' onclick="addItem(this)"><i class='icon-plus'></i></a>
<a href="javascript:void(0)" class='btn btn-link' onclick="delItem(this)"><i class='icon-close'></i></a>
</td>
</tr>
EOT;
?>
<?php js::set('itemRow', $itemRow)?>
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<form class="load-indicator main-form form-ajax" method='post'>
<table class='table table-form active-disabled table-condensed mw-600px'>
<thead>
<tr class='text-center'>
<th class='w-70px'><?php echo $lang->custom->key;?></th>
<th class='w-250px'><?php echo $lang->custom->value;?></th>
<th class='w-100px'></th>
</tr>
</thead>
<tbody>
<?php foreach($lang->stage->typeList as $key => $value):?>
<tr class='text-center'>
<td class='w-70px'>
<?php echo $key;?>
<?php echo html::hidden('keys[]', $key) ?>
</td>
<td class='w-200px'><?php echo html::input('values[]', $value, 'class="form-control"');?></td>
<td class='c-actions text-left'>
<a href="javascript:void(0)" onclick="addItem(this)" class='btn btn-link'><i class='icon-plus'></i></a>
<a href="javascript:void(0)" class='btn btn-link' onclick="delItem(this)"><i class='icon-close'></i></a>
</td>
</tr>
<?php endforeach;?>
<tr>
<td></td>
<td colspan='2' class='form-actions'><?php echo html::submitButton() . html::backButton();?></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<script>
function addItem(clickedButton)
{
$(clickedButton).parent().parent().after(itemRow);
}
function delItem(clickedButton)
{
$(clickedButton).parent().parent().remove();
}
</script>
<?php include '../../common/view/footer.html.php';?>