* Finish tash #55677.

This commit is contained in:
liumengyi
2022-06-01 10:36:46 +08:00
parent f64b61a487
commit 499024e935
3 changed files with 61 additions and 35 deletions
+16 -4
View File
@@ -76,10 +76,14 @@ class custom extends control
if($module == 'story')
{
$this->view->depts = $this->loadModel('dept')->getDeptPairs();
$this->view->forceReviewAll = zget($this->config->$module, 'forceReviewAll', 'false');
$this->view->forceReview = zget($this->config->$module, 'forceReview', '');
$this->view->forceReviewRoles = zget($this->config->$module, 'forceReviewRoles', '');
$this->view->forceReviewDepts = zget($this->config->$module, 'forceReviewDepts', '');
$this->view->forceNotReview = zget($this->config->$module, 'forceNotReview', '');
$this->view->forceNotReviewRoles = zget($this->config->$module, 'forceNotReviewRoles', '');
$this->view->forceNotReviewDepts = zget($this->config->$module, 'forceNotReviewDepts', '');
}
$this->view->users = $module == 'story' ? $this->user->getCanCreateStoryUsers() : $this->user->getPairs('noclosed|nodeleted');
@@ -124,15 +128,23 @@ class custom extends control
elseif($module == 'story' and $field == 'review')
{
$data = fixer::input('post')
->setDefault('forceReviewAll', 0)
->setDefault('forceReviewDepts', '')
->setDefault('forceNotReviewDepts', '')
->join('forceReview', ',')
->join('forceReviewRoles', ',')
->join('forceReviewDepts', ',')
->join('forceReviewAll', ',')
->setIF(isset($this->post->forceReviewAll), 'forceReviewAll', 1)
->join('forceNotReview', ',')
->join('forceNotReviewRoles', ',')
->join('forceNotReviewDepts', ',')
->get();
foreach($data as $key => $value)
{
if($key == 'needReview') continue;
if(strpos($key, 'Not') and $data->needReview == 0) $data->$key = '';
if(!strpos($key, 'Not') and $data->needReview == 1) $data->$key = '';
}
$this->loadModel('setting')->setItems("system.$module@{$this->config->vision}", $data);
}
elseif($module == 'story' and $field == 'reviewRules')
+34 -23
View File
@@ -38,13 +38,13 @@ EOT;
</style>
<?php if($module == 'story' and $field == 'review'):?>
<style>
.table-form>tbody>tr>th {width: 120px !important}
.reviewBox > th {width: 95px !important;}
.reviewBox > td {width: 500px !important;}
.checkbox-primary {margin-bottom: 0px; width: 82px !important;}
.storyReviewTip {padding-left: 95px;}
.storyReviewTip > div , .storyNotReviewTip > div {padding-left: 120px;}
<?php if($app->getClientLang() != 'zh-cn' and $app->getClientLang() != 'zh-tw'):?>
.reviewBox > th {width: 160px !important;}
.storyReviewTip {padding-left: 160px;}
<?php endif;?>
</style>
<?php endif;?>
@@ -108,24 +108,33 @@ EOT;
<?php if($module == 'story'):?>
<tr>
<?php $space = ($app->getClientLang() != 'zh-cn' and $app->getClientLang() != 'zh-tw') ? ' ': '';?>
<td colspan='3'><div class='storyReviewTip'><?php echo sprintf($lang->custom->notice->forceReview, $lang->$module->common) . $lang->custom->notice->storyReviewTip;?></td>
<td colspan='3' class='storyReviewTip<?php if($needReview) echo " hidden"?>'><div><?php echo sprintf($lang->custom->notice->forceReview, $lang->$module->common) . $lang->custom->notice->storyReviewTip;?></td>
<td colspan='3' class='storyNotReviewTip<?php if(!$needReview) echo " hidden"?>'><div><?php echo sprintf($lang->custom->notice->forceNotReview, $lang->$module->common) . $lang->custom->notice->storyReviewTip;?></td>
</tr>
<tr id='userBox'>
<tr id='userBox' class='forceReview<?php if($needReview) echo " hidden"?>'>
<th><?php echo $lang->custom->forceReview . $space . $lang->custom->account;?></th>
<td><?php echo html::select('forceReview[]', $users, $forceReview, "class='form-control chosen' multiple");?></td>
<td>
<?php echo html::checkbox('forceReviewAll', array('1' => $lang->custom->allUsers), $forceReviewAll);?>
<icon class='icon icon-help' data-toggle='popover' data-trigger='focus hover' data-placement='right' data-tip-class='text-muted popover-sm' data-content="<?php echo $lang->custom->notice->selectAllTip;?>"></icon>
</td>
</tr>
<tr id='roleBox'>
<tr id='roleBox' class='forceReview<?php if($needReview) echo " hidden"?>'>
<th><?php echo $lang->custom->forceReview . $space . $lang->custom->role;?></th>
<td><?php echo html::select('forceReviewRoles[]', $lang->user->roleList, $forceReviewRoles, "class='form-control chosen' multiple");?></td>
</tr>
<tr id='deptBox'>
<tr id='deptBox' class='forceReview<?php if($needReview) echo " hidden"?>'>
<th><?php echo $lang->custom->forceReview . $space . $lang->custom->dept;?></th>
<td><?php echo html::select('forceReviewDepts[]', $depts, $forceReviewDepts, "class='form-control chosen' multiple");?></td>
</tr>
<tr id='userBox' class='forceNotReview<?php if(!$needReview) echo " hidden"?>'>
<th><?php echo $lang->custom->forceNotReview . $space . $lang->custom->account;?></th>
<td><?php echo html::select('forceNotReview[]', $users, $forceNotReview, "class='form-control chosen' multiple");?></td>
</tr>
<tr id='roleBox' class='forceNotReview<?php if(!$needReview) echo " hidden"?>'>
<th><?php echo $lang->custom->forceNotReview . $space . $lang->custom->role;?></th>
<td><?php echo html::select('forceNotReviewRoles[]', $lang->user->roleList, $forceNotReviewRoles, "class='form-control chosen' multiple");?></td>
</tr>
<tr id='deptBox' class='forceNotReview<?php if(!$needReview) echo " hidden"?>'>
<th><?php echo $lang->custom->forceNotReview . $space . $lang->custom->dept;?></th>
<td><?php echo html::select('forceNotReviewDepts[]', $depts, $forceNotReviewDepts, "class='form-control chosen' multiple");?></td>
</tr>
<?php endif;?>
<?php if($module == 'testcase'):?>
<?php js::set('oldNeedReview', $needReview);?>
@@ -271,31 +280,33 @@ $(function()
{
$('[data-toggle="popover"]').popover();
toggleBox($("input[name^='forceReviewAll']").prop('checked'));
$("input[name^='forceReviewAll']").click(function()
$("input[name='needReview']").change(function()
{
toggleBox($(this).prop('checked'));
});
needReviewChange();
})
/**
* Toggle box.
* When needReview change.
*
* @param bool $checked
* @access public
* @return void
*/
function toggleBox(checked)
function needReviewChange()
{
$('#roleBox').toggleClass('hidden', checked);
$('#deptBox').toggleClass('hidden', checked);
if(checked)
var needReview = $("input[name='needReview']:checked").val();
if(needReview == 1)
{
$('#forceReview').val('').attr('disabled', 'disabled').trigger('chosen:updated');
$('.storyReviewTip').addClass('hidden');
$('.forceReview').addClass('hidden');
$('.storyNotReviewTip').removeClass('hidden');
$('.forceNotReview').removeClass('hidden');
}
else
{
$('#forceReview').removeAttr('disabled', 'disabled').trigger('chosen:updated');
$('.forceReview').removeClass('hidden');
$('.storyReviewTip').removeClass('hidden');
$('.forceNotReview').addClass('hidden');
$('.storyNotReviewTip').addClass('hidden');
}
}
})
+11 -8
View File
@@ -4357,29 +4357,32 @@ class storyModel extends model
{
$forceReview = false;
if(isset($this->config->story->forceReviewAll) and $this->config->story->forceReviewAll) return true;
$forceField = $this->config->story->needReview == 0 ? 'forceReview' : 'forceNotReview';
$forceReviewRoles = !empty($this->config->story->{$forceField . 'Roles'}) ? $this->config->story->{$forceField . 'Roles'} : '';
$forceReviewDepts = !empty($this->config->story->{$forceField . 'Depts'}) ? $this->config->story->{$forceField . 'Depts'} : '';
$forceUsers = '';
if(!empty($this->config->story->forceReview)) $forceUsers = $this->config->story->forceReview;
if(!empty($this->config->story->{$forceField})) $forceUsers = $this->config->story->{$forceField};
if(!empty($this->config->story->forceReviewRoles) or !empty($this->config->story->forceReviewDepts))
if(!empty($forceReviewRoles) or !empty($forceReviewDepts))
{
$users = $this->dao->select('account')->from(TABLE_USER)
->where('deleted')->eq(0)
->andWhere(true, true)
->beginIF(!empty($this->config->story->forceReviewRoles))
->andWhere('role', true)->in($this->config->story->forceReviewRoles)
->andWhere(0, true)
->beginIF(!empty($forceReviewRoles))
->andWhere('role', true)->in($forceReviewRoles)
->andWhere('role')->ne('')
->markRight(1)
->fi()
->beginIF(!empty($this->config->story->forceReviewDepts))->orWhere('dept')->in($this->config->story->forceReviewDepts)->fi()
->beginIF(!empty($forceReviewDepts))->orWhere('dept')->in($forceReviewDepts)->fi()
->markRight(1)
->fetchAll('account');
$forceUsers .= "," . implode(',', array_keys($users));
}
$forceReview = strpos(",{$forceUsers},", ",{$this->app->user->account},") !== false;
$forceReview = $this->config->story->needReview == 0 ? strpos(",{$forceUsers},", ",{$this->app->user->account},") : !strpos(",{$forceUsers},", ",{$this->app->user->account},");
return $forceReview;
}