* code for task #8496.

This commit is contained in:
z
2020-11-25 10:06:09 +08:00
parent 7c4908478c
commit 55fb0867cb
6 changed files with 30 additions and 267 deletions
+21 -129
View File
@@ -398,7 +398,7 @@ class custom extends control
* @access public
* @return void
*/
public function configureWaterfall($type = 'concept')
public function configureWaterfall()
{
$this->app->loadLang('custom');
$this->lang->custom->menu = new stdclass();
@@ -406,76 +406,22 @@ class custom extends control
if($_POST)
{
if($type == 'concept')
{
$result = $this->custom->setURAndSR();
if(!$result) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->URSREmpty));
}
if($type == 'user' and isset($_POST['keys']))
{
$lang = $_POST['lang'];
$oldCustoms = $this->custom->getItems("lang=$lang&module=user&section=roleList");
foreach($_POST['keys'] as $index => $key)
{
if(strlen($key) > 10) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStrlen['ten']));
}
$this->custom->deleteItems("lang=$lang&module=user&section=roleList");
$data = fixer::input('post')->get();
foreach($data->keys as $index => $key)
{
$value = $data->values[$index];
$system = $data->systems[$index];
$this->custom->setItem("{$lang}.user.roleList.{$key}.{$system}", $value);
}
}
$result = $this->custom->setURAndSR();
if(!$result) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->URSREmpty));
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('custom', 'configurewaterfall', "type=$type")));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('custom', 'configurewaterfall')));
}
if($type == 'user')
{
$this->app->loadLang('user');
$fieldList = zget($this->lang->user, 'roleList', '');
$lang = $this->app->getClientLang();
$dbFields = $this->custom->getItems("lang=$lang&module=user&section=roleList");
if(empty($dbFields)) $dbFields = $this->custom->getItems("lang=all&module=user&section=roleList");
if($dbFields)
{
$dbField = reset($dbFields);
if($lang != $dbField->lang)
{
$lang = str_replace('-', "_", $dbField->lang);
foreach($fieldList as $key => $value)
{
if(isset($dbFields[$key]) and $value != $dbFields[$key]->value) $fieldList[$key] = $dbFields[$key]->value;
}
}
}
$this->view->fieldList = $fieldList;
$this->view->dbFields = $dbFields;
$this->view->currentLang = $lang;
$this->view->lang2Set = str_replace('_', '-', $lang);
}
if($type == 'concept')
{
$URSRName = $this->dao->select("`value`")->from(TABLE_CONFIG)
->where('module')->eq('custom')
->andWhere('section')->eq('common')
->andWhere('`key`')->eq('URSRName')
->fetch('value');
$this->view->URSRName = json_decode($URSRName);
}
$URSRName = $this->dao->select("`value`")->from(TABLE_CONFIG)
->where('module')->eq('custom')
->andWhere('section')->eq('common')
->andWhere('`key`')->eq('URSRName')
->fetch('value');
$this->view->title = $this->lang->custom->common;
$this->view->position[] = $this->lang->custom->common;
$this->view->type = $type;
$this->view->URSRName = json_decode($URSRName);
$this->display();
}
@@ -486,7 +432,7 @@ class custom extends control
* @access public
* @return void
*/
public function configureScrum($type = 'concept')
public function configureScrum()
{
$this->app->loadLang('custom');
$this->lang->custom->menu = new stdclass();
@@ -494,77 +440,23 @@ class custom extends control
if($_POST)
{
if($type == 'concept')
{
$this->custom->setConcept();
$result = $this->custom->setURAndSR();
if(!$result) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->URSREmpty));
}
$this->custom->setConcept();
$result = $this->custom->setURAndSR();
if(!$result) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->URSREmpty));
if($type == 'user' && isset($_POST['keys']))
{
$lang = $_POST['lang'];
$oldCustoms = $this->custom->getItems("lang=$lang&module=user&section=roleList");
foreach($_POST['keys'] as $index => $key)
{
if(strlen($key) > 10) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStrlen['ten']));
}
$this->custom->deleteItems("lang=$lang&module=user&section=roleList");
$data = fixer::input('post')->get();
foreach($data->keys as $index => $key)
{
$value = $data->values[$index];
$system = $data->systems[$index];
$this->custom->setItem("{$lang}.user.roleList.{$key}.{$system}", $value);
}
}
$locate = inlink('configureScrum', "type=$type");
$locate = inlink('configureScrum');
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate));
}
if($type == 'concept')
{
$URSRName = $this->dao->select("`value`")->from(TABLE_CONFIG)
->where('module')->eq('custom')
->andWhere('section')->eq('common')
->andWhere('`key`')->eq('URSRName')
->fetch('value');
$this->view->URSRName = json_decode($URSRName);
}
if($type == 'user')
{
$this->app->loadLang('user');
$fieldList = zget($this->lang->user, 'roleList', '');
$lang = $this->app->getClientLang();
$dbFields = $this->custom->getItems("lang=$lang&module=user&section=roleList");
if(empty($dbFields)) $dbFields = $this->custom->getItems("lang=all&module=user&section=roleList");
if($dbFields)
{
$dbField = reset($dbFields);
if($lang != $dbField->lang)
{
$lang = str_replace('-', "_", $dbField->lang);
foreach($fieldList as $key => $value)
{
if(isset($dbFields[$key]) and $value != $dbFields[$key]->value) $fieldList[$key] = $dbFields[$key]->value;
}
}
}
$this->view->fieldList = $fieldList;
$this->view->dbFields = $dbFields;
$this->view->currentLang = $lang;
$this->view->lang2Set = str_replace('_', '-', $lang);
}
$URSRName = $this->dao->select("`value`")->from(TABLE_CONFIG)
->where('module')->eq('custom')
->andWhere('section')->eq('common')
->andWhere('`key`')->eq('URSRName')
->fetch('value');
$this->view->title = $this->lang->custom->configureScrum;
$this->view->position[] = $this->lang->custom->configureScrum;
$this->view->type = $type;
$this->view->URSRName = json_decode($URSRName);
$this->display();
}
+2
View File
@@ -5,10 +5,12 @@ $(function()
if($(this).val() == 0)
{
$('#URSRName').addClass('hidden');
$('#customURSR').addClass('hidden');
}
else
{
$('#URSRName').removeClass('hidden');
$('#customURSR').removeClass('hidden');
}
});
+2
View File
@@ -5,10 +5,12 @@ $(function()
if($(this).val() == 0)
{
$('#URSRName').addClass('hidden');
$('#customURSR').addClass('hidden');
}
else
{
$('#URSRName').removeClass('hidden');
$('#customURSR').removeClass('hidden');
}
});
+1
View File
@@ -125,6 +125,7 @@ $lang->custom->todo->fields['typeList'] = '类型';
$lang->custom->todo->fields['statusList'] = '状态';
$lang->custom->user = new stdClass();
$lang->custom->user->fields['roleList'] = '职位';
$lang->custom->user->fields['statusList'] = '状态';
$lang->custom->user->fields['contactField'] = '可用联系方式';
$lang->custom->user->fields['deleted'] = '列出已删除用户';
+3 -70
View File
@@ -10,40 +10,19 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php
$itemRow = <<<EOT
<tr class='text-center'>
<td>
<input type='text' class="form-control" autocomplete="off" value="" name="keys[]">
<input type='hidden' value="0" name="systems[]">
</td>
<td>
<input type='text' class="form-control" value="" autocomplete="off" name="values[]">
</td>
<td class='c-actions'>
<a href="javascript:void(0)" class='btn btn-link' onclick="addItem(this)"><i class='icon-plus'></i></a>
<a href="javascript:void(0)" class='btn btn-link' onclick="delItem(this)"><i class='icon-close'></i></a>
</td>
</tr>
EOT;
?>
<?php js::set('type', $type);?>
<?php js::set('itemRow', $itemRow);?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<?php echo html::a(inlink('configurescrum', 'type=concept'), "<span class='text'>" . $lang->custom->concept . '</span>', '', "class='btn btn-link concept'");?>
<?php echo html::a(inlink('configurescrum', 'type=user'), "<span class='text'>" . $lang->user->role . '</span>', '', "class='btn btn-link user'");?>
<?php echo html::a(inlink('configurescrum'), "<span class='text'>" . $lang->custom->concept . '</span>', '', "class='btn btn-link btn-active-text concept'");?>
</div>
</div>
<div id='mainContent' class='main-content'>
<form id='ajaxForm' class='form-ajax' method='post'>
<div class='modal-body'>
<?php if($type == 'concept'):?>
<table class='table table-form'>
<tr>
<th class='w-160px'><?php echo $lang->custom->scrum->setConcept;?> </th>
<td><?php echo html::radio('productProject', $lang->custom->productProject->relation, zget($this->config->custom, 'productProject', '0_0'))?></td>
<td></td><td></td><td></td><td></td>
<td colspan='3'><?php echo html::radio('productProject', $lang->custom->productProject->relation, zget($this->config->custom, 'productProject', '0_0'))?></td>
<td></td><td></td>
</tr>
<tr>
<th> <?php echo $lang->custom->waterfall->URAndSR;?> </th>
@@ -64,53 +43,7 @@ EOT;
<td class='text-right'><?php echo html::submitButton();?></td>
</tr>
</table>
<?php endif;?>
<?php if($type == 'user'):?>
<table class='table table-form active-disabled table-condensed mw-600px'>
<tr class='text-center'>
<td class='w-120px'><strong><?php echo $lang->custom->key;?></strong></td>
<td><strong><?php echo $lang->custom->value;?></strong></td>
<th class='w-90px'></th>
</tr>
<?php foreach($fieldList as $key => $value):?>
<tr class='text-center'>
<?php $system = isset($dbFields[$key]) ? $dbFields[$key]->system : 1;?>
<td><?php echo $key === '' ? 'NULL' : $key; echo html::hidden('keys[]', $key) . html::hidden('systems[]', $system);?></td>
<td>
<?php echo html::input("values[]", isset($dbFields[$key]) ? $dbFields[$key]->value : $value, "class='form-control' " . (empty($key) ? 'readonly' : ''));?>
</td>
<td class='c-actions'>
<a href="javascript:void(0)" onclick="addItem(this)" class='btn btn-link'><i class='icon-plus'></i></a>
<a href="javascript:void(0)" onclick="delItem(this)" class='btn btn-link'><i class='icon-close'></i></a>
</td>
</tr>
<?php endforeach;?>
<tr>
<td colspan='3' class='text-center form-actions'>
<?php
$appliedTo = array($currentLang => $lang->custom->currentLang, 'all' => $lang->custom->allLang);
echo html::radio('lang', $appliedTo, $lang2Set);
echo html::submitButton();
if(common::hasPriv('custom', 'restore')) echo html::linkButton($lang->custom->restore, inlink('restore', "module=user&field=roleList"), 'hiddenwin', '', 'btn btn-wide');
?>
</td>
</tr>
</table>
<?php endif;?>
</div>
</form>
</div>
<script>
$('.' + type).addClass('btn-active-text');
function addItem(clickedButton)
{
$(clickedButton).parent().parent().after(itemRow);
}
function delItem(clickedButton)
{
$(clickedButton).parent().parent().remove();
}
</script>
<?php include '../../common/view/footer.html.php';?>
+1 -68
View File
@@ -10,36 +10,15 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php
$itemRow = <<<EOT
<tr class='text-center'>
<td>
<input type='text' class="form-control" autocomplete="off" value="" name="keys[]">
<input type='hidden' value="0" name="systems[]">
</td>
<td>
<input type='text' class="form-control" value="" autocomplete="off" name="values[]">
</td>
<td class='c-actions'>
<a href="javascript:void(0)" class='btn btn-link' onclick="addItem(this)"><i class='icon-plus'></i></a>
<a href="javascript:void(0)" class='btn btn-link' onclick="delItem(this)"><i class='icon-close'></i></a>
</td>
</tr>
EOT;
?>
<?php js::set('type', $type);?>
<?php js::set('itemRow', $itemRow);?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<?php echo html::a(inlink('configurewaterfall', 'type=concept'), "<span class='text'>" . $lang->custom->concept . '</span>', '', "class='btn btn-link concept'");?>
<?php echo html::a(inlink('configurewaterfall', 'type=user'), "<span class='text'>" . $lang->user->role . '</span>', '', "class='btn btn-link user'");?>
<?php echo html::a(inlink('configurewaterfall'), "<span class='text'>" . $lang->custom->concept . '</span>', '', "class='btn btn-link btn-active-text concept'");?>
</div>
</div>
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<form class="load-indicator main-form form-ajax" method='post'>
<div class='modal-body'>
<?php if($type == 'concept'):?>
<table class='table table-form'>
<tr>
<th class='w-160px'> <?php echo $lang->custom->waterfall->URAndSR;?> </th>
@@ -61,54 +40,8 @@ EOT;
<td class='text-right'><?php echo html::submitButton();?></td>
</tr>
</table>
<?php endif;?>
<?php if($type == 'user'):?>
<table class='table table-form active-disabled table-condensed mw-600px'>
<tr class='text-center'>
<td class='w-120px'><strong><?php echo $lang->custom->key;?></strong></td>
<td><strong><?php echo $lang->custom->value;?></strong></td>
<th class='w-90px'></th>
</tr>
<?php foreach($fieldList as $key => $value):?>
<tr class='text-center'>
<?php $system = isset($dbFields[$key]) ? $dbFields[$key]->system : 1;?>
<td><?php echo $key === '' ? 'NULL' : $key; echo html::hidden('keys[]', $key) . html::hidden('systems[]', $system);?></td>
<td>
<?php echo html::input("values[]", isset($dbFields[$key]) ? $dbFields[$key]->value : $value, "class='form-control' " . (empty($key) ? 'readonly' : ''));?>
</td>
<td class='c-actions'>
<a href="javascript:void(0)" onclick="addItem(this)" class='btn btn-link'><i class='icon-plus'></i></a>
<a href="javascript:void(0)" onclick="delItem(this)" class='btn btn-link'><i class='icon-close'></i></a>
</td>
</tr>
<?php endforeach;?>
<tr>
<td colspan='3' class='text-center form-actions'>
<?php
$appliedTo = array($currentLang => $lang->custom->currentLang, 'all' => $lang->custom->allLang);
echo html::radio('lang', $appliedTo, $lang2Set);
echo html::submitButton();
if(common::hasPriv('custom', 'restore')) echo html::linkButton($lang->custom->restore, inlink('restore', "module=user&field=roleList"), 'hiddenwin', '', 'btn btn-wide');
?>
</td>
</tr>
</table>
<?php endif;?>
</div>
</form>
</div>
</div>
<script>
$('.' + type).addClass('btn-active-text');
function addItem(clickedButton)
{
$(clickedButton).parent().parent().after(itemRow);
}
function delItem(clickedButton)
{
$(clickedButton).parent().parent().remove();
}
</script>
<?php include '../../common/view/footer.html.php';?>