Merge branch '20.x' of github.com:easysoft/zentaopms into 20.x

This commit is contained in:
tianshujie98
2020-08-20 16:25:00 +08:00
38 changed files with 644 additions and 365 deletions
+16 -13
View File
@@ -239,10 +239,10 @@ CREATE TABLE IF NOT EXISTS `zt_holiday` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL DEFAULT '',
`type` enum('holiday', 'working') NOT NULL DEFAULT 'holiday',
`desc` text NOT NULL,
`year` char(4) NOT NULL,
`begin` date NOT NULL,
`end` date NOT NULL,
`desc` text NOT NULL,
`year` char(4) NOT NULL,
`begin` date NOT NULL,
`end` date NOT NULL,
PRIMARY KEY (`id`),
KEY `year` (`year`),
KEY `name` (`name`)
@@ -272,16 +272,19 @@ CREATE TABLE `zt_taskspec` (
CREATE TABLE `zt_weeklyreport`(
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`program` mediumint(8) unsigned NOT NULL,
`weekStart` date NOT NULL,
`pv` float(9,2) NOT NULL,
`ev` float(9,2) NOT NULL,
`ac` float(9,2) NOT NULL,
`sv` float(9,2) NOT NULL,
`cv` float(9,2) NOT NULL,
`program` mediumint(8) unsigned NOT NULL,
`weekStart` date NOT NULL,
`pv` float(9,2) NOT NULL,
`ev` float(9,2) NOT NULL,
`ac` float(9,2) NOT NULL,
`sv` float(9,2) NOT NULL,
`cv` float(9,2) NOT NULL,
`staff` smallint(5) unsigned NOT NULL,
`progress` varchar(255) NOT NULL,
`workload` varchar(255) NOT NULL,
`progress` varchar(255) NOT NULL,
`workload` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `week` (`program`,`weekStart`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `zt_project` ADD `path` varchar(255) NOT NULL AFTER `parent`;
ALTER TABLE `zt_project` ADD `grade` tinyint unsigned NOT NULL AFTER `path`;
+4 -5
View File
@@ -1001,7 +1001,6 @@ class block extends control
->andWhere('parent')->lt(1)
->fetch();
$this->view->pv = $this->weekly->getPV($this->session->program, $today);
$this->view->ev = $this->weekly->getEV($this->session->program, $today);
$this->view->ac = $this->weekly->getAC($this->session->program, $today);
@@ -1034,6 +1033,7 @@ class block extends control
$uri = $this->app->getURI(true);
$this->session->set('riskList', $uri);
if(preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) die();
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->issues = $this->loadModel('issue')->getBlockIssues($this->params->type, $this->viewType == 'json' ? 0 : (int)$this->params->num, null, $this->params->orderBy);
}
@@ -1440,18 +1440,17 @@ class block extends control
*/
public function printScrumtestBlock()
{
$this->view->program = $this->loadModel('project')->getByID($this->session->program);
$this->session->set('testtaskList', $this->app->getURI(true));
if(preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) die();
$this->app->loadLang('testtask');
$this->view->testtasks = $this->dao->select('t1.*,t2.name as productName,t3.name as buildName,t4.name as projectName')->from(TABLE_TESTTASK)->alias('t1')
$this->view->testtasks = $this->dao->select('t1.*,t2.name as productName,t3.name as buildName,t4.name as projectName')
->from(TABLE_TESTTASK)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build=t3.id')
->leftJoin(TABLE_PROJECT)->alias('t4')->on('t1.project=t4.id')
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t5')->on('t1.project=t5.project')
->where('t1.deleted')->eq('0')
->beginIF(!$this->app->user->admin)->andWhere('t1.product')->in($this->app->user->view->products)->fi()
->andWhere('t1.product')->eq($this->session->program)->fi()
->andWhere('t1.product = t5.product')
->beginIF($this->params->type != 'all')->andWhere('t1.status')->eq($this->params->type)->fi()
->orderBy('t1.id desc')
+17 -1
View File
@@ -117,6 +117,10 @@ $lang->block->default['scrum']['program']['4']['title'] = '待测版本';
$lang->block->default['scrum']['program']['4']['block'] = 'scrumtest';
$lang->block->default['scrum']['program']['4']['grid'] = 8;
$lang->block->default['scrum']['program']['4']['params']['type'] = 'all';
$lang->block->default['scrum']['program']['4']['params']['num'] = '15';
$lang->block->default['scrum']['program']['4']['params']['orderBy'] = 'id_desc';
$lang->block->default['scrum']['program']['5']['title'] = '产品总览';
$lang->block->default['scrum']['program']['5']['block'] = 'scrumproduct';
$lang->block->default['scrum']['program']['5']['grid'] = 4;
@@ -126,7 +130,7 @@ $lang->block->default['scrum']['program']['6']['block'] = 'scrumproject';
$lang->block->default['scrum']['program']['6']['grid'] = 4;
$lang->block->default['scrum']['program']['7']['title'] = '最新动态';
$lang->block->default['scrum']['program']['7']['block'] = 'scrumoverview';
$lang->block->default['scrum']['program']['7']['block'] = 'scrumdynamic';
$lang->block->default['scrum']['program']['7']['grid'] = 4;
$lang->block->default['product']['1']['title'] = $lang->productCommon . '统计';
@@ -315,6 +319,18 @@ $lang->block->moduleList['product'] = $lang->productCommon;
$lang->block->moduleList['project'] = $lang->projectCommon;
$lang->block->moduleList['qa'] = '测试';
$lang->block->moduleList['todo'] = '待办';
$lang->block->moduleList['program'] = '项目';
$lang->block->modules['program'] = new stdclass();
$lang->block->modules['program']->availableBlocks = new stdclass();
$lang->block->modules['program']->availableBlocks->scrumoverall = '项目整体情况';
$lang->block->modules['program']->availableBlocks->scrumprogress = '进行中的迭代';
$lang->block->modules['program']->availableBlocks->scrumproject = '迭代总览';
$lang->block->modules['program']->availableBlocks->scrumproduct = '产品总览';
$lang->block->modules['program']->availableBlocks->scrumtest = '待测版本';
$lang->block->modules['program']->availableBlocks->scrumroadmap = '产品路线图';
$lang->block->modules['program']->availableBlocks->scrumdynamic = '最新动态';
$lang->block->modules['product'] = new stdclass();
$lang->block->modules['product']->availableBlocks = new stdclass();
+21
View File
@@ -661,4 +661,25 @@ class blockModel extends model
return $key == $hash;
}
/**
* Get testtask params.
*▫
* @param string $module▫
* @access public
* @return void
*/
public function getScrumtestParams($module = '')
{
$params = new stdclass();
$params->type['name'] = $this->lang->block->type;
$params->type['options'] = $this->lang->block->typeList->testtask;
$params->type['control'] = 'select';
$params->num['name'] = $this->lang->block->num;
$params->num['default'] = 20;
$params->num['control'] = 'input';
return json_encode($params);
}
}
+6 -4
View File
@@ -15,11 +15,12 @@
<tr>
<th class='c-id'><?php echo $lang->idAB;?></th>
<th class='w-100px'><?php echo $lang->issue->type;?></th>
<th class='c-name'> <?php echo $lang->issue->name;?></th>
<th class='c-name'> <?php echo $lang->issue->title;?></th>
<?php if($longBlock):?>
<th class='c-severity'><?php echo $lang->issue->severity;?></th>
<th class='c-pri'><?php echo $lang->issue->pri;?></th>
<th class='w-80px'><?php echo $lang->issue->severity;?></th>
<th class='w-80px'><?php echo $lang->issue->pri;?></th>
<?php endif;?>
<th class='w-120px'><?php echo $lang->issue->owner;?></th>
<th class='w-120px'><?php echo $lang->issue->assignedTo;?></th>
<th class='w-80px'><?php echo $lang->issue->status;?></th>
</tr>
@@ -32,11 +33,12 @@
<tr>
<td class='c-id-xs'><?php echo sprintf('%03d', $issue->id);?></td>
<td class='c-type'><?php echo zget($lang->issue->typeList, $issue->type);?></td>
<td class='c-name' title='<?php echo $issue->name?>'><?php echo $issue->name?></td>
<td class='c-name' title='<?php echo $issue->title?>'><?php echo html::a($viewLink, $issue->title);?></td>
<?php if($longBlock):?>
<td class='c-severity'><?php echo zget($lang->issue->severityList, $issue->severity, $issue->severity)?></td>
<td class='c-pri'><span class='label-pri label-pri-<?php echo $issue->pri;?>' title='<?php echo zget($lang->issue->priList, $issue->pri, $issue->pri)?>'><?php echo zget($lang->issue->priList, $issue->pri, $issue->pri)?></span></td>
<?php endif;?>
<td><?php echo zget($users, $issue->owner, $issue->owner)?></td>
<td><?php echo zget($users, $issue->assignedTo, $issue->assignedTo)?></td>
<td class='c-status'>
<span class="status-issue status-<?php echo $issue->status?>"><?php echo zget($lang->issue->statusList, $issue->status);?></span>
+12 -14
View File
@@ -17,16 +17,15 @@
<table class='table table-borderless table-hover table-fixed-head tablesorter block-testtask table-fixed'>
<thead>
<tr class='text-center'>
<?php if($longBlock):?>
<th class='w-id'><?php echo $lang->idAB?></th>
<th class='text-left'><?php echo $lang->testtask->product;?></th>
<?php endif;?>
<th class='text-left'><?php echo $lang->testtask->name;?></th>
<?php if($longBlock):?>
<th class='text-left'><?php echo $lang->testtask->project . '/' . $lang->testtask->build;?></th>
<th class='text-left'><?php echo $lang->testtask->product;?></th>
<?php endif;?>
<th class='w-date'><?php echo $lang->testtask->begin;?></th>
<th class='w-date'><?php echo $lang->testtask->end;?></th>
<?php if($longBlock):?>
<th class='text-left'><?php echo $lang->testtask->project?></th>
<?php endif;?>
<th class='text-left'><?php echo $lang->testtask->build;?></th>
<th class='w-date'><?php echo $lang->testtask->status;?></th>
</tr>
</thead>
<tbody>
@@ -36,16 +35,15 @@
$viewLink = $this->createLink('testtask', 'view', "testtaskID={$testtask->id}");
?>
<tr class='text-center' data-url='<?php echo empty($sso) ? $viewLink : $sso . $sign . 'referer=' . base64_encode($viewLink); ?>' <?php echo $appid?>>
<?php if($longBlock):?>
<td><?php echo sprintf('%03d', $testtask->id);?></td>
<td class='text-left' title='<?php echo $testtask->productName?>'><?php echo $testtask->productName?></td>
<?php endif;?>
<td class='text-left' title='<?php echo $testtask->name?>'><?php echo $testtask->name?></td>
<?php if($longBlock):?>
<td class='text-left' title='<?php echo $testtask->projectName . '/' . $testtask->buildName?>'><?php echo $testtask->projectName . '/' . $testtask->buildName?></td>
<td class='text-left' title='<?php echo $testtask->productName?>'><?php echo $testtask->productName?></td>
<?php endif;?>
<td><?php echo $testtask->begin?></td>
<td><?php echo $testtask->end?></td>
<?php if($longBlock):?>
<td class='text-left' title='<?php echo $testtask->projectName?>'><?php echo $testtask->projectName?></td>
<?php endif;?>
<td class='text-left' title='<?php echo $testtask->buildName?>'><?php echo $testtask->buildName?></td>
<td><?php echo zget($lang->testtask->statusList, $testtask->status)?></td>
</tr>
<?php endforeach;?>
</tbody>
+5 -5
View File
@@ -51,11 +51,11 @@ $lang->issue->priList['2'] = 2;
$lang->issue->priList['3'] = 3;
$lang->issue->priList['4'] = 4;
$lang->issue->serverityList[''] = '';
$lang->issue->serverityList['1'] = '严重';
$lang->issue->serverityList['2'] = '较严重';
$lang->issue->serverityList['3'] = '较小';
$lang->issue->serverityList['4'] = '建议';
$lang->issue->severityList[''] = '';
$lang->issue->severityList['1'] = '严重';
$lang->issue->severityList['2'] = '较严重';
$lang->issue->severityList['3'] = '较小';
$lang->issue->severityList['4'] = '建议';
$lang->issue->typeList[''] = '';
$lang->issue->typeList['design'] = '设计问题';
+1 -1
View File
@@ -38,7 +38,7 @@
<?php echo html::select("dataList[$i][type]", $lang->issue->typeList, '', 'class="form-control chosen chosen-controled" id="dataList'.$i.'type"')?>
</td>
<td>
<?php echo html::select("dataList[$i][severity]", $lang->issue->serverityList, '', 'class="form-control chosen chosen-controled" id="dataList'.$i.'severity"')?>
<?php echo html::select("dataList[$i][severity]", $lang->issue->severityList, '', 'class="form-control chosen chosen-controled" id="dataList'.$i.'severity"')?>
</td>
<td>
<?php echo html::textarea("dataList[$i][desc]", '', 'class="form-control" id="dataList'.$i.'desc" rows="1"');?>
+1 -1
View File
@@ -34,7 +34,7 @@
</tr>
<tr>
<th><?php echo $lang->issue->severity;?></th>
<td class="required"><?php echo html::select('severity', $lang->issue->serverityList, '', 'class="form-control chosen"');?></td>
<td class="required"><?php echo html::select('severity', $lang->issue->severityList, '', 'class="form-control chosen"');?></td>
<td></td>
<td></td>
</tr>
+1 -1
View File
@@ -34,7 +34,7 @@
</tr>
<tr>
<th><?php echo $lang->issue->severity;?></th>
<td class="required"><?php echo html::select('severity', $lang->issue->serverityList, $issue->severity, 'class="form-control chosen"');?></td>
<td class="required"><?php echo html::select('severity', $lang->issue->severityList, $issue->severity, 'class="form-control chosen"');?></td>
<td></td>
<td></td>
</tr>
+21 -7
View File
@@ -87,20 +87,19 @@ class program extends control
/**
* Create a program.
*
* @param varchar $template
* @param int $copyProgramID
* @param string $template
* @param int $programID
* @param int $copyProgramID
* @access public
* @return void
*/
public function create($template = 'cmmi', $copyProgramID = '')
public function create($template = 'cmmi', $programID = 0, $copyProgramID = '')
{
if($_POST)
{
$projectID = $this->program->create();
if(dao::isError())
{
$this->send(array('result' => 'fail', 'message' => $this->processErrors(dao::getError())));
}
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => $this->processErrors(dao::getError())));
$this->loadModel('action')->create('project', $projectID, 'opened');
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse', array('status' => 'wait', 'orderBy' => 'order_desc'))));
}
@@ -111,6 +110,19 @@ class program extends control
$whitelist = '';
$acl = 'open';
$privway = 'extend';
if($programID)
{
$program = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($programID)->fetch();
if($this->program->checkHasContent($programID))
{
echo js::alert($this->lang->program->cannotCreateChild);
die(js::locate('back'));
}
if(empty($template)) $template = $program->template;
}
if($copyProgramID)
{
$copyProgram = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($copyProgramID)->fetch();
@@ -120,6 +132,7 @@ class program extends control
$acl = $copyProgram->acl;
$privway = $copyProgram->privway;
$whitelist = $copyProgram->whitelist;
if(empty($template)) $template = $copyProgram->template;
}
$this->view->title = $this->lang->program->create;
@@ -134,6 +147,7 @@ class program extends control
$this->view->acl = $acl;
$this->view->privway = $privway;
$this->view->whitelist = $whitelist;
$this->view->programID = $programID;
$this->view->copyProgramID = $copyProgramID;
$this->display();
}
+2
View File
@@ -25,3 +25,5 @@
#cards .project-detail .progress-text-left .progress-text {width: 50px; left: -50px;}
#cards .pager {margin: 0; float: right;}
#cards .pager .btn{border: none}
.w-215px{width:215px;}
+2 -2
View File
@@ -3,7 +3,7 @@ $(function()
$('#copyProjects a').click(function(){setCopyProject($(this).data('id')); $('#copyProjectModal').modal('hide')});
});
function setCopyProject(programID)
function setCopyProject(copiedProgramID)
{
location.href = createLink('program', 'create', 'template=' + template + '&copyProgramID=' + programID);
location.href = createLink('program', 'create', 'template=' + template + '&programID=' + programID + '&copyProgramID=' + copiedProgramID);
}
+1
View File
@@ -85,3 +85,4 @@ $lang->program->scrumDesc = '<strong>简介:</strong>小步迭代,
$lang->program->cmmi = '瀑布';
$lang->program->cmmiTitle = '瀑布式项目管理';
$lang->program->cmmiDesc = '<strong>简介:</strong>按阶段规范化管理<br><strong>包含功能点:</strong>估算、计划、阶段、报告';
$lang->program->cannotCreateChild = '该项目已经有实际的内容,无法直接添加子项目。您可以为当前项目创建一个父项目,然后在新的父项目下面添加子项目。';
+52
View File
@@ -5,6 +5,7 @@ class programModel extends model
{
return $this->dao->select('*')->from(TABLE_PROJECT)
->where('iscat')->eq(0)
->andWhere('template')->ne('')
->andWhere('program')->eq(0)
->andWhere('deleted')->eq(0)
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->programs)->fi()
@@ -93,6 +94,12 @@ class programModel extends model
$this->dao->update(TABLE_PROJECT)->set('`order`')->eq($programID * 5)->where('id')->eq($programID)->exec();
$this->file->updateObjectID($this->post->uid, $programID, 'project');
if($project->parent > 0)
{
$this->dao->update(TABLE_PROJECT)->set('isCat')->eq(1)->where('id')->eq($project->parent)->exec();
$this->fixPath($programID);
}
/* Add program admin.*/
$groupPriv = $this->dao->select('t1.*')->from(TABLE_USERGROUP)->alias('t1')
->leftJoin(TABLE_GROUP)->alias('t2')->on('t1.group = t2.id')
@@ -189,4 +196,49 @@ class programModel extends model
{
return $this->dao->select('*')->from(TABLE_PRODUCT)->where('project')->eq($program)->fetchAll('id');
}
public function checkHasContent($programID)
{
$count = 0;
$count += $this->dao->select('count(*) as count')->from(TABLE_BUDGET)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_BUG)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_CASE)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_DESIGN)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_DOC)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_DURATIONESTIMATION)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_ISSUE)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_PROJECT)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_RELATION)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_RELEASE)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_REPO)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_RISK)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_STORY)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_TESTREPORT)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_TESTSUITE)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_TESTTASK)->where('program')->eq($programID)->fetch('count');
$count += $this->dao->select('count(*) as count')->from(TABLE_WORKESTIMATION)->where('program')->eq($programID)->fetch('count');
return $count > 0;
}
public function fixPath($programID)
{
$path = array();
$program = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($programID)->fetch();
if($program->parent == 0)
{
$path['path'] = ",{$program->id},";
$path['grade'] = 1;
$this->dao->update(TABLE_PROJECT)->set('path')->eq($path['path'])->set('grade')->eq($path['grade'])->where('id')->eq($program->id)->exec();
}
else
{
$path = $this->fixPath($program->parent);
$path['path'] .= "{$program->id},";
$path['grade'] += 1;
$this->dao->update(TABLE_PROJECT)->set('path')->eq($path['path'])->set('grade')->eq($path['grade'])->where('id')->eq($program->id)->exec();
}
return $path;
}
}
+2 -1
View File
@@ -14,7 +14,7 @@
<th class='w-100px'><?php common::printOrderLink('end', $orderBy, $vars, $lang->program->end);?></th>
<th class='w-100px'><?php common::printOrderLink('budget', $orderBy, $vars, $lang->program->budget);?></th>
<th class='w-100px'><?php common::printOrderLink('PM', $orderBy, $vars, $lang->program->PM);?></th>
<th class='text-center w-200px'><?php echo $lang->actions;?></th>
<th class='text-center w-215px'><?php echo $lang->actions;?></th>
<?php if($canOrder):?>
<th class='w-60px sort-default'><?php common::printOrderLink('order', $orderBy, $vars, $lang->project->orderAB);?></th>
<?php endif;?>
@@ -43,6 +43,7 @@
<?php common::printIcon('program', 'suspend', "projectID=$project->id", $project, 'list', '', '', 'iframe', true);?>
<?php common::printIcon('program', 'close', "projectID=$project->id", $project, 'list', '', '', 'iframe', true);?>
<?php if(common::hasPriv('program', 'edit')) echo html::a($this->createLink("program", "edit", "projectID=$project->id"), "<i class='icon-edit'></i>", '', "class='btn' title='{$lang->edit}'");?>
<?php common::printIcon('program', 'create', "template=&projectID=$project->id", '', 'list', 'treemap-alt', '', '', '', '', $this->lang->program->children);?>
</td>
<?php if($canOrder):?>
<td class='sort-handler'><i class="icon icon-move"></i></td>
+6 -1
View File
@@ -101,7 +101,7 @@
<tr class='hide'>
<th><?php echo $lang->project->status;?></th>
<td><?php echo html::hidden('status', 'wait');?></td>
<td><?php echo html::hidden('template', $template);?></td>
<td></td>
<td></td>
<td></td>
</tr>
@@ -129,6 +129,10 @@
<td colspan='4' class='text-center form-actions'>
<?php echo html::submitButton();?>
<?php echo html::backButton();?>
<?php
echo html::hidden('template', $template);
echo html::hidden('parent', $programID);
?>
</td>
</tr>
</table>
@@ -165,4 +169,5 @@
</div>
</div>
<?php js::set('template', $template);?>
<?php js::set('programID', $programID);?>
<?php include '../../common/view/footer.html.php';?>
+1 -1
View File
@@ -60,4 +60,4 @@ $config->risk->search['params']['activateBy'] = array('operator' => '=',
$config->risk->search['params']['assignedTo'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->risk->search['params']['cancelBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->risk->search['params']['hangupBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->risk->search['params']['trackedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->risk->search['params']['trackedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
+198 -59
View File
@@ -1,12 +1,23 @@
<?php
class risk extends control
{
/**
* Browse risk
*
* @param string $browseType
* @param string $param
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function browse($browseType = 'all', $param = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
/* Build the search form. */
$actionURL = $this->createLink('risk', 'browse', "browseType=bySearch&queryID=myQueryID");
$this->config->risk->search['onMenuBar'] = 'yes';
$actionURL = $this->createLink('risk', 'browse', "browseType=bysearch&queryID=myQueryID");
$this->risk->buildSearchForm($queryID, $actionURL);
/* Load pager. */
@@ -14,18 +25,24 @@ class risk extends control
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
$pager = pager::init($recTotal, $recPerPage, $pageID);
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->browse;
$this->view->position[] = $this->lang->risk->browse;
$this->view->risks = $this->risk->getList($browseType, $param, $orderBy, $pager);
$this->view->browseType = $browseType;
$this->view->param = $param;
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->browse;
$this->view->position[] = $this->lang->risk->browse;
$this->view->risks = $this->risk->getList($browseType, $param, $orderBy, $pager);
$this->view->browseType = $browseType;
$this->view->param = $param;
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
}
/**
* Create risk
*
* @access public
* @return void
*/
public function create()
{
if($_POST)
@@ -46,13 +63,20 @@ class risk extends control
$this->send($response);
}
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->create;
$this->view->position[] = $this->lang->risk->create;
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->create;
$this->view->position[] = $this->lang->risk->create;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->display();
}
/**
* Edit risk
*
* @param int $riskID
* @access public
* @return void
*/
public function edit($riskID)
{
if($_POST)
@@ -69,25 +93,38 @@ class risk extends control
}
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Edited');
$this->action->logHistory($actionID, $changes);
if(!empty($changes))
{
$actionID = $this->action->create('risk', $riskID, 'Edited');
$this->action->logHistory($actionID, $changes);
}
$response['locate'] = inlink('browse');
$response['locate'] = inlink('browse');
$this->send($response);
}
$this->view->risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->edit;
$this->view->position[] = $this->lang->risk->edit;
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->edit;
$this->view->position[] = $this->lang->risk->edit;
$this->view->risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->display();
}
/**
* View a risk
*
* @param int $riskID
* @access public
* @return void
*/
public function view($riskID)
{
$this->loadModel('action');
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->view;
$this->view->position[] = $this->lang->risk->view;
$this->view->risk = $this->risk->getById($riskID);
$this->view->actions = $this->action->getList('risk', $riskID);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
@@ -95,6 +132,46 @@ class risk extends control
$this->display();
}
/**
* Batch create
*
* @access public
* @return void
*/
public function batchCreate()
{
if($_POST)
{
$this->risk->batchCreate();
$response['result'] = 'success';
$response['message'] = $this->lang->saveSuccess;
if(dao::isError())
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
$this->send($response);
}
$response['locate'] = inlink('browse');
$this->send($response);
}
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->batchCreate;
$this->view->position[] = $this->lang->risk->batchCreate;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->display();
}
/**
* Delete a risk.
*
* @param int $riskID
* @param string $confirm
* @access public
* @return void
*/
public function delete($riskID, $confirm = 'no')
{
$risk = $this->risk->getById($riskID);
@@ -112,11 +189,19 @@ class risk extends control
}
}
/**
* Track a risk.
*
* @param int $riskID
* @access public
* @return void
*/
public function track($riskID)
{
if($_POST)
{
$changes = $this->risk->track($riskID);
$changes = array();
if($this->post->isChange == 1) $changes = $this->risk->track($riskID);
$response['result'] = 'success';
$response['message'] = $this->lang->saveSuccess;
@@ -128,20 +213,31 @@ class risk extends control
}
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Tracked' . $this->post->commnet);
$this->action->logHistory($actionID, $changes);
if(!empty($changes) or $_POST['comment'])
{
$actionID = $this->action->create('risk', $riskID, 'Tracked', $_POST['comment']);
$this->action->logHistory($actionID, $changes);
}
$response['locate'] = inlink('browse');
$this->send($response);
}
$this->view->risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->track;
$this->view->position[] = $this->lang->risk->track;
$this->view->risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->display();
}
/**
* Update assign of risk.
*
* @param int $riskID
* @access public
* @return void
*/
public function assignTo($riskID)
{
if($_POST)
@@ -150,22 +246,32 @@ class risk extends control
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Assigned', $this->post->comment, $this->post->assignedTo);
$this->action->logHistory($actionID, $changes);
if(!empty($changes))
{
$actionID = $this->action->create('risk', $riskID, 'Assigned', $this->post->comment, $this->post->assignedTo);
$this->action->logHistory($actionID, $changes);
}
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
$risk = $this->risk->getById($riskID);
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->assignedTo;
$this->view->position[] = $this->lang->risk->assignedTo;
$this->view->risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->assignedTo;
$this->view->risk = $risk;
$this->display();
}
/**
* Cancel a risk.
*
* @param int $riskID
* @access public
* @return void
*/
public function cancel($riskID)
{
if($_POST)
@@ -174,21 +280,31 @@ class risk extends control
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Canceled', $this->post->comment);
$this->action->logHistory($actionID, $changes);
if(!empty($changes))
{
$actionID = $this->action->create('risk', $riskID, 'Canceled', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
$risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->cancel;
$this->view->risk = $risk;
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->cancel;
$this->view->position[] = $this->lang->risk->cancel;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->view->risk = $this->risk->getById($riskID);
$this->display();
}
/**
* Close a risk.
*
* @param int $riskID
* @access public
* @return void
*/
public function close($riskID)
{
if($_POST)
@@ -196,22 +312,32 @@ class risk extends control
$changes = $this->risk->close($riskID);
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Closed', $this->post->comment);
$this->action->logHistory($actionID, $changes);
if(!empty($changes))
{
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Closed', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
$risk = $this->risk->getById($riskID);
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->close;
$this->view->position[] = $this->lang->risk->close;
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->close;
$this->view->risk = $risk;
$this->view->risk = $this->risk->getById($riskID);
$this->display();
}
/**
* Hangup a risk.
*
* @param int $riskID
* @access public
* @return void
*/
public function hangup($riskID)
{
if($_POST)
@@ -219,22 +345,32 @@ class risk extends control
$changes = $this->risk->hangup($riskID);
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Hangup', $this->post->comment);
$this->action->logHistory($actionID, $changes);
if(!empty($changes))
{
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Hangup', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
$risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->hangup;
$this->view->risk = $risk;
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->hangup;
$this->view->position[] = $this->lang->risk->hangup;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->view->risk = $this->risk->getById($riskID);
$this->display();
}
/**
* Activate a risk.
*
* @param int $riskID
* @access public
* @return void
*/
public function activate($riskID)
{
if($_POST)
@@ -242,19 +378,22 @@ class risk extends control
$changes = $this->risk->activate($riskID);
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Activated', $this->post->comment);
$this->action->logHistory($actionID, $changes);
if(!empty($changes))
{
$this->loadModel('action');
$actionID = $this->action->create('risk', $riskID, 'Activated', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
$risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->activate;
$this->view->risk = $risk;
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->activate;
$this->view->position[] = $this->lang->risk->activate;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->view->risk = $this->risk->getById($riskID);
$this->display();
}
}
-7
View File
@@ -1,7 +0,0 @@
<?php
$lang->risk->comment = '备注';
$lang->risk->isChanged = '风险是否有变化';
$lang->risk->changedList[''] = '';
$lang->risk->changedList['1'] = '是';
$lang->risk->changedList['2'] = '否';
@@ -1,14 +0,0 @@
<?php
include $this->app->getModuleRoot() . 'risk/ext/lang/zh-cn/cmmi.php';
$html = "<tr>";
$html .= "<th>{$lang->risk->comment}</th>";
$html .= "<td>";
$html .= html::textarea('comment', '', 'class="form-control" rows="5"');
$html .= "</td></tr>";
?>
<script>
$('#assignedTo').closest('tr').after(<?php echo json_encode($html);?>);
</script>
<?php include '../../../common/view/kindeditor.html.php';?>
@@ -1,14 +0,0 @@
<?php
include $this->app->getModuleRoot() . 'risk/ext/lang/zh-cn/cmmi.php';
$html = "<tr>";
$html .= "<th>{$lang->risk->comment}</th>";
$html .= "<td>";
$html .= html::textarea('comment', '', 'class="form-control" rows="5"');
$html .= "</td></tr>";
?>
<script>
$('#cancelReason').closest('tr').after(<?php echo json_encode($html);?>);
</script>
<?php include '../../common/view/kindeditor.html.php';?>
@@ -1,28 +0,0 @@
<script>
$(function()
{
$('#riskindex').attr('readonly', true);
$('#pri').attr('disabled', true);
computeIndex();
function computeIndex()
{
var impact = $('#impact').val();
var probability = $('#probability').val();
var riskindex = parseInt(impact * probability);
var pri = '';
if(0 < riskindex && riskindex <= 5) pri = 'low';
if(5 < riskindex && riskindex <= 12) pri = 'middle';
if(15 <= riskindex && riskindex <= 25) pri = 'high';
$('#riskindex').val(riskindex);
$('#pri').val(pri);
$('#pri').trigger("chosen:updated")
$('#pri').chosen();
$('#pri').attr('disabled', true);
$('input[name="pri"]').remove();
$('#pri').after("<input type='hidden' name='pri' value='" + pri + "'/>");
}
$('#impact, #chance').change(function(){computeIndex()});
})
</script>
@@ -1,28 +0,0 @@
<script>
$(function()
{
$('#riskindex').attr('readonly', true);
$('#pri').attr('disabled', true);
computeIndex();
function computeIndex()
{
var impact = $('#impact').val();
var probability = $('#probability').val();
var riskindex = parseInt(impact * probability);
var pri = '';
if(0 < riskindex && riskindex <= 5) pri = 'low';
if(5 < riskindex && riskindex <= 12) pri = 'middle';
if(15 <= riskindex && riskindex <= 25) pri = 'high';
$('#riskindex').val(riskindex);
$('#pri').val(pri);
$('#pri').trigger("chosen:updated")
$('#pri').chosen();
$('#pri').attr('disabled', true);
$('input[name="pri"]').remove();
$('#pri').after("<input type='hidden' name='pri' value='" + pri + "'/>");
}
$('#impact, #probability').change(function(){computeIndex()});
})
</script>
@@ -1,28 +0,0 @@
<script>
$(function()
{
$('#riskindex').attr('readonly', true);
$('#pri').attr('disabled', true);
computeIndex();
function computeIndex()
{
var impact = $('#impact').val();
var probability = $('#probability').val();
var riskindex = parseInt(impact * probability);
var pri = '';
if(0 < riskindex && riskindex <= 5) pri = 'low';
if(5 < riskindex && riskindex <= 12) pri = 'middle';
if(15 <= riskindex && riskindex <= 25) pri = 'high';
$('#riskindex').val(riskindex);
$('#pri').val(pri);
$('#pri').trigger("chosen:updated")
$('#pri').chosen();
$('#pri').attr('disabled', true);
$('input[name="pri"]').remove();
$('#pri').after("<input type='hidden' name='pri' value='" + pri + "'/>");
}
$('#impact, #chance').change(function(){computeIndex()});
})
</script>
-5
View File
@@ -1,8 +1,3 @@
$(function()
{
$('.track').addClass('hidden');
})
function refreshPage(obj)
{
var value = obj.value;
+6 -5
View File
@@ -4,6 +4,7 @@ $lang->risk->batchCreate = '批量添加';
$lang->risk->create = '添加风险';
$lang->risk->edit = '编辑风险';
$lang->risk->browse = '浏览列表';
$lang->risk->view = '风险详情';
$lang->risk->activate = '激活';
$lang->risk->hangup = '挂起';
$lang->risk->close = '关闭';
@@ -13,10 +14,6 @@ $lang->risk->assignTo = '指派';
$lang->risk->deleted = '删除';
$lang->risk->byQuery = '搜索';
$lang->risk->legendBasicInfo = '基本信息';
$lang->risk->legendLifeTime = '风险的一生';
$lang->risk->confirmDelete = '您确认删除该风险吗?';
/* Fields */
$lang->risk->common = '风险';
$lang->risk->source = '来源';
@@ -49,12 +46,16 @@ $lang->risk->hangupBy = '由谁挂起';
$lang->risk->hangupDate = '挂起日期';
$lang->risk->activateBy = '由谁激活';
$lang->risk->activateDate = '激活日期';
$lang->risk->isChange = '是否有变化';
$lang->risk->isChange = '风险是否变化';
$lang->risk->trackedBy = '由谁跟踪';
$lang->risk->trackedDate = '跟踪日期';
$lang->risk->editedBy = '由谁编辑';
$lang->risk->editedDate = '编辑日期';
$lang->risk->legendBasicInfo = '基本信息';
$lang->risk->legendLifeTime = '风险的一生';
$lang->risk->confirmDelete = '您确认删除该风险吗?';
$lang->risk->action = new stdclass();
$lang->risk->action->hangup = '$date, 由 <strong>$actor</strong> 挂起。' . "\n";
$lang->risk->action->tracked = '$date, 由 <strong>$actor</strong> 跟踪。' . "\n";
+118 -7
View File
@@ -1,6 +1,12 @@
<?php
class riskModel extends model
{
/**
* Create a bug.
*
* @access public
* @return int|bool
*/
public function create()
{
$risk = fixer::input('post')
@@ -18,6 +24,12 @@ class riskModel extends model
return false;
}
/**
* Batch create risk.
*
* @access public
* @return bool
*/
public function batchCreate()
{
$data = fixer::input('post')->get();
@@ -29,8 +41,10 @@ class riskModel extends model
$risk = new stdclass();
$risk->name = $name;
$risk->percent = $data->percent[$i];
$risk->type = $data->type[$i];
$risk->source = $data->source[$i];
$risk->category = $data->category[$i];
$risk->strategy = $data->strategy[$i];
$risk->program = $this->session->program;
$risk->createdBy = $this->app->user->account;
$risk->createdDate = helper::today();
@@ -43,6 +57,13 @@ class riskModel extends model
return true;
}
/**
* Update a risk.
*
* @param int $riskID
* @access public
* @return array|bool
*/
public function update($riskID)
{
$oldRisk = $this->dao->select('*')->from(TABLE_RISK)->where('id')->eq((int)$riskID)->fetch();
@@ -60,6 +81,13 @@ class riskModel extends model
return false;
}
/**
* Track a risk.
*
* @param int $riskID
* @access public
* @return array|bool
*/
public function track($riskID)
{
$oldRisk = $this->dao->select('*')->from(TABLE_RISK)->where('id')->eq((int)$riskID)->fetch();
@@ -68,8 +96,7 @@ class riskModel extends model
->add('editedBy', $this->app->user->account)
->add('editedDate', helper::today())
->stripTags($this->config->risk->editor->track['id'], $this->config->allowedTags)
->remove('ischange,comment,uid')
->removeIF($this->post->isChange == 0, 'name,category,strategy,impact,probability,riskindex,pri,prevention,resolution' )
->remove('isChange,comment,uid,files,label')
->get();
$this->dao->update(TABLE_RISK)->data($risk)->autoCheck()->where('id')->eq((int)$riskID)->exec();
@@ -78,6 +105,16 @@ class riskModel extends model
return false;
}
/**
* Get risks List.
*
* @param string $browseType
* @param string $param
* @param string $orderBy
* @param int $pager
* @access public
* @return object
*/
public function getList($browseType = '', $param = '', $orderBy = 'id_desc', $pager = null)
{
if($browseType == 'bySearch') return $this->getBySearch($param, $orderBy, $pager);
@@ -92,9 +129,18 @@ class riskModel extends model
->fetchAll('id');
}
/**
* Get risks by search
*
* @param string $queryID
* @param string $orderBy
* @param int $pager
* @access public
* @return object
*/
public function getBySearch($queryID = '', $orderBy = 'id_desc', $pager = null)
{
if($queryID)
if($queryID && $queryID != 'myQueryID')
{
$query = $this->loadModel('search')->getQuery($queryID);
if($query)
@@ -112,7 +158,7 @@ class riskModel extends model
if($this->session->riskQuery == false) $this->session->set('riskQuery', ' 1 = 1');
}
$riskQuery = $this->session->riskQuery;
$riskQuery = $this->session->riskQuery;
return $this->dao->select('*')->from(TABLE_RISK)
->where($riskQuery)
@@ -123,6 +169,12 @@ class riskModel extends model
->fetchAll('id');
}
/**
* Get risks of pairs
*
* @access public
* @return object
*/
public function getPairs()
{
return $this->dao->select('id, name')->from(TABLE_RISK)
@@ -131,11 +183,26 @@ class riskModel extends model
->fetchPairs();
}
/**
* Get risk by ID
*
* @param int $riskID
* @access public
* @return object
*/
public function getByID($riskID)
{
return $this->dao->select('*')->from(TABLE_RISK)->where('id')->eq((int)$riskID)->fetch();
}
/**
* Print assignedTo html
*
* @param int $risk
* @param int $users
* @access public
* @return string
*/
public function printAssignedHtml($risk, $users)
{
$btnTextClass = '';
@@ -156,6 +223,13 @@ class riskModel extends model
echo !common::hasPriv('risk', 'assignTo', $risk) ? "<span style='padding-left: 21px' class='{$btnTextClass}'>{$assignedToText}</span>" : $assignToHtml;
}
/**
* Assign a risk.
*
* @param int $riskID
* @access public
* @return array|bool
*/
public function assign($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -165,7 +239,7 @@ class riskModel extends model
->add('editedDate', helper::today())
->setDefault('assignedDate', helper::today())
->stripTags($this->config->risk->editor->assignto['id'], $this->config->allowedTags)
->remove('uid,comment')
->remove('uid,comment,files,label')
->get();
$this->dao->update(TABLE_RISK)->data($risk)->autoCheck()->where('id')->eq((int)$riskID)->exec();
@@ -174,6 +248,13 @@ class riskModel extends model
return false;
}
/**
* Cancel a risk.
*
* @param int $riskID
* @access public
* @return array|bool
*/
public function cancel($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -192,6 +273,13 @@ class riskModel extends model
return false;
}
/**
* Close a risk.
*
* @param int $riskID
* @access public
* @return array|bool
*/
public function close($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -210,6 +298,13 @@ class riskModel extends model
return false;
}
/**
* Hangup a risk.
*
* @param int $riskID
* @access public
* @return array|bool
*/
public function hangup($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -226,6 +321,13 @@ class riskModel extends model
return false;
}
/**
* Activate a risk.
*
* @param int $riskID
* @access public
* @return array|bool
*/
public function activate($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -242,6 +344,15 @@ class riskModel extends model
return false;
}
/**
* Adjust the action is clickable.
*
* @param int $risk
* @param int $action
* @static
* @access public
* @return bool
*/
public static function isClickable($risk, $action)
{
$action = strtolower($action);
+2 -1
View File
@@ -17,7 +17,8 @@
</tr>
<tr>
<th><?php echo $lang->comment;?></th>
<td colspan='2'><?php echo html::textarea('comment', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td> </tr>
<td colspan='2'><?php echo html::textarea('comment', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td>
</tr>
<tr>
<td class='text-center form-actions' colspan='3'><?php echo html::submitButton(); ?></td> </tr>
</tbody>
+36
View File
@@ -0,0 +1,36 @@
<?php include '../../common/view/header.html.php';?>
<div id="mainContent" class="main-content fade">
<div class="main-header">
<h2><?php echo $lang->risk->batchCreate;?></h2>
</div>
<form class="load-indicator main-form form-ajax" method='post' enctype='multipart/form-data' id='dataform'>
<table class="table table-form">
<thead>
<tr>
<th class='w-50px'><?php echo $lang->risk->id;?></th>
<th><?php echo $lang->risk->name;?></th>
<th class='w-200px'><?php echo $lang->risk->source;?></th>
<th class='w-200px'><?php echo $lang->risk->category;?></th>
<th class='w-200px'><?php echo $lang->risk->strategy;?></th>
</tr>
</thead>
<tbody>
<?php for($i = 1; $i <= 10; $i ++):?>
<tr>
<td><?php echo $i;?></td>
<td><?php echo html::input("name[$i]", '', "class='form-control'");?></td>
<td><?php echo html::select("source[$i]", $lang->risk->sourceList, '', "class='form-control chosen'");?></td>
<td><?php echo html::select("category[$i]", $lang->risk->categoryList, '', "class='form-control chosen'");?></td>
<td><?php echo html::select("strategy[$i]", $lang->risk->strategyList, '', "class='form-control chosen'");?></td>
</tr>
<?php endfor;?>
<tr>
<td colspan='4' class='form-actions text-center'>
<?php echo html::submitButton() . html::backButton();?>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<?php include '../../common/view/footer.html.php';?>
+4 -2
View File
@@ -26,9 +26,11 @@
</tr>
<tr>
<th><?php echo $lang->comment;?></th>
<td colspan='2'><?php echo html::textarea('comment', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td> </tr>
<td colspan='2'><?php echo html::textarea('comment', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td>
</tr>
<tr>
<td class='text-center form-actions' colspan='3'><?php echo html::submitButton(); ?></td> </tr>
<td class='text-center form-actions' colspan='3'><?php echo html::submitButton(); ?></td>
</tr>
</tbody>
</table>
</form>
+2 -1
View File
@@ -21,7 +21,8 @@
<td></td>
</tr> <tr>
<th><?php echo $lang->risk->resolution;?></th>
<td colspan='2'><?php echo html::textarea('resolution', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td> </tr>
<td colspan='2'><?php echo html::textarea('resolution', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td>
</tr>
<tr>
<td class='text-center form-actions' colspan='3'><?php echo html::submitButton(); ?></td> </tr>
</tbody>
+1
View File
@@ -12,6 +12,7 @@
<th><?php echo $lang->risk->source;?></th>
<td><?php echo html::select('source', $lang->risk->sourceList, '', "class='form-control chosen'");?></td>
<td></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->risk->name;?></th>
+74 -74
View File
@@ -8,81 +8,81 @@
<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->risk->name;?></th>
<td><?php echo html::input('name', $risk->name, "class='form-control'");?></td>
<td></td>
</tr>
<tr>
<tr>
<th><?php echo $lang->risk->source;?></th>
<td><?php echo html::select('source', $lang->risk->sourceList, $risk->source, "class='form-control chosen'");?></td>
</tr>
<th><?php echo $lang->risk->category;?></th>
<td><?php echo html::select('category', $lang->risk->categoryList, $risk->category, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->strategy;?></th>
<td><?php echo html::select('strategy', $lang->risk->strategyList, $risk->strategy, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->status;?></th>
<td><?php echo html::select('status', $lang->risk->statusList, $risk->status, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->impact;?></th>
<td><?php echo html::select('impact', $lang->risk->impactList, $risk->impact, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->probability;?></th>
<td><?php echo html::select('probability', $lang->risk->probabilityList, $risk->impact, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->riskindex;?></th>
<td><?php echo html::input('riskindex', $risk->riskindex, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->pri;?></th>
<td><?php echo html::select('pri', $lang->risk->priList, $risk->pri, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->identifiedDate;?></th>
<td><?php echo html::input('identifiedDate', $risk->identifiedDate == '0000-00-00' ? '' : $risk->identifiedDate, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->prevention;?></th>
<td colspan='2'><?php echo html::textarea('prevention', $risk->prevention, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->remedy;?></th>
<td colspan='2'><?php echo html::textarea('remedy', $risk->remedy, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->plannedClosedDate;?></th>
<td><?php echo html::input('plannedClosedDate', $risk->plannedClosedDate == '0000-00-00' ? '' : $risk->plannedClosedDate, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->actualClosedDate;?></th>
<td><?php echo html::input('actualClosedDate', $risk->actualClosedDate == '0000-00-00' ? '' : $risk->actualClosedDate, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->resolution;?></th>
<td colspan='2'><?php echo html::textarea('resolution', $risk->resolution, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->resolvedBy;?></th>
<td><?php echo html::select('resolvedBy', $users, empty($risk->resolvedBy) ? $this->app->user->account : $risk->resolvedBy, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->assignedTo;?></th>
<td><?php echo html::select('assignedTo', $users, empty($risk->assignedTo) ? $this->app->user->account : $risk->assignedTo, "class='form-control chosen'");?></td>
</tr>
<tr>
<td colspan='3' class='form-actions text-center'>
<?php echo html::submitButton() . html::backButton();?>
</td>
</tr>
<th><?php echo $lang->risk->name;?></th>
<td><?php echo html::input('name', $risk->name, "class='form-control'");?></td>
<td></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->risk->source;?></th>
<td><?php echo html::select('source', $lang->risk->sourceList, $risk->source, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->category;?></th>
<td><?php echo html::select('category', $lang->risk->categoryList, $risk->category, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->strategy;?></th>
<td><?php echo html::select('strategy', $lang->risk->strategyList, $risk->strategy, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->status;?></th>
<td><?php echo html::select('status', $lang->risk->statusList, $risk->status, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->impact;?></th>
<td><?php echo html::select('impact', $lang->risk->impactList, $risk->impact, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->probability;?></th>
<td><?php echo html::select('probability', $lang->risk->probabilityList, $risk->impact, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->riskindex;?></th>
<td><?php echo html::input('riskindex', $risk->riskindex, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->pri;?></th>
<td><?php echo html::select('pri', $lang->risk->priList, $risk->pri, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->identifiedDate;?></th>
<td><?php echo html::input('identifiedDate', $risk->identifiedDate == '0000-00-00' ? '' : $risk->identifiedDate, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->plannedClosedDate;?></th>
<td><?php echo html::input('plannedClosedDate', $risk->plannedClosedDate == '0000-00-00' ? '' : $risk->plannedClosedDate, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->actualClosedDate;?></th>
<td><?php echo html::input('actualClosedDate', $risk->actualClosedDate == '0000-00-00' ? '' : $risk->actualClosedDate, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->resolvedBy;?></th>
<td><?php echo html::select('resolvedBy', $users, empty($risk->resolvedBy) ? $this->app->user->account : $risk->resolvedBy, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->assignedTo;?></th>
<td><?php echo html::select('assignedTo', $users, empty($risk->assignedTo) ? $this->app->user->account : $risk->assignedTo, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->prevention;?></th>
<td colspan='2'><?php echo html::textarea('prevention', $risk->prevention, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->remedy;?></th>
<td colspan='2'><?php echo html::textarea('remedy', $risk->remedy, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->risk->resolution;?></th>
<td colspan='2'><?php echo html::textarea('resolution', $risk->resolution, "class='form-control'");?></td>
</tr>
<tr>
<td colspan='3' class='form-actions text-center'>
<?php echo html::submitButton() . html::backButton();?>
</td>
</tr>
</tbody>
</table>
</form>
-7
View File
@@ -1,7 +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 //
params browse.html.php /^ $params = "riskID=$risk->id";$/;" v
+18 -16
View File
@@ -12,50 +12,52 @@
<th><?php echo $lang->risk->isChange;?></th>
<td><?php echo html::radio('isChange', $lang->risk->isChangeList, 0, "onclick=refreshPage(this)");?></td>
<td></td>
<td></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->name;?></th>
<td><?php echo html::input('name', $risk->name, "class='form-control'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->category;?></th>
<td><?php echo html::select('category', $lang->risk->categoryList, $risk->category, "class='form-control chosen'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->strategy;?></th>
<td><?php echo html::select('strategy', $lang->risk->strategyList, $risk->strategy, "class='form-control chosen'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->impact;?></th>
<td><?php echo html::select('impact', $lang->risk->impactList, $risk->impact, "class='form-control chosen'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->probability;?></th>
<td><?php echo html::select('probability', $lang->risk->probabilityList, $risk->impact, "class='form-control chosen'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->riskindex;?></th>
<td><?php echo html::input('riskindex', $risk->riskindex, "class='form-control'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->pri;?></th>
<td><?php echo html::select('pri', $lang->risk->priList, $risk->pri, "class='form-control chosen'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->trackedBy;?></th>
<td><?php echo html::select('trackedBy', $users, $this->app->user->account, "class='form-control chosen'");?></td>
</tr>
<tr class='track hidden'>
<th><?php echo $lang->risk->trackedDate;?></th>
<td><?php echo html::input('trackedDate', $risk->trackedDate == '0000-00-00' ? helper::today() : $risk->trackedDate , "class='form-control form-date'");?></td>
</tr>
<tr class='track hidden'>
<th><?php echo $lang->risk->prevention;?></th>
<td colspan='2'><?php echo html::textarea('prevention', $risk->prevention, "class='form-control'");?></td>
</tr>
<tr class='track'>
<tr class='track hidden'>
<th><?php echo $lang->risk->resolution;?></th>
<td colspan='2'><?php echo html::textarea('resolution', $risk->resolution, "class='form-control'");?></td>
</tr>
<tr class='track'>
<th><?php echo $lang->risk->trackedBy;?></th>
<td><?php echo html::select('trackedBy', $users, $this->app->user->account, "class='form-control chosen'");?></td>
<tr class='track'>
<th><?php echo $lang->risk->trackedDate;?></th>
<td><?php echo html::input('trackedDate', $risk->trackedDate == '0000-00-00' ? $risk->trackedDate : helper::today(), "class='form-control form-date'");?></td>
</tr>
<tr class='not-track'>
<th><?php echo $lang->comment;?></th>
<td colspan='2'><?php echo html::textarea('comment', '', "class='form-control'");?></td>
+1
View File
@@ -81,6 +81,7 @@ class task extends control
}
$project = $this->project->getById($projectID);
$taskLink = $this->createLink('project', 'browse', "projectID=$projectID&tab=task");
$storyLink = $this->session->storyList ? $this->session->storyList : $this->createLink('project', 'story', "projectID=$projectID");
+13 -12
View File
@@ -112,12 +112,13 @@ class weeklyModel extends model
$sunday = $this->getThisSunday($date);
$projects = $this->loadModel('project')->getList($status = 'all', $limit = 0, $productID = 0, $branch = 0, $type = 'project', $program);
$projectIdList = array_keys($projects);
return $this->dao->select('count(distinct account) as count')
->from(TABLE_EFFORT)
->where('objectType')->eq('task')
->andWhere('project')->in($projectIdList)
->andWhere('date')->ge($monday)
->andWhere('date')->le($sunday)
return $this->dao->select('count(distinct t1.account) as count')
->from(TABLE_TASKESTIMATE)->alias('t1')
->leftJoin(TABLE_TASK)->alias('t2')->on('t1.task=t2.id')
->where('t2.project')->in($projectIdList)
->andWhere('t1.date')->ge($monday)
->andWhere('t1.date')->lt($sunday)
->fetch('count');
}
@@ -312,12 +313,12 @@ class weeklyModel extends model
$projects = $this->loadModel('project')->getList($status = 'all', $limit = 0, $productID = 0, $branch = 0, $type = 'project', $program);
$projectIdList = array_keys($projects);
$AC = $this->dao->select('sum(consumed) as consumed')
->from(TABLE_EFFORT)
->where('objectType')->eq('task')
->andWhere('project')->in($projectIdList)
->andWhere('date')->ge($monday)
->andWhere('date')->lt($nextMonday)
$AC = $this->dao->select('sum(t1.consumed) as consumed')
->from(TABLE_TASKESTIMATE)->alias('t1')
->leftJoin(TABLE_TASK)->alias('t2')->on('t1.task=t2.id')
->where('t2.project')->in($projectIdList)
->andWhere('t1.date')->ge($monday)
->andWhere('t1.date')->lt($nextMonday)
->fetch('consumed');
return round($AC, 2);