diff --git a/lib/zin/wg/modulemenu/v1.php b/lib/zin/wg/modulemenu/v1.php index d51e68e670..592f0fb86f 100644 --- a/lib/zin/wg/modulemenu/v1.php +++ b/lib/zin/wg/modulemenu/v1.php @@ -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¤tModule=$currentModule¤tMethod=$currentMethod")), + set::href(helper::createLink('datatable', 'ajaxDisplay', "datatableId=$datatableId&moduleName=$app->moduleName&methodName=$app->methodName¤tModule=$currentModule¤tMethod=$currentMethod&branchType=$branchType")), set('data-toggle', 'modal'), $lang->displaySetting ) diff --git a/module/datatable/control.php b/module/datatable/control.php index 90f729d0f0..eada0c21fa 100644 --- a/module/datatable/control.php +++ b/module/datatable/control.php @@ -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); diff --git a/module/datatable/ui/ajaxdisplay.html.php b/module/datatable/ui/ajaxdisplay.html.php index b670d52119..3767c46e9a 100644 --- a/module/datatable/ui/ajaxdisplay.html.php +++ b/module/datatable/ui/ajaxdisplay.html.php @@ -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 diff --git a/module/execution/ui/task.html.php b/module/execution/ui/task.html.php index b1b68b10eb..354850e0bf 100644 --- a/module/execution/ui/task.html.php +++ b/module/execution/ui/task.html.php @@ -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' : '' ))) ); diff --git a/module/product/ui/browse.html.php b/module/product/ui/browse.html.php index 8e228834b2..eda93f4361 100644 --- a/module/product/ui/browse.html.php +++ b/module/product/ui/browse.html.php @@ -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¤tModuleID=0&branch=$branchID"), - 'closeLink' => createLink('execution', 'task') + 'closeLink' => createLink('execution', 'task'), + 'branchType' => $branchType ))) ); };