* Refactor the audit view of my.
This commit is contained in:
@@ -439,6 +439,8 @@ function formatTime(string|null $time, string $format = ''): string
|
||||
*/
|
||||
function initTableData($items, &$fieldList, $checkModel)
|
||||
{
|
||||
if(!isset($fieldList['actions'])) return array();
|
||||
|
||||
foreach($fieldList['actions']['menu'] as $actionMenu)
|
||||
{
|
||||
if(is_array($actionMenu))
|
||||
@@ -484,7 +486,7 @@ function initTableData($items, &$fieldList, $checkModel)
|
||||
$action = $actions[0];
|
||||
foreach($actions as $actionName)
|
||||
{
|
||||
if($checkModel->isClickable($item, $actionName))
|
||||
if(!method_exists($checkModel, 'isClickable') || $checkModel->isClickable($item, $actionName))
|
||||
{
|
||||
$action = $actionName;
|
||||
$break = true;
|
||||
@@ -492,7 +494,7 @@ function initTableData($items, &$fieldList, $checkModel)
|
||||
}
|
||||
|
||||
if(!common::hasPriv($app->rawModule, $action)) continue;
|
||||
if($checkModel->isClickable($item, $action))
|
||||
if(!method_exists($checkModel, 'isClickable') || $checkModel->isClickable($item, $action))
|
||||
{
|
||||
$item->actions[] = array('name' => $action);
|
||||
}
|
||||
@@ -510,11 +512,11 @@ function initTableData($items, &$fieldList, $checkModel)
|
||||
$action = $actions[0];
|
||||
foreach($actions as $actionName)
|
||||
{
|
||||
if($checkModel->isClickable($item, $actionName)) $action = $actionName;
|
||||
if(!method_exists($checkModel, 'isClickable') || $checkModel->isClickable($item, $actionName)) $action = $actionName;
|
||||
}
|
||||
|
||||
if(!common::hasPriv('task', $action)) continue;
|
||||
if($checkModel->isClickable($item, $action))
|
||||
if(!method_exists($checkModel, 'isClickable') || $checkModel->isClickable($item, $action))
|
||||
{
|
||||
$item->actions[] = array('name' => $action);
|
||||
}
|
||||
|
||||
@@ -58,3 +58,10 @@ $config->my->todo->actionList['delete']['icon'] = 'trash';
|
||||
$config->my->todo->actionList['delete']['text'] = $lang->todo->delete;
|
||||
$config->my->todo->actionList['delete']['hint'] = $lang->todo->delete;
|
||||
$config->my->todo->actionList['delete']['url'] = helper::createLink('todo', 'delete', 'todoID={id}&confirm=yes');
|
||||
|
||||
$config->my->audit = new stdclass();
|
||||
$config->my->audit->actionList = array();
|
||||
$config->my->audit->actionList['review']['icon'] = 'glasses';
|
||||
$config->my->audit->actionList['review']['text'] = $lang->review->common;
|
||||
$config->my->audit->actionList['review']['hint'] = $lang->review->common;
|
||||
$config->my->audit->actionList['review']['data-toggle'] = 'modal';
|
||||
|
||||
@@ -109,3 +109,39 @@ $config->my->requirement->dtable->fieldList['actions']['name'] = 'actions';
|
||||
$config->my->requirement->dtable->fieldList['actions']['title'] = $lang->actions;
|
||||
$config->my->requirement->dtable->fieldList['actions']['type'] = 'actions';
|
||||
$config->my->requirement->dtable->fieldList['actions']['sortType'] = false;
|
||||
|
||||
$config->my->audit->dtable = new stdclass();
|
||||
$config->my->audit->dtable->fieldList['id']['name'] = 'id';
|
||||
$config->my->audit->dtable->fieldList['id']['title'] = $lang->idAB;
|
||||
$config->my->audit->dtable->fieldList['id']['fixed'] = 'left';
|
||||
|
||||
$config->my->audit->dtable->fieldList['title']['name'] = 'title';
|
||||
$config->my->audit->dtable->fieldList['title']['title'] = $lang->my->auditField->title;
|
||||
$config->my->audit->dtable->fieldList['title']['type'] = 'title';
|
||||
$config->my->audit->dtable->fieldList['title']['link'] = helper::createLink('story', 'view', "id={id}");
|
||||
$config->my->audit->dtable->fieldList['title']['fixed'] = 'left';
|
||||
$config->my->audit->dtable->fieldList['title']['data-toggle'] = 'modal';
|
||||
|
||||
$config->my->audit->dtable->fieldList['type']['name'] = 'type';
|
||||
$config->my->audit->dtable->fieldList['type']['title'] = $lang->my->auditField->type;
|
||||
$config->my->audit->dtable->fieldList['type']['type'] = 'catetory';
|
||||
|
||||
$config->my->audit->dtable->fieldList['time']['name'] = 'time';
|
||||
$config->my->audit->dtable->fieldList['time']['title'] = $lang->my->auditField->time;
|
||||
$config->my->audit->dtable->fieldList['time']['type'] = 'datetime';
|
||||
|
||||
$config->my->audit->dtable->fieldList['result']['name'] = 'result';
|
||||
$config->my->audit->dtable->fieldList['result']['title'] = $lang->my->auditField->result;
|
||||
$config->my->audit->dtable->fieldList['result']['type'] = 'text';
|
||||
|
||||
$config->my->audit->dtable->fieldList['status']['name'] = 'status';
|
||||
$config->my->audit->dtable->fieldList['status']['title'] = $lang->my->auditField->status;
|
||||
$config->my->audit->dtable->fieldList['status']['type'] = 'status';
|
||||
|
||||
$config->my->audit->dtable->fieldList['actions']['name'] = 'actions';
|
||||
$config->my->audit->dtable->fieldList['actions']['title'] = $lang->actions;
|
||||
$config->my->audit->dtable->fieldList['actions']['type'] = 'actions';
|
||||
$config->my->audit->dtable->fieldList['actions']['sortType'] = false;
|
||||
$config->my->audit->dtable->fieldList['actions']['fixed'] = 'right';
|
||||
$config->my->audit->dtable->fieldList['actions']['list'] = $config->my->audit->actionList;
|
||||
$config->my->audit->dtable->fieldList['actions']['menu'] = array('review');
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The audit view file of my module of ZenTaoPMS.
|
||||
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Tingting Dai <daitingting@easycorp.ltd>
|
||||
* @package my
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
namespace zin;
|
||||
|
||||
$rawMethod = $this->app->rawMethod;
|
||||
if($rawMethod != 'audit') $lang->my->featureBar[$rawMethod] = $lang->my->featureBar[$rawMethod]['audit'];
|
||||
|
||||
$linkParam = "browseType={key}¶m=&orderBy=time_desc";
|
||||
if($rawMethod == 'contribute') $linkParam = "mode=$mode&$linkParam";
|
||||
|
||||
featurebar
|
||||
(
|
||||
set::current($browseType),
|
||||
set::linkParams($linkParam),
|
||||
);
|
||||
|
||||
if($rawMethod != 'audit') unset($config->my->audit->dtable->fieldList['actions']);
|
||||
if($rawMethod == 'contribute') $config->my->audit->dtable->fieldList['title']['sortType'] = false;
|
||||
if($rawMethod != 'contribute' || $browseType != 'reviewedbyme') unset($config->my->audit->dtable->fieldList['result']);
|
||||
|
||||
foreach($reviewList as $review)
|
||||
{
|
||||
$type = $review->type == 'prejectreview' ? 'review' : $review->type;
|
||||
$isOAObject = strpos(",{$config->my->oaObjectType},", ",$type,") !== false ? true : false;
|
||||
|
||||
if(isset($lang->{$review->type}->common)) $typeName = $lang->{$review->type}->common;
|
||||
if($type == 'story') $typeName = $review->storyType == 'story' ? $lang->SRCommon : $lang->URCommon;
|
||||
if($review->type == 'projectreview') $typeName = $lang->project->common;
|
||||
if(isset($flows[$review->type])) $typeName = $flows[$review->type];
|
||||
|
||||
$statusList = array();
|
||||
if(isset($lang->$type->statusList)) $statusList = $lang->$type->statusList;
|
||||
if($type == 'attend') $statusList = $lang->attend->reviewStatusList;
|
||||
|
||||
if(!in_array($type, array('story', 'testcase', 'feedback', 'review')) && !$isOAObject)
|
||||
{
|
||||
if($rawMethod == 'audit') $statusList = $lang->approval->nodeList;
|
||||
|
||||
if(isset($flows[$review->type]) && $rawMethod != 'audit') $statusList = $lang->approval->statusList;
|
||||
}
|
||||
|
||||
$review->type = $typeName;
|
||||
$review->status = zget($statusList, $review->status, '');
|
||||
|
||||
if($rawMethod == 'contribute' && $browseType == 'reviewedbyme')
|
||||
{
|
||||
$reviewResultList = array();
|
||||
if(isset($lang->$type)) $reviewResultList = zget($lang->$type, 'reviewResultList', array());
|
||||
if($isOAObject) $reviewResultList = zget($lang->$type, 'reviewStatusList', array());
|
||||
|
||||
$review->result = zget($reviewResultList, $review->result);
|
||||
}
|
||||
|
||||
$module = $type;
|
||||
$method = 'review';
|
||||
$params = "id=$review->id";
|
||||
|
||||
if($isOAObject) $method = 'view';
|
||||
if(!in_array($module, array('story', 'testcase', 'feedback'))) $method = 'approvalreview';
|
||||
|
||||
if($module == 'review')
|
||||
{
|
||||
$method = 'assess';
|
||||
$params .= "&from={$rawMethod}";
|
||||
|
||||
unset($config->my->audit->actionList['review']['data-toggle']);
|
||||
}
|
||||
|
||||
$config->my->audit->actionList['review']['url'] = createLink($module, 'view', "id={$review->id}");
|
||||
}
|
||||
|
||||
$reviewList = initTableData($reviewList, $config->my->audit->dtable->fieldList, $this->my);
|
||||
|
||||
$cols = array_values($config->my->audit->dtable->fieldList);
|
||||
$data = array_values($reviewList);
|
||||
|
||||
dtable
|
||||
(
|
||||
set::cols($cols),
|
||||
set::data($data),
|
||||
set::footPager
|
||||
(
|
||||
usePager(),
|
||||
set::page($pager->pageID),
|
||||
set::recPerPage($pager->recPerPage),
|
||||
set::recTotal($pager->recTotal),
|
||||
set::linkCreator(helper::createLink('my', 'audit', "browseType={$browseType}¶m=&orderBy=$orderBy&recTotal={$pager->recTotal}&recPerPage={recPerPage}&page={page}"))
|
||||
),
|
||||
);
|
||||
|
||||
render();
|
||||
Reference in New Issue
Block a user