* Adjust whitelist setting logic.

This commit is contained in:
leiyong
2020-10-28 09:14:38 +08:00
parent 80307f2457
commit 0909592ea1
16 changed files with 92 additions and 51 deletions
+5
View File
@@ -4,6 +4,11 @@ function setProgramType(type)
location.href = location.href;
}
function setWhite(acl)
{
acl != 'open' ? $('#whitelistBox').removeClass('hidden') : $('#whitelistBox').addClass('hidden');
}
/**
* Convert a date string like 2011-11-11 to date object in js.
*
+3 -1
View File
@@ -244,11 +244,13 @@ class programModel extends model
->setDefault('end', '')
->setDefault('parent', 0)
->setDefault('openedDate', helper::now())
->setIF($this->post->acl == 'open', 'whitelist', '')
->add('type', 'program')
->join('whitelist', ',')
->cleanInt('budget')
->stripTags($this->config->program->editor->pgmcreate['id'], $this->config->allowedTags)
->get();
$whitelist = explode(',', $program->whitelist);
if($program->parent)
{
@@ -281,7 +283,7 @@ class programModel extends model
$programID = $this->dao->lastInsertId();
$this->dao->update(TABLE_PROGRAM)->set('`order`')->eq($programID * 5)->where('id')->eq($programID)->exec(); // Save order.
$this->loadModel('personnel')->updateWhitelist($this->post->whitelist, 'program', $programID);
$this->loadModel('personnel')->updateWhitelist($whitelist, 'program', $programID);
if($program->acl != 'open') $this->loadModel('user')->updateUserView($programID, 'program');
$this->file->updateObjectID($this->post->uid, $programID, 'project');
+4 -4
View File
@@ -101,9 +101,9 @@
</tr>
<tr>
<th><?php echo $lang->project->acl;?></th>
<td colspan='3' class='aclBox'><?php echo nl2br(html::radio('acl', $lang->program->PGMAclList, 'open', '', 'block'));?></td>
<td colspan='3' class='aclBox'><?php echo nl2br(html::radio('acl', $lang->program->PGMAclList, 'open', "onclick='setWhite(this.value);'", 'block'));?></td>
</tr>
<tr>
<tr class="hidden" id="whitelistBox">
<th><?php echo $lang->whitelist;?></th>
<td><?php echo html::select('whitelist[]', $users, '', 'class="form-control chosen" multiple');?></td>
<td></td>
@@ -148,10 +148,10 @@
</div>
</div>
<div id='PGMAcl' class='hidden'>
<?php echo nl2br(html::radio('acl', $lang->program->PGMAclList, 'open', '', 'block'));?>
<?php echo nl2br(html::radio('acl', $lang->program->PGMAclList, 'open', "onclick='setWhite(this.value);'", 'block'));?>
</div>
<div id='subPGMAcl' class='hidden'>
<?php echo nl2br(html::radio('acl', $lang->program->subPGMAclList, 'open', '', 'block'));?>
<?php echo nl2br(html::radio('acl', $lang->program->subPGMAclList, 'open', "onclick='setWhite(this.value);'", 'block'));?>
</div>
<?php js::set('parentProgramID', isset($parentProgram->id) ? $parentProgram->id : 0);?>
<?php include '../../common/view/footer.html.php';?>
+3 -3
View File
@@ -73,7 +73,7 @@
<th><?php echo $lang->project->acl;?></th>
<td colspan='3' class='aclBox'><?php echo nl2br(html::radio('acl', $aclList, $program->acl, "onclick='setWhite(this.value);'", 'block'));?></td>
</tr>
<tr>
<tr class="<?php if($program->acl == 'open') echo 'hidden';?>" id="whitelistBox">
<th><?php echo $lang->whitelist;?></th>
<td><?php echo html::select('whitelist[]', $users, $program->whitelist, 'class="form-control chosen" multiple');?></td>
<td></td>
@@ -90,9 +90,9 @@
</div>
</div>
<div id='PGMAcl' class='hidden'>
<?php echo nl2br(html::radio('acl', $lang->program->PGMAclList, $program->acl == 'program' ? 'private' : 'open', '', 'block'));?>
<?php echo nl2br(html::radio('acl', $lang->program->PGMAclList, $program->acl == 'program' ? 'private' : 'open', "onclick='setWhite(this.value);'", 'block'));?>
</div>
<div id='subPGMAcl' class='hidden'>
<?php echo nl2br(html::radio('acl', $lang->program->subPGMAclList, $program->acl, '', 'block'));?>
<?php echo nl2br(html::radio('acl', $lang->program->subPGMAclList, $program->acl, "onclick='setWhite(this.value);'", 'block'));?>
</div>
<?php include '../../common/view/footer.html.php';?>
+4 -4
View File
@@ -117,9 +117,9 @@
</tr>
<tr>
<th><?php echo $lang->project->acl;?></th>
<td colspan='3' class='aclBox'><?php echo nl2br(html::radio('acl', $lang->program->PRJAclList, $acl, '', 'block'));?></td>
<td colspan='3' class='aclBox'><?php echo nl2br(html::radio('acl', $lang->program->PRJAclList, $acl, "onclick='setWhite(this.value);'", 'block'));?></td>
</tr>
<tr>
<tr class="hidden" id="whitelistBox">
<th><?php echo $lang->whitelist;?></th>
<td><?php echo html::select('whitelist[]', $users, '', 'class="form-control chosen" multiple');?></td>
<td></td>
@@ -167,9 +167,9 @@
</div>
</div>
<div id='PRJAcl' class='hidden'>
<?php echo nl2br(html::radio('acl', $lang->program->PRJAclList, $acl, '', 'block'));?>
<?php echo nl2br(html::radio('acl', $lang->program->PRJAclList, $acl, "onclick='setWhite(this.value);'", 'block'));?>
</div>
<div id='PGMAcl' class='hidden'>
<?php echo nl2br(html::radio('acl', $lang->program->PGMPRJAclList, $acl, '', 'block'));?>
<?php echo nl2br(html::radio('acl', $lang->program->PGMPRJAclList, $acl, "onclick='setWhite(this.value);'", 'block'));?>
</div>
<?php include '../../common/view/footer.html.php';?>
+4 -4
View File
@@ -116,9 +116,9 @@
</tr>
<tr>
<th><?php echo $lang->project->acl;?></th>
<td colspan='3' class='aclBox'><?php echo nl2br(html::radio('acl', $aclList, $project->acl, '', 'block'));?></td>
<td colspan='3' class='aclBox'><?php echo nl2br(html::radio('acl', $aclList, $project->acl, "onclick='setWhite(this.value);'", 'block'));?></td>
</tr>
<tr>
<tr class="<?php if($program->acl == 'open') echo 'hidden';?>" id="whitelistBox">
<th><?php echo $lang->whitelist;?></th>
<td><?php echo html::select('whitelist[]', $users, $project->whitelist, 'class="form-control chosen" multiple');?></td>
<td></td>
@@ -138,9 +138,9 @@
</div>
</div>
<div id='PRJAcl' class='hidden'>
<?php echo nl2br(html::radio('acl', $lang->program->PRJAclList, $project->acl == 'program' ? 'private' : 'open', '', 'block'));?>
<?php echo nl2br(html::radio('acl', $lang->program->PRJAclList, $project->acl == 'program' ? 'private' : 'open', "onclick='setWhite(this.value);'", 'block'));?>
</div>
<div id='PGMAcl' class='hidden'>
<?php echo nl2br(html::radio('acl', $lang->program->PGMPRJAclList, $project->acl, '', 'block'));?>
<?php echo nl2br(html::radio('acl', $lang->program->PGMPRJAclList, $project->acl, "onclick='setWhite(this.value);'", 'block'));?>
</div>
<?php include '../../common/view/footer.html.php';?>