diff --git a/config/zentaopms.php b/config/zentaopms.php index 479fa241b9..612b03246c 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -408,3 +408,10 @@ $config->showMainMenu = true; $config->maxPriValue = '256'; $config->importWhiteList = array('user', 'task', 'story', 'bug', 'testcase', 'feedback', 'ticket'); + +$config->featureGroup = new stdclass(); +$config->featureGroup->product = array('roadmap', 'track', 'URStory'); +$config->featureGroup->scrum = array(); +$config->featureGroup->waterfall = array('track'); +$config->featureGroup->assetlib = array(); +$config->featureGroup->other = array('devops', 'kanban'); diff --git a/framework/helper.class.php b/framework/helper.class.php index c944daa477..c83d2c3e07 100644 --- a/framework/helper.class.php +++ b/framework/helper.class.php @@ -76,6 +76,50 @@ class helper extends baseHelper return str_replace($escapers, $replacements, $json); } + /** + * Verify that the system has opened on the feature. + * + * @param string $feature scrum_risk | risk | scrum + * @static + * @access public + * @return bool + */ + public static function hasFeature($feature) + { + global $config; + + if(strpos($feature, '_') !== false) + { + $code = explode('_', $feature); + $code = $code[0] . ucfirst($code[1]); + return strpos(",$config->disabledFeatures,", ",{$code},") === false; + } + else + { + if($feature == 'product' or $feature == 'scrum' or $feature == 'waterfall') return strpos(",$config->disabledFeatures,", ",{$feature},") === false; + + $hasFeature = false; + foreach($config->featureGroup as $group => $modules) + { + if($feature == $group) + { + foreach($modules as $module) + { + if(helper::hasFeature("{$group}_{$module}")) $hasFeature = true; + } + } + else + { + foreach($modules as $module) + { + if($feature == $module and helper::hasFeature("{$group}_{$module}")) $hasFeature = true; + } + } + } + return $hasFeature && strpos(",$config->disabledFeatures,", ",{$feature},") === false; + } + } + /** * Convert encoding. * diff --git a/module/admin/config.php b/module/admin/config.php index a8e2b18847..197e7da4e2 100644 --- a/module/admin/config.php +++ b/module/admin/config.php @@ -14,12 +14,5 @@ $config->admin->apiRoot = 'https://www.zentao.net'; $config->admin->log = new stdclass(); $config->admin->log->saveDays = 30; -$config->admin->module = new stdclass(); -$config->admin->module->product = array('roadmap', 'track', 'URStory'); -$config->admin->module->scrum = array(); -$config->admin->module->waterfall = array('track'); -$config->admin->module->assetlib = array(); -$config->admin->module->other = array('devops', 'kanban'); - if(!isset($config->safe)) $config->safe = new stdclass(); if(!isset($config->safe->weak)) $config->safe->weak = '123456,password,12345,12345678,qwerty,123456789,1234,1234567,abc123,111111,123123'; diff --git a/module/admin/view/setmodule.html.php b/module/admin/view/setmodule.html.php index 44996f9258..73a90383e6 100644 --- a/module/admin/view/setmodule.html.php +++ b/module/admin/view/setmodule.html.php @@ -29,37 +29,37 @@ - config->admin->module as $module => $options):?> - + featureGroup as $group => $features):?> + - - + + - admin->setModule->{$module};?> + admin->setModule->{$group};?> - - + +
- $lang->admin->setModule->{$option}), '1', "data-code='{$code}'", 'inline');?> + $lang->admin->setModule->{$feature}), '1', "data-code='{$code}'", 'inline');?>
- - + +
- $lang->admin->setModule->{$option}), '0', "data-code='{$code}'", 'inline');?> + $lang->admin->setModule->{$feature}), '0', "data-code='{$code}'", 'inline');?>
diff --git a/module/block/control.php b/module/block/control.php index 11d9b9227a..e24baa8bf6 100755 --- a/module/block/control.php +++ b/module/block/control.php @@ -1752,16 +1752,9 @@ class block extends control */ public function printAssignToMeBlock($longBlock = true) { - $hasWaterfall = strpos(",{$this->config->disabledFeatures},", ',waterfall,') === false; - $hasScrumIssue = strpos(",{$this->config->disabledFeatures},", ',scrumIssue,') === false; - $hasScrumRisk = strpos(",{$this->config->disabledFeatures},", ',scrumRisk,') === false; - $hasScrumMeeting = strpos(",{$this->config->disabledFeatures},", ',scrumMeeting,') === false; - $hasWaterfallIssue = (strpos(",{$this->config->disabledFeatures},", ',waterfallIssue,') === false and $hasWaterfall); - $hasWaterfallRisk = (strpos(",{$this->config->disabledFeatures},", ',waterfallRisk,') === false and $hasWaterfall); - $hasWaterfallMeeting = (strpos(",{$this->config->disabledFeatures},", ',waterfallMeeting,') === false and $hasWaterfall); - $hasIssue = ($hasScrumIssue or $hasWaterfallIssue); - $hasRisk = ($hasScrumRisk or $hasWaterfallRisk); - $hasMeeting = ($hasScrumMeeting or $hasWaterfallMeeting); + $hasIssue = helper::hasFeature('issue'); + $hasRisk = helper::hasFeature('risk'); + $hasMeeting = helper::hasFeature('meeting'); $hasViewPriv = array(); if(common::hasPriv('todo', 'view')) $hasViewPriv['todo'] = true; diff --git a/module/block/model.php b/module/block/model.php index f1010eb630..141eb2acad 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -774,17 +774,6 @@ class blockModel extends model */ public function getAssignToMeParams() { - $hasWaterfall = strpos(",{$this->config->disabledFeatures},", ',waterfall,') === false; - $hasScrumIssue = strpos(",{$this->config->disabledFeatures},", ',scrumIssue,') === false; - $hasScrumRisk = strpos(",{$this->config->disabledFeatures},", ',scrumRisk,') === false; - $hasScrumMeeting = strpos(",{$this->config->disabledFeatures},", ',scrumMeeting,') === false; - $hasWaterfallIssue = (strpos(",{$this->config->disabledFeatures},", ',waterfallIssue,') === false and $hasWaterfall); - $hasWaterfallRisk = (strpos(",{$this->config->disabledFeatures},", ',waterfallRisk,') === false and $hasWaterfall); - $hasWaterfallMeeting = (strpos(",{$this->config->disabledFeatures},", ',waterfallMeeting,') === false and $hasWaterfall); - $hasIssue = ($hasScrumIssue or $hasWaterfallIssue); - $hasRisk = ($hasScrumRisk or $hasWaterfallRisk); - $hasMeeting = ($hasScrumMeeting or $hasWaterfallMeeting); - $params = new stdclass(); $params->todoCount['name'] = $this->lang->block->todoCount; $params->todoCount['default'] = 20; @@ -800,21 +789,21 @@ class blockModel extends model if($this->config->edition == 'max') { - if($hasRisk) + if(helper::hasFeature('risk')) { $params->riskCount['name'] = $this->lang->block->riskCount; $params->riskCount['default'] = 20; $params->riskCount['control'] = 'input'; } - if($hasIssue) + if(helper::hasFeature('issue')) { $params->issueCount['name'] = $this->lang->block->issueCount; $params->issueCount['default'] = 20; $params->issueCount['control'] = 'input'; } - if($hasMeeting) + if(helper::hasFeature('meeting')) { $params->meetingCount['name'] = $this->lang->block->meetingCount; $params->meetingCount['default'] = 20; diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index 732dddccfb..5c5eac49c1 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -772,39 +772,31 @@ $lang->navGroup->tree = 'tree'; $lang->navGroup->misc = 'misc'; $lang->navGroup->upgrade = 'upgrade'; -$hasWaterfall = strpos(",$config->disabledFeatures,", ',waterfall,') === false; -$hasProductTrack = strpos(",$config->disabledFeatures,", ',productTrack,') === false; -$hasProductRoadmap = strpos(",$config->disabledFeatures,", ',productRoadmap,') === false; -$hasScrumAuditplan = strpos(",$config->disabledFeatures,", ',scrumAuditplan,') === false; -$hasScrumProcess = strpos(",$config->disabledFeatures,", ',scrumProcess,') === false; -$hasOtherDevops = strpos(",$config->disabledFeatures,", ',otherDevops,') === false; -$hasOtherKanban = strpos(",$config->disabledFeatures,", ',otherKanban,') === false; - -if(!$config->URAndSR) unset($lang->product->menu->requirement, $lang->product->menuOrder[35]); -if(!$hasProductRoadmap) unset($lang->product->menu->roadmap, $lang->product->menuOrder[30]); -if(!$hasProductTrack) +if(!$config->URAndSR) unset($lang->product->menu->requirement, $lang->product->menuOrder[35]); +if(!helper::hasFeature('product_roadmap')) unset($lang->product->menu->roadmap, $lang->product->menuOrder[30]); +if(!helper::hasFeature('product_track')) { unset($lang->product->menu->track, $lang->product->menuOrder[40]); $lang->product->dividerMenu = str_replace(',track,', ',doc,', $lang->product->dividerMenu); } -if(!$hasWaterfall) unset($lang->admin->menu->model['dropMenu']->waterfall); +if(!helper::hasFeature('waterfall')) unset($lang->admin->menu->model['dropMenu']->waterfall); -if(!$hasOtherDevops) +if(!helper::hasFeature('devops')) { unset($lang->mainNav->devops, $lang->mainNav->menuOrder[35]); unset($lang->scrum->menu->devops, $lang->scrum->menuOrder[25]); unset($lang->waterfall->menu->devops, $lang->waterfall->menuOrder[35]); } -if(!$hasOtherKanban) +if(!helper::hasFeature('kanban')) { unset($lang->mainNav->kanban, $lang->mainNav->menuOrder[40]); $lang->dividerMenu = str_replace(',kanban,' , ',doc,', $lang->dividerMenu); } -if(!$hasScrumAuditplan) +if($config->edition == 'max' and !helper::hasFeature('scrum_auditplan')) { - if($hasScrumProcess) + if(!helper::hasFeature('scrum_process')) { $lang->admin->menu->model['dropMenu']->scrum = array('link' => "{$lang->scrumModel}|process|scrumbrowse|processID=0&browseType=scrum", 'subModule' => 'auditcl,process,activity,zoutput,classify,'); } diff --git a/module/doc/view/content.html.php b/module/doc/view/content.html.php index af5b57b78c..fa12f06ff7 100644 --- a/module/doc/view/content.html.php +++ b/module/doc/view/content.html.php @@ -1,8 +1,5 @@ doc->confirmDelete);?> -disabledFeatures,", ',assetlib,') === false;?> -disabledFeatures,", ',assetlibPracticelib,') === false;?> -disabledFeatures,", ',assetlibComponentlib,') === false;?>
@@ -49,8 +46,8 @@ config->edition == 'max' and $this->app->tab == 'project'):?> dev->methodOrder[15] = 'editor'; $lang->dev->methodOrder[20] = 'translate'; global $config; -$inUpgrade = (defined('IN_UPGRADE') and IN_UPGRADE); -$isURSR = ($config->URAndSR or $inUpgrade); -$hasProgram = ($config->systemMode == 'ALM' or $inUpgrade); -$hasProductTrack = (strpos(",$config->disabledFeatures,", ',productTrack,') === false or $inUpgrade); -$hasProductRoadmap = (strpos(",$config->disabledFeatures,", ',productRoadmap,') === false or $inUpgrade); -$hasWaterfallTrack = (strpos(",$config->disabledFeatures,", ',waterfallTrack,') === false or $inUpgrade); -$hasWaterfall = (strpos(",$config->disabledFeatures,", ',waterfall,') === false or $inUpgrade); -$hasAssetlib = (strpos(",$config->disabledFeatures,", ',assetlib,') === false or $inUpgrade); -$hasOtherDevops = (strpos(",$config->disabledFeatures,", ',otherDevops,') === false or $inUpgrade); -$hasOtherKanban = (strpos(",$config->disabledFeatures,", ',otherKanban,') === false or $inUpgrade); - -if(!$hasWaterfall) +$inUpgrade = (defined('IN_UPGRADE') and IN_UPGRADE); +if(!$inUpgrade) { - unset($lang->resource->design); - unset($lang->resource->programplan); - unset($lang->resource->stage); + if(!$config->URAndSR) + { + unset($lang->resource->product->requirement); + unset($lang->resource->story->linkStory); + unset($lang->resource->requirement); + } + if($config->systemMode == 'light') + { + unset($lang->resource->program); + unset($lang->resource->project->programTitle); + } + if(!helper::hasFeature('waterfall')) + { + unset($lang->resource->design); + unset($lang->resource->programplan); + unset($lang->resource->stage); + } + if(!helper::hasFeature('product_track')) unset($lang->resource->product->track); + if(!helper::hasFeature('product_roadmap')) unset($lang->resource->product->roadmap); + if(!helper::hasFeature('waterfall_track')) unset($lang->resource->projectstory->track); + if(!helper::hasFeature('devops')) + { + unset($lang->resource->repo); + unset($lang->resource->svn); + unset($lang->resource->git); + unset($lang->resource->app); + unset($lang->resource->ci); + unset($lang->resource->compile); + unset($lang->resource->jenkins); + unset($lang->resource->job); + unset($lang->resource->gitlab); + unset($lang->resource->gogs); + unset($lang->resource->gitea); + unset($lang->resource->sonarqube); + unset($lang->resource->mr); + } + if(!helper::hasFeature('kanban')) unset($lang->resource->kanban); } -if(!$hasProgram) -{ - unset($lang->resource->program); - unset($lang->resource->project->programTitle); -} -if(!$isURSR) -{ - unset($lang->resource->product->requirement); - unset($lang->resource->story->linkStory); - unset($lang->resource->requirement); -} -if(!$hasProductTrack) unset($lang->resource->product->track); -if(!$hasProductRoadmap) unset($lang->resource->product->roadmap); -if(!$hasWaterfallTrack) unset($lang->resource->projectstory->track); - -if(!$hasOtherDevops) -{ - unset($lang->resource->repo); - unset($lang->resource->svn); - unset($lang->resource->git); - unset($lang->resource->app); - unset($lang->resource->ci); - unset($lang->resource->compile); - unset($lang->resource->jenkins); - unset($lang->resource->job); - unset($lang->resource->gitlab); - unset($lang->resource->gogs); - unset($lang->resource->gitea); - unset($lang->resource->sonarqube); - unset($lang->resource->mr); -} -if(!$hasOtherKanban) unset($lang->resource->kanban); include (dirname(__FILE__) . '/changelog.php'); diff --git a/module/my/lang/de.php b/module/my/lang/de.php index 017098731c..5e87fb8471 100644 --- a/module/my/lang/de.php +++ b/module/my/lang/de.php @@ -99,9 +99,9 @@ $lang->my->auditMenu->audit = new stdclass(); $lang->my->auditMenu->audit->all = 'All'; $lang->my->auditMenu->audit->story = 'Story'; $lang->my->auditMenu->audit->testcase = 'Case'; -if($config->edition == 'max' and strpos(",$config->disabledFeatures,", ',waterfall,') === false) $lang->my->auditMenu->audit->project = 'Project'; +if($config->edition == 'max' and helper::hasFeature('waterfall')) $lang->my->auditMenu->audit->project = 'Project'; if($config->edition != 'open') $lang->my->auditMenu->audit->feedback = 'Feedback'; -if($config->edition != 'open' and strpos(",$config->disabledFeatures,", ',otherOA,') === false) $lang->my->auditMenu->audit->oa = 'OA'; +if($config->edition != 'open' and helper::hasFeature('OA')) $lang->my->auditMenu->audit->oa = 'OA'; $lang->my->contributeMenu = new stdclass(); $lang->my->contributeMenu->audit = new stdclass(); diff --git a/module/my/lang/en.php b/module/my/lang/en.php index 017098731c..5e87fb8471 100644 --- a/module/my/lang/en.php +++ b/module/my/lang/en.php @@ -99,9 +99,9 @@ $lang->my->auditMenu->audit = new stdclass(); $lang->my->auditMenu->audit->all = 'All'; $lang->my->auditMenu->audit->story = 'Story'; $lang->my->auditMenu->audit->testcase = 'Case'; -if($config->edition == 'max' and strpos(",$config->disabledFeatures,", ',waterfall,') === false) $lang->my->auditMenu->audit->project = 'Project'; +if($config->edition == 'max' and helper::hasFeature('waterfall')) $lang->my->auditMenu->audit->project = 'Project'; if($config->edition != 'open') $lang->my->auditMenu->audit->feedback = 'Feedback'; -if($config->edition != 'open' and strpos(",$config->disabledFeatures,", ',otherOA,') === false) $lang->my->auditMenu->audit->oa = 'OA'; +if($config->edition != 'open' and helper::hasFeature('OA')) $lang->my->auditMenu->audit->oa = 'OA'; $lang->my->contributeMenu = new stdclass(); $lang->my->contributeMenu->audit = new stdclass(); diff --git a/module/my/lang/fr.php b/module/my/lang/fr.php index 017098731c..5e87fb8471 100644 --- a/module/my/lang/fr.php +++ b/module/my/lang/fr.php @@ -99,9 +99,9 @@ $lang->my->auditMenu->audit = new stdclass(); $lang->my->auditMenu->audit->all = 'All'; $lang->my->auditMenu->audit->story = 'Story'; $lang->my->auditMenu->audit->testcase = 'Case'; -if($config->edition == 'max' and strpos(",$config->disabledFeatures,", ',waterfall,') === false) $lang->my->auditMenu->audit->project = 'Project'; +if($config->edition == 'max' and helper::hasFeature('waterfall')) $lang->my->auditMenu->audit->project = 'Project'; if($config->edition != 'open') $lang->my->auditMenu->audit->feedback = 'Feedback'; -if($config->edition != 'open' and strpos(",$config->disabledFeatures,", ',otherOA,') === false) $lang->my->auditMenu->audit->oa = 'OA'; +if($config->edition != 'open' and helper::hasFeature('OA')) $lang->my->auditMenu->audit->oa = 'OA'; $lang->my->contributeMenu = new stdclass(); $lang->my->contributeMenu->audit = new stdclass(); diff --git a/module/my/lang/zh-cn.php b/module/my/lang/zh-cn.php index 8b4774de0d..32408fe012 100644 --- a/module/my/lang/zh-cn.php +++ b/module/my/lang/zh-cn.php @@ -99,9 +99,9 @@ $lang->my->auditMenu->audit = new stdclass(); $lang->my->auditMenu->audit->all = '所有'; $lang->my->auditMenu->audit->story = '需求'; $lang->my->auditMenu->audit->testcase = '用例'; -if($config->edition == 'max' and strpos(",$config->disabledFeatures,", ',waterfall,') === false) $lang->my->auditMenu->audit->project = '项目'; +if($config->edition == 'max' and helper::hasFeature('waterfall')) $lang->my->auditMenu->audit->project = '项目'; if($config->edition != 'open') $lang->my->auditMenu->audit->feedback = '反馈'; -if($config->edition != 'open' and strpos(",$config->disabledFeatures,", ',otherOA,') === false) $lang->my->auditMenu->audit->oa = '办公'; +if($config->edition != 'open' and helper::hasFeature('OA')) $lang->my->auditMenu->audit->oa = '办公'; $lang->my->contributeMenu = new stdclass(); $lang->my->contributeMenu->audit = new stdclass(); diff --git a/module/project/lang/de.php b/module/project/lang/de.php index 09247467cc..e92eaa099f 100644 --- a/module/project/lang/de.php +++ b/module/project/lang/de.php @@ -260,12 +260,9 @@ $lang->project->currencySymbol['SGD'] = 'S$'; $lang->project->modelList[''] = ''; $lang->project->modelList['scrum'] = "Scrum"; -$lang->project->modelList['waterfall'] = "CMMI"; +if(helper::hasFeature('waterfall')) $lang->project->modelList['waterfall'] = "CMMI"; $lang->project->modelList['kanban'] = "Kanban"; -global $config; -if(strpos(",$config->disabledFeatures,", ',waterfall,') !== false) unset($lang->project->modelList['waterfall']); - $lang->project->featureBar['browse']['all'] = 'All'; $lang->project->featureBar['browse']['undone'] = 'Unfinished'; $lang->project->featureBar['browse']['wait'] = 'Waiting'; diff --git a/module/project/lang/en.php b/module/project/lang/en.php index e351d8ccff..7d55e7f2e1 100644 --- a/module/project/lang/en.php +++ b/module/project/lang/en.php @@ -260,12 +260,9 @@ $lang->project->currencySymbol['SGD'] = 'S$'; $lang->project->modelList[''] = ''; $lang->project->modelList['scrum'] = "Scrum"; -$lang->project->modelList['waterfall'] = "CMMI"; +if(helper::hasFeature('waterfall')) $lang->project->modelList['waterfall'] = "CMMI"; $lang->project->modelList['kanban'] = "Kanban"; -global $config; -if(strpos(",$config->disabledFeatures,", ',waterfall,') !== false) unset($lang->project->modelList['waterfall']); - $lang->project->featureBar['browse']['all'] = 'All'; $lang->project->featureBar['browse']['undone'] = 'Unfinished'; $lang->project->featureBar['browse']['wait'] = 'Waiting'; diff --git a/module/project/lang/fr.php b/module/project/lang/fr.php index a81bcdf36f..7a2395523a 100644 --- a/module/project/lang/fr.php +++ b/module/project/lang/fr.php @@ -258,13 +258,10 @@ $lang->project->currencySymbol['NZD'] = 'NZ$'; $lang->project->currencySymbol['THB'] = '฿'; $lang->project->currencySymbol['SGD'] = 'S$'; -$lang->project->modelList[''] = ''; -$lang->project->modelList['scrum'] = "Scrum"; -$lang->project->modelList['waterfall'] = "CMMI"; -$lang->project->modelList['kanban'] = "Kanban"; - -global $config; -if(strpos(",$config->disabledFeatures,", ',waterfall,') !== false) unset($lang->project->modelList['waterfall']); +$lang->project->modelList[''] = ''; +$lang->project->modelList['scrum'] = "Scrum"; +if(helper::hasFeature('waterfall')) $lang->project->modelList['waterfall'] = "CMMI"; +$lang->project->modelList['kanban'] = "Kanban"; $lang->project->featureBar['browse']['all'] = 'All'; $lang->project->featureBar['browse']['undone'] = 'Non Terminées'; diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index 11125826fd..2481504777 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -258,13 +258,10 @@ $lang->project->currencySymbol['NZD'] = 'NZ$'; $lang->project->currencySymbol['THB'] = '฿'; $lang->project->currencySymbol['SGD'] = 'S$'; -$lang->project->modelList[''] = ""; -$lang->project->modelList['scrum'] = "Scrum"; -$lang->project->modelList['waterfall'] = "瀑布"; -$lang->project->modelList['kanban'] = "看板"; - -global $config; -if(strpos(",$config->disabledFeatures,", ',waterfall,') !== false) unset($lang->project->modelList['waterfall']); +$lang->project->modelList[''] = ""; +$lang->project->modelList['scrum'] = "Scrum"; +if(helper::hasFeature('waterfall')) $lang->project->modelList['waterfall'] = "瀑布"; +$lang->project->modelList['kanban'] = "看板"; $lang->project->featureBar['browse']['all'] = '全部'; $lang->project->featureBar['browse']['undone'] = '未完成'; diff --git a/module/project/view/createguide.html.php b/module/project/view/createguide.html.php index 22f43d8179..8444eea7d5 100644 --- a/module/project/view/createguide.html.php +++ b/module/project/view/createguide.html.php @@ -21,8 +21,8 @@

project->chooseProgramType; ?>

disabledFeatures,", ',waterfall,') === false; - $colClass = $hasWaterfall ? 'col-xs-4' : 'col-xs-6'; + $hasWaterfall = helper::hasFeature('waterfall'); + $colClass = $hasWaterfall ? 'col-xs-4' : 'col-xs-6'; ?>
tab;?>