* Refactor set rules page of the repo module.
This commit is contained in:
@@ -28,6 +28,5 @@ $config->index->oldPages[] = 'program-kanban';
|
||||
$config->index->oldPages[] = 'project-kanban';
|
||||
$config->index->oldPages[] = 'execution-kanban';
|
||||
$config->index->oldPages[] = 'execution-taskkanban';
|
||||
$config->index->oldPages[] = 'repo-setrules';
|
||||
$config->index->oldPages[] = 'host-treemap';
|
||||
$config->index->oldPages[] = 'screen-view';
|
||||
|
||||
@@ -903,7 +903,7 @@ class repo extends control
|
||||
if($_POST)
|
||||
{
|
||||
$this->loadModel('setting')->setItem('system.repo.rules', json_encode($this->post->rules));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true));
|
||||
}
|
||||
|
||||
$repoID = $this->session->repoID;
|
||||
@@ -915,7 +915,7 @@ class repo extends control
|
||||
$this->app->loadLang('story');
|
||||
if(is_string($this->config->repo->rules)) $this->config->repo->rules = json_decode($this->config->repo->rules, true);
|
||||
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->setRules;
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->setRules;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#setRulesForm .form-row.mt-0 {margin-top: 0;}
|
||||
#setRulesForm .form-row .form-label {width: 8rem;}
|
||||
#setRulesForm .form-row .form-group {padding-left: 8rem;}
|
||||
@@ -0,0 +1,185 @@
|
||||
$(function()
|
||||
{
|
||||
replaceExample();
|
||||
$(document).on('keyup', 'input', function(){replaceExample()});
|
||||
})
|
||||
|
||||
function replaceExample()
|
||||
{
|
||||
let html = '';
|
||||
let startTask = $('[id*=start]').val().split(';');
|
||||
let taskModule = $('[id*=module][id*=task]').val().split(';');
|
||||
let idMark = $('[id*=id][id*=mark]').val().split(';');
|
||||
let idSplit = $('[id*=id][id*=split]').val().split(';');
|
||||
let costs = $('[id*=task][id*=consumed]').val().split(';');
|
||||
let consumedmark = $('[id*=mark][id*=consumed]').val().split(';');
|
||||
let lefts = $('[id*=task][id*=left]').val().split(';');
|
||||
let leftMarks = $('[id*=mark][id*=left]').val().split(';');
|
||||
let cunits = $('[id*=unit][id*=consumed]').val().split(';');
|
||||
let lunits = $('[id*=unit][id*=left]').val().split(';');
|
||||
|
||||
for(i in startTask)
|
||||
{
|
||||
start = startTask[i];
|
||||
for(j in taskModule)
|
||||
{
|
||||
task = taskModule[j];
|
||||
for(k in idMark)
|
||||
{
|
||||
id = idMark[k];
|
||||
for(l in idSplit)
|
||||
{
|
||||
split = idSplit[l];
|
||||
for(m in costs)
|
||||
{
|
||||
cost = costs[m];
|
||||
for(n in consumedmark)
|
||||
{
|
||||
consumed = consumedmark[n];
|
||||
for(o in lefts)
|
||||
{
|
||||
left = lefts[o];
|
||||
for(p in leftMarks)
|
||||
{
|
||||
leftMark = leftMarks[p];
|
||||
for(q in cunits)
|
||||
{
|
||||
cunit = cunits[q];
|
||||
for(r in lunits)
|
||||
{
|
||||
lunit = lunits[r];
|
||||
html += '<br />' + rulesExample['task']['start'].replace('%start%', start)
|
||||
.replace('%task%', task)
|
||||
.replace('%id%', id)
|
||||
.replace('%split%', split)
|
||||
.replace('%cost%', cost)
|
||||
.replace('%consumedmark%', consumed)
|
||||
.replace('%left%', left)
|
||||
.replace('%leftmark%', leftMark)
|
||||
.replace('%cunit%', cunit)
|
||||
.replace('%lunit%', lunit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let finishTask = $('[id*=finish]').val().split(';');
|
||||
for(i in finishTask)
|
||||
{
|
||||
finish = finishTask[i];
|
||||
for(j in taskModule)
|
||||
{
|
||||
task = taskModule[j];
|
||||
for(k in idMark)
|
||||
{
|
||||
id = idMark[k];
|
||||
for(l in idSplit)
|
||||
{
|
||||
split = idSplit[l];
|
||||
for(m in costs)
|
||||
{
|
||||
cost = costs[m];
|
||||
for(n in consumedmark)
|
||||
{
|
||||
consumed = consumedmark[n];
|
||||
for(o in cunits)
|
||||
{
|
||||
cunit = cunits[o];
|
||||
html += '<br />' + rulesExample['task']['finish'].replace('%finish%', finish)
|
||||
.replace('%task%', task)
|
||||
.replace('%id%', id)
|
||||
.replace('%split%', split)
|
||||
.replace('%cost%', cost)
|
||||
.replace('%consumedmark%', consumed)
|
||||
.replace('%cunit%', cunit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let effortTask = $('[id*=logEfforts]').val().split(';');
|
||||
for(i in effortTask)
|
||||
{
|
||||
effort = effortTask[i];
|
||||
for(j in taskModule)
|
||||
{
|
||||
task = taskModule[j];
|
||||
for(k in idMark)
|
||||
{
|
||||
id = idMark[k];
|
||||
for(l in idSplit)
|
||||
{
|
||||
split = idSplit[l];
|
||||
for(m in costs)
|
||||
{
|
||||
cost = costs[m];
|
||||
for(n in consumedmark)
|
||||
{
|
||||
consumed = consumedmark[n];
|
||||
for(o in lefts)
|
||||
{
|
||||
left = lefts[o];
|
||||
for(p in leftMarks)
|
||||
{
|
||||
leftMark = leftMarks[p];
|
||||
for(q in cunits)
|
||||
{
|
||||
cunit = cunits[q];
|
||||
for(r in lunits)
|
||||
{
|
||||
lunit = lunits[r];
|
||||
html += '<br />' + rulesExample['task']['effort'].replace('%effort%', effort)
|
||||
.replace('%task%', task)
|
||||
.replace('%id%', id)
|
||||
.replace('%split%', split)
|
||||
.replace('%cost%', cost)
|
||||
.replace('%consumedmark%', consumed)
|
||||
.replace('%left%', left)
|
||||
.replace('%leftmark%', leftMark)
|
||||
.replace('%cunit%', cunit)
|
||||
.replace('%lunit%', lunit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let resolveBug = $('[id*=bug][id*="resolve"]').val().split(';');
|
||||
let bugModule = $('[id*=module][id*=bug]').val().split(';');
|
||||
for(i in resolveBug)
|
||||
{
|
||||
resolve = resolveBug[i];
|
||||
for(j in bugModule)
|
||||
{
|
||||
bug = bugModule[j];
|
||||
for(k in idMark)
|
||||
{
|
||||
id = idMark[k];
|
||||
for(l in idSplit)
|
||||
{
|
||||
split = idSplit[l];
|
||||
html += '<br />' + rulesExample['bug']['resolve'].replace('%resolve%', resolve)
|
||||
.replace('%bug%', bug)
|
||||
.replace('%id%', id)
|
||||
.replace('%split%', split);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#example').html(html.substr(6));
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The setrules view file of repo 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 Shujie Tian <tianshujie@easycorp.ltd>
|
||||
* @package repo
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
namespace zin;
|
||||
jsVar('rulesExample', $lang->repo->rules->example);
|
||||
|
||||
$moduleDom = null;
|
||||
foreach($config->repo->rules['module'] as $module => $match)
|
||||
{
|
||||
$moduleDom[] = inputGroup
|
||||
(
|
||||
setClass('w-1'),
|
||||
span
|
||||
(
|
||||
setClass('input-group-addon'),
|
||||
$lang->{$module}->common
|
||||
),
|
||||
input
|
||||
(
|
||||
setID("rules[module][{$module}]"),
|
||||
set::name("rules[module][{$module}]"),
|
||||
set::value($match)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$idDom = null;
|
||||
foreach($config->repo->rules['id'] as $method => $match)
|
||||
{
|
||||
$idDom[] = inputGroup
|
||||
(
|
||||
setClass('w-1'),
|
||||
span
|
||||
(
|
||||
setClass('input-group-addon'),
|
||||
$lang->repo->$method
|
||||
),
|
||||
input
|
||||
(
|
||||
setID("rules[id][{$method}]"),
|
||||
set::name("rules[id][{$method}]"),
|
||||
set::value($match)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$space = common::checkNotCN() ? ' ' : '';
|
||||
|
||||
formPanel
|
||||
(
|
||||
setID('setRulesForm'),
|
||||
set::title($lang->repo->setRules),
|
||||
set::actions(array('submit')),
|
||||
set::actionsClass('w-2/3'),
|
||||
formGroup
|
||||
(
|
||||
set::width('2/3'),
|
||||
set::label($lang->repo->objectRule),
|
||||
$moduleDom,
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width('2/3'),
|
||||
set::label($lang->repo->objectIdRule),
|
||||
$idDom
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width('2/3'),
|
||||
set::label($lang->repo->actionRule),
|
||||
inputGroup
|
||||
(
|
||||
setClass('w-1'),
|
||||
span
|
||||
(
|
||||
setClass('input-group-addon'),
|
||||
$lang->task->common . $space . $lang->task->start
|
||||
),
|
||||
input
|
||||
(
|
||||
setID("rules[task][start]"),
|
||||
set::name("rules[task][start]"),
|
||||
set::value($config->repo->rules['task']['start'])
|
||||
)
|
||||
),
|
||||
inputGroup
|
||||
(
|
||||
setClass('w-1'),
|
||||
span
|
||||
(
|
||||
setClass('input-group-addon'),
|
||||
$lang->task->common . $space . $lang->task->finish
|
||||
),
|
||||
input
|
||||
(
|
||||
setID("rules[task][finish]"),
|
||||
set::name("rules[task][finish]"),
|
||||
set::value($config->repo->rules['task']['finish'])
|
||||
)
|
||||
),
|
||||
inputGroup
|
||||
(
|
||||
setClass('w-1'),
|
||||
span
|
||||
(
|
||||
setClass('input-group-addon'),
|
||||
$lang->bug->common . $space . $lang->bug->resolve
|
||||
),
|
||||
input
|
||||
(
|
||||
setID("rules[bug][resolve]"),
|
||||
set::name("rules[bug][resolve]"),
|
||||
set::value($config->repo->rules['bug']['resolve'])
|
||||
)
|
||||
)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label(''),
|
||||
set::width('2/3'),
|
||||
inputGroup
|
||||
(
|
||||
setClass('w-1'),
|
||||
span
|
||||
(
|
||||
setClass('input-group-addon'),
|
||||
$lang->task->common . $space . $lang->task->logEfforts
|
||||
),
|
||||
input
|
||||
(
|
||||
setID("rules[task][logEfforts]"),
|
||||
set::name("rules[task][logEfforts]"),
|
||||
set::value($config->repo->rules['task']['logEfforts'])
|
||||
)
|
||||
)
|
||||
),
|
||||
formRow
|
||||
(
|
||||
setClass('mt-0'),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->repo->manHourRule),
|
||||
set::width('2/3'),
|
||||
inputGroup
|
||||
(
|
||||
setClass('w-1'),
|
||||
span
|
||||
(
|
||||
setClass('input-group-addon'),
|
||||
$lang->task->consumed
|
||||
),
|
||||
input
|
||||
(
|
||||
setID("rules[task][consumed]"),
|
||||
set::name("rules[task][consumed]"),
|
||||
set::value($config->repo->rules['task']['consumed'])
|
||||
)
|
||||
),
|
||||
inputGroup
|
||||
(
|
||||
setClass('w-1'),
|
||||
span
|
||||
(
|
||||
setClass('input-group-addon'),
|
||||
$lang->repo->mark
|
||||
),
|
||||
input
|
||||
(
|
||||
setID("rules[mark][consumed]"),
|
||||
set::name("rules[mark][consumed]"),
|
||||
set::value($config->repo->rules['mark']['consumed'])
|
||||
)
|
||||
),
|
||||
inputGroup
|
||||
(
|
||||
setClass('w-1'),
|
||||
span
|
||||
(
|
||||
setClass('input-group-addon'),
|
||||
$lang->repo->ruleUnit
|
||||
),
|
||||
input
|
||||
(
|
||||
setID("rules[unit][consumed]"),
|
||||
set::name("rules[unit][consumed]"),
|
||||
set::value($config->repo->rules['unit']['consumed'])
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
formRow
|
||||
(
|
||||
setClass('mt-0'),
|
||||
formGroup
|
||||
(
|
||||
set::label(''),
|
||||
set::width('2/3'),
|
||||
inputGroup
|
||||
(
|
||||
setClass('w-1'),
|
||||
span
|
||||
(
|
||||
setClass('input-group-addon'),
|
||||
$lang->task->left
|
||||
),
|
||||
input
|
||||
(
|
||||
setID("rules[task][left]"),
|
||||
set::name("rules[task][left]"),
|
||||
set::value($config->repo->rules['task']['left'])
|
||||
)
|
||||
),
|
||||
inputGroup
|
||||
(
|
||||
setClass('w-1'),
|
||||
span
|
||||
(
|
||||
setClass('input-group-addon'),
|
||||
$lang->repo->mark
|
||||
),
|
||||
input
|
||||
(
|
||||
setID("rules[mark][left]"),
|
||||
set::name("rules[mark][left]"),
|
||||
set::value($config->repo->rules['mark']['left'])
|
||||
)
|
||||
),
|
||||
inputGroup
|
||||
(
|
||||
setClass('w-1'),
|
||||
span
|
||||
(
|
||||
setClass('input-group-addon'),
|
||||
$lang->repo->ruleUnit
|
||||
),
|
||||
input
|
||||
(
|
||||
setID("rules[unit][left]"),
|
||||
set::name("rules[unit][left]"),
|
||||
set::value($config->repo->rules['unit']['left'])
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label(''),
|
||||
span
|
||||
(
|
||||
setClass('pl-2 text-danger'),
|
||||
$lang->repo->ruleSplit
|
||||
)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width('2/3'),
|
||||
set::label($lang->repo->rules->exampleLabel),
|
||||
div
|
||||
(
|
||||
setID('example'),
|
||||
)
|
||||
)
|
||||
);
|
||||
Reference in New Issue
Block a user