diff --git a/module/execution/control.php b/module/execution/control.php index 214c5e90eb..9dc095615b 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -122,7 +122,7 @@ class execution extends control public function task(int $executionID = 0, string $status = 'unclosed', int $param = 0, string $orderBy = '', int $recTotal = 0, int $recPerPage = 100, int $pageID = 1, string $from = 'execution', int $blockID = 0) { $this->app->loadLang('doc'); - if($from == 'doc' && empty($this->executions)) return $this->send(array('result' => 'fail', 'message' => $this->lang->doc->tips->noExecution)); + if(($from == 'doc' || $from == 'ai') && empty($this->executions)) return $this->send(array('result' => 'fail', 'message' => $this->lang->doc->tips->noExecution)); if(!isset($_SESSION['limitedExecutions'])) $this->execution->getLimitedExecution(); diff --git a/module/execution/ui/task.html.php b/module/execution/ui/task.html.php index 4b52932d89..6cfbe5f5e4 100644 --- a/module/execution/ui/task.html.php +++ b/module/execution/ui/task.html.php @@ -16,9 +16,10 @@ namespace zin; if(empty($features['story'])) unset($lang->execution->featureBar['task']['needconfirm']); $queryMenuLink = createLink('execution', 'task', "executionID={$execution->id}&status=bySearch¶m={queryID}"); $isFromDoc = $from === 'doc'; +$isFromAI = $from === 'ai'; jsVar('canAssignTo', common::canModify('execution', $execution) && hasPriv('task', 'assignTo')); -if($isFromDoc) +if($isFromDoc || $isFromAI) { $this->app->loadLang('doc'); $executions = $this->loadModel('execution')->getPairs(); @@ -70,19 +71,19 @@ featureBar ( set::current($browseType), set::linkParams("executionID={$executionID}&status={key}¶m={$param}&orderBy={$orderBy}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}&from=$from&blockID=$blockID"), - set::isModal($isFromDoc), + set::isModal($isFromDoc || $isFromAI), set::queryMenuLinkCallback(array(fn($key) => str_replace('{queryID}', (string)$key, $queryMenuLink))), li(searchToggle ( - set::simple($isFromDoc), + set::simple($isFromDoc || $isFromAI), set::module('task'), set::open($browseType == 'bysearch'), - $isFromDoc ? set::target('#docSearchForm') : null, - $isFromDoc ? set::onSearch(jsRaw('function(){$(this.element).closest(".modal").find("#featureBar .nav-item>.active").removeClass("active").find(".label").hide()}')) : null + ($isFromDoc || $isFromAI) ? set::target('#docSearchForm') : null, + ($isFromDoc || $isFromAI) ? set::onSearch(jsRaw('function(){$(this.element).closest(".modal").find("#featureBar .nav-item>.active").removeClass("active").find(".label").hide()}')) : null )) ); -if($isFromDoc) +if($isFromDoc || $isFromAI) { div(setID('docSearchForm')); } @@ -118,7 +119,7 @@ if(common::canModify('execution', $execution)) $cols = $this->loadModel('datatable')->getSetting('execution'); -if($isFromDoc) +if($isFromDoc || $isFromAI) { if(isset($cols['actions'])) unset($cols['actions']); foreach($cols as $key => $col) @@ -172,7 +173,7 @@ if($config->edition == 'ipd') $viewType = $this->cookie->taskViewType ? $this->cookie->taskViewType : 'tree'; toolbar ( - setClass(array('hidden' => $isFromDoc)), + setClass(array('hidden' => $isFromDoc || $isFromAI)), item(set(array ( 'type' => 'btnGroup', @@ -232,7 +233,7 @@ toolbar /* zin: Define the sidebar in main content. */ $activeKey = $browseType == 'byproduct' ? $productID : $moduleID; -if(!$isFromDoc) +if(!$isFromDoc && !$isFromAI) { sidebar ( @@ -303,6 +304,7 @@ if($canBatchAction) if($canBatchAssignTo) $footToolbar['items'][] = array('caret' => 'up', 'text' => $lang->task->assignedTo, 'className' => 'btn btn-caret size-sm', 'btnType' => 'secondary', 'items' => $assignedToItems,'type' => 'dropdown'); } if($isFromDoc) $footToolbar = array(array('text' => $lang->doc->insertText, 'data-on' => 'click', 'data-call' => "insertListToDoc('#tasks', 'task', $blockID, '$insertListLink')")); +if($isFromAI) $footToolbar = array(array('text' => $lang->doc->insertText, 'data-on' => 'click', 'data-call' => "insertListToAI('#tasks', 'task', $blockID, '$insertListLink')")); jsVar('+pageSummary', $lang->execution->pageSummary); jsVar('checkedSummary', $lang->execution->checkedSummary); @@ -322,26 +324,26 @@ dtable set::userMap($users), set::cols($cols), set::data($tableData), - set::checkable($canBatchAction || $isFromDoc), + set::checkable($canBatchAction || $isFromDoc || $isFromAI), set::orderBy($orderBy), set::onRenderCell(jsRaw('window.renderCell')), set::modules($modulePairs), set::footToolbar($footToolbar), - set::isFromDoc($isFromDoc), + set::isFromDoc($isFromDoc || $isFromAI), set::footPager(usePager(array ( 'recPerPage' => $pager->recPerPage, 'recTotal' => $pager->recTotal, 'linkCreator' => helper::createLink('execution', 'task', "executionID={$execution->id}&status={$status}¶m={$param}&orderBy=$orderBy&recTotal={$pager->recTotal}&recPerPage={recPerPage}&page={page}&from={$from}&blockID={$blockID}") . "#app={$app->tab}" ))), - !$isFromDoc ? null : set::afterRender(jsCallback()->call('toggleCheckRows', $idList)), - !$isFromDoc ? null : set::onCheckChange(jsRaw('window.checkedChange')), - !$isFromDoc ? null : set::noNestedCheck(true), - !$isFromDoc ? null : set::height(400), - $isFromDoc ? null : set::customCols(true), - $isFromDoc ? null : set::sortLink(createLink('execution', 'task', "executionID={$execution->id}&status={$status}¶m={$param}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}")), - $isFromDoc ? null : set::checkInfo(jsRaw('function(checkedIDList){return window.setStatistics(this, checkedIDList);}')), - $isFromDoc ? null : set::createTip($lang->task->create), - $isFromDoc ? null : set::createLink($canCreate && common::canModify('execution', $execution) ? $createLink : ''), + (!$isFromDoc && !$isFromAI) ? null : set::afterRender(jsCallback()->call('toggleCheckRows', $idList)), + (!$isFromDoc && !$isFromAI) ? null : set::onCheckChange(jsRaw('window.checkedChange')), + (!$isFromDoc && !$isFromAI) ? null : set::noNestedCheck(true), + (!$isFromDoc && !$isFromAI) ? null : set::height(400), + ($isFromDoc || $isFromAI) ? null : set::customCols(true), + ($isFromDoc || $isFromAI) ? null : set::sortLink(createLink('execution', 'task', "executionID={$execution->id}&status={$status}¶m={$param}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}")), + ($isFromDoc || $isFromAI) ? null : set::checkInfo(jsRaw('function(checkedIDList){return window.setStatistics(this, checkedIDList);}')), + ($isFromDoc || $isFromAI) ? null : set::createTip($lang->task->create), + ($isFromDoc || $isFromAI) ? null : set::createLink($canCreate && common::canModify('execution', $execution) ? $createLink : ''), set::emptyTip($lang->task->noTask) );