* Fix display of datatable.

This commit is contained in:
朱金勇
2023-06-15 07:32:21 +00:00
parent ed7147d51c
commit 38ad5bcd5a
5 changed files with 25 additions and 13 deletions
+7 -5
View File
@@ -12,7 +12,8 @@ class moduleMenu extends wg
'settingLink: string',
'closeLink: string',
'activeText: string=""',
'displaySetting: bool=true'
'branchType: string=""',
'showDisplay: bool=true'
);
public static function getPageCSS(): string|false
@@ -61,8 +62,9 @@ class moduleMenu extends wg
private function buildBtns()
{
$settingLink = $this->prop('settingLink');
$displaySetting = $this->prop('displaySetting');
if(!$settingLink && !$displaySetting) return null;
$showDisplay = $this->prop('showDisplay');
$branchType = $this->prop('branchType');
if(!$settingLink && !$showDisplay) return null;
global $app;
$lang = $app->loadLang('datatable')->datatable;
@@ -82,10 +84,10 @@ class moduleMenu extends wg
set::href($settingLink),
$lang->moduleSetting
) : null,
$displaySetting ?
$showDisplay ?
a(
setClass('btn white'),
set::href(helper::createLink('datatable', 'ajaxDisplay', "datatableId=$datatableId&moduleName=$app->moduleName&methodName=$app->methodName&currentModule=$currentModule&currentMethod=$currentMethod")),
set::href(helper::createLink('datatable', 'ajaxDisplay', "datatableId=$datatableId&moduleName=$app->moduleName&methodName=$app->methodName&currentModule=$currentModule&currentMethod=$currentMethod&branchType=$branchType")),
set('data-toggle', 'modal'),
$lang->displaySetting
)
+9 -2
View File
@@ -30,16 +30,23 @@ class datatable extends control
* @param string $methodName
* @param string $currentModule
* @param string $currentMethod
* @param string $branchType
* @access public
* @return void
*/
public function ajaxDisplay(string $datatableId, string $moduleName, string $methodName, string $currentModule, string $currentMethod)
public function ajaxDisplay(string $datatableId, string $moduleName, string $methodName, string $currentModule, string $currentMethod, string $branchType)
{
if($branchType) $this->lang->datatable->showBranch = sprintf($this->lang->datatable->showBranch, isset($this->lang->datatable->$branchType) ? $this->lang->datatable->$branchType : $this->lang->datatable->branch);
$this->app->loadConfig($currentModule);
$this->view->datatableId = $datatableId;
$this->view->moduleName = $moduleName;
$this->view->methodName = $methodName;
$this->view->currentModule = $currentModule;
$this->view->currentMethod = $currentMethod;
$this->view->isShowBranch = $branchType && $branchType != 'normal';
$this->view->showBranch = isset($this->config->$currentModule->$currentMethod->showBranch) ? $this->config->$currentModule->$currentMethod->showBranch : 1;
$this->render();
}
@@ -56,7 +63,7 @@ class datatable extends control
$account = $this->app->user->account;
if($account == 'guest') return $this->send(array('result' => 'fail', 'target' => $target, 'message' => 'guest.'));
$this->loadModel('setting');
$this->loadModel('setting')->setItem($account . '.' . $this->post->currentModule . '.' . $this->post->currentMethod . '.showModule', $this->post->value);
if($this->post->allModule !== false) $this->setting->setItem("$account.execution.task.allModule", $this->post->allModule);
if($this->post->showBranch !== false) $this->setting->setItem($account . '.' . $this->post->currentModule . '.' . $this->post->currentMethod . '.showBranch', $this->post->showBranch);
+3 -3
View File
@@ -14,9 +14,9 @@ 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;
$showModule = isset($config->$currentModule->$currentMethod->showModule) ? $config->$currentModule->$currentMethod->showModule : '0';
$showBranch = isset($config->$currentModule->$currentMethod->showBranch) ? $config->$currentModule->$currentMethod->showBranch : '0';
$showAllModule = isset($config->execution->task->allModule) ? $config->execution->task->allModule : 0;
set::title($lang->datatable->displaySetting);
form
+2 -1
View File
@@ -96,7 +96,8 @@ sidebar
'modules' => $moduleTree,
'activeKey' => $moduleID,
'settingLink' => $this->createLink('tree', 'browsetask', "rootID=$execution->id&productID=0"),
'closeLink' => $this->createLink('execution', 'task')
'closeLink' => $this->createLink('execution', 'task'),
'branchType' => $showBranch ? 'branch' : ''
)))
);
+4 -2
View File
@@ -16,9 +16,10 @@ $isProjectStory = $this->app->rawModule == 'projectstory';
$projectHasProduct = $isProjectStory && !empty($project->hasProduct);
$projectIDParam = $isProjectStory ? "projectID=$projectID&" : '';
$storyBrowseType = $this->session->storyBrowseType;
$branchType = $showBranch ? $product->type : '';
/* Generate sidebar to display module tree menu. */
$fnGenerateSideBar = function() use ($moduleTree, $moduleID, $productID, $branchID)
$fnGenerateSideBar = function() use ($moduleTree, $moduleID, $productID, $branchID, $branchType)
{
sidebar
(
@@ -27,7 +28,8 @@ $fnGenerateSideBar = function() use ($moduleTree, $moduleID, $productID, $branch
'modules' => $moduleTree,
'activeKey' => $moduleID,
'settingLink' => $this->createLink('tree', 'browse', "rootID=$productID&view=story&currentModuleID=0&branch=$branchID"),
'closeLink' => createLink('execution', 'task')
'closeLink' => createLink('execution', 'task'),
'branchType' => $branchType
)))
);
};