+ Add moduleMenu actions.
This commit is contained in:
@@ -9,9 +9,9 @@ class moduleMenu extends wg
|
||||
protected static $defineProps = array(
|
||||
'modules: array',
|
||||
'activeKey: int',
|
||||
'settingLink: string',
|
||||
'closeLink: string',
|
||||
'activeText: string=""',
|
||||
'moduleSetting: bool=true',
|
||||
'displaySetting: bool=true'
|
||||
);
|
||||
|
||||
@@ -60,27 +60,36 @@ class moduleMenu extends wg
|
||||
|
||||
private function buildBtns()
|
||||
{
|
||||
$moduleSetting = $this->prop('moduleSetting');
|
||||
$settingLink = $this->prop('settingLink');
|
||||
$displaySetting = $this->prop('displaySetting');
|
||||
if(!$moduleSetting && !$displaySetting) return null;
|
||||
if(!$settingLink && !$displaySetting) return null;
|
||||
|
||||
global $app;
|
||||
$lang = $app->loadLang('datatable')->datatable;
|
||||
$currentModule = $app->rawModule;
|
||||
$currentMethod = $app->rawMethod;
|
||||
|
||||
$datatableId = $app->moduleName . ucfirst($app->methodName);
|
||||
|
||||
return div
|
||||
(
|
||||
setClass('setting-btns'),
|
||||
$moduleSetting ? a
|
||||
$settingLink ? a
|
||||
(
|
||||
setClass('btn'),
|
||||
setStyle('background', '#EEF5FF'),
|
||||
setStyle('border', 'none'),
|
||||
set::href($settingLink),
|
||||
$lang->moduleSetting
|
||||
) : null,
|
||||
$displaySetting ? a
|
||||
(
|
||||
setClass('btn white'),
|
||||
$lang->displaySetting
|
||||
) : null,
|
||||
$displaySetting ?
|
||||
a(
|
||||
setClass('btn white'),
|
||||
set::href(helper::createLink('datatable', 'ajaxDisplay', "datatableId=$datatableId&moduleName=$app->moduleName&methodName=$app->methodName¤tModule=$currentModule¤tMethod=$currentMethod")),
|
||||
set('data-toggle', 'modal'),
|
||||
$lang->displaySetting
|
||||
)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,27 @@ class datatable extends control
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set display.
|
||||
*
|
||||
* @param string $datatableId
|
||||
* @param string $moduleName
|
||||
* @param string $methodName
|
||||
* @param string $currentModule
|
||||
* @param string $currentMethod
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxDisplay(string $datatableId, string $moduleName, string $methodName, string $currentModule, string $currentMethod)
|
||||
{
|
||||
$this->view->datatableId = $datatableId;
|
||||
$this->view->moduleName = $moduleName;
|
||||
$this->view->methodName = $methodName;
|
||||
$this->view->currentModule = $currentModule;
|
||||
$this->view->currentMethod = $currentMethod;
|
||||
$this->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save config
|
||||
*
|
||||
@@ -42,7 +63,7 @@ class datatable extends control
|
||||
if($this->post->global) $this->setting->setItem('system.' . $name, $this->post->value);
|
||||
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => 'dao error.'));
|
||||
return $this->send(array('result' => 'success'));
|
||||
return $this->send(array('result' => 'success', 'closeModal' => true, 'load' => true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The ajaxcustom view file of datatable 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 zhujinyong<zhujinyong@easycorp.ltd>
|
||||
* @package zin
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
|
||||
namespace zin;
|
||||
|
||||
global $lang, $app;
|
||||
$app->loadLang('datatable');
|
||||
$showModule = isset($config->datatable->$datatableId->showModule) ? $config->datatable->$datatableId->showModule : '0';
|
||||
$showAllModule = isset($config->execution->task->allModule) ? $config->execution->task->allModule : 0;
|
||||
$showBranch = isset($config->$currentModule->$currentMethod->showBranch) ? $config->$currentModule->$currentMethod->showBranch : 1;
|
||||
|
||||
set::title($lang->datatable->displaySetting);
|
||||
form
|
||||
(
|
||||
set::url(helper::createLink('datatable', 'ajaxSave')),
|
||||
set::labelWidth('12em'),
|
||||
input
|
||||
(
|
||||
set('class', 'hidden'),
|
||||
set::name('target'),
|
||||
set::value($datatableId),
|
||||
),
|
||||
input
|
||||
(
|
||||
set('class', 'hidden'),
|
||||
set::name('name'),
|
||||
set::value('showModule'),
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->datatable->showModule),
|
||||
radiolist
|
||||
(
|
||||
set::name('value'),
|
||||
set::inline(true),
|
||||
set::items($lang->datatable->showModuleList),
|
||||
set::value($showModule),
|
||||
),
|
||||
),
|
||||
$moduleName == 'execution' && $methodName == 'task' && $this->config->vision != 'lite' ? formGroup
|
||||
(
|
||||
set::label($lang->datatable->showAllModule),
|
||||
radiolist
|
||||
(
|
||||
set::name('allModule'),
|
||||
set::inline(true),
|
||||
set::items($lang->datatable->showAllModuleList),
|
||||
set::value($showAllModule),
|
||||
),
|
||||
) : null,
|
||||
$isShowBranch ? formGroup
|
||||
(
|
||||
set::label($lang->datatable->showBranch),
|
||||
radiolist
|
||||
(
|
||||
set::name('showBranch'),
|
||||
set::inline(true),
|
||||
set::items($lang->datatable->showBranchList),
|
||||
set::value($showBranch),
|
||||
),
|
||||
) : null,
|
||||
input
|
||||
(
|
||||
set('class', 'hidden'),
|
||||
set::name('currentModule'),
|
||||
set::value($currentModule),
|
||||
),
|
||||
input
|
||||
(
|
||||
set('class', 'hidden'),
|
||||
set::name('currentMethod'),
|
||||
set::value($currentMethod),
|
||||
),
|
||||
set::actions(array('submit')),
|
||||
);
|
||||
|
||||
render('modalDialog');
|
||||
@@ -93,9 +93,10 @@ toolbar
|
||||
sidebar
|
||||
(
|
||||
moduleMenu(set(array(
|
||||
'modules' => $moduleTree,
|
||||
'activeKey' => $moduleID,
|
||||
'closeLink' => $this->createLink('execution', 'task')
|
||||
'modules' => $moduleTree,
|
||||
'activeKey' => $moduleID,
|
||||
'settingLink' => $this->createLink('tree', 'browsetask', "rootID=$execution->id&productID=0"),
|
||||
'closeLink' => $this->createLink('execution', 'task')
|
||||
)))
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user