* Finish task #61169.
This commit is contained in:
+14
-15
@@ -236,11 +236,11 @@ class kanban extends control
|
||||
$space = $this->kanban->getSpaceById($spaceID);
|
||||
$spaceUsers = $spaceID == 0 ? ',' : trim($space->owner) . ',' . trim($space->team);
|
||||
$spacePairs = array(0 => '') + $this->kanban->getSpacePairs($type);
|
||||
$users = isset($spacePairs[$spaceID]) ? $this->loadModel('user')->getPairs('noclosed|nodeleted', '', 0, $spaceUsers) : array();
|
||||
$whitelist = (isset($space->whitelist) and !empty($space->whitelist)) ? $space->whitelist : ',';
|
||||
$users = $this->loadModel('user')->getPairs('noclosed|nodeleted');
|
||||
$ownerPairs = (isset($spacePairs[$spaceID])) ? $this->user->getPairs('noclosed|nodeleted', '', 0, $spaceUsers) : $users;
|
||||
|
||||
$this->view->users = $users;
|
||||
$this->view->whitelist = isset($spacePairs[$spaceID]) ? $this->user->getPairs('noclosed|nodeleted', '', 0, $whitelist) : array();
|
||||
$this->view->ownerPairs = $ownerPairs;
|
||||
$this->view->spaceID = $spaceID;
|
||||
$this->view->spacePairs = $spacePairs;
|
||||
$this->view->type = $type;
|
||||
@@ -282,11 +282,11 @@ class kanban extends control
|
||||
|
||||
$space = $this->kanban->getSpaceById($kanban->space);
|
||||
$spaceUsers = trim($space->owner) . ',' . trim($space->team);
|
||||
$users = $this->loadModel('user')->getPairs('noclosed|nodeleted', '', 0, $spaceUsers);
|
||||
$whitelist = (isset($space->whitelist) and !empty($space->whitelist)) ? $space->whitelist : ',';
|
||||
$users = $this->loadModel('user')->getPairs('noclosed|nodeleted');
|
||||
$ownerPairs = $this->user->getPairs('noclosed|nodeleted', '', 0, $spaceUsers);
|
||||
|
||||
$this->view->users = $users;
|
||||
$this->view->whitelist = $this->user->getPairs('noclosed|nodeleted', '', 0, $whitelist);
|
||||
$this->view->ownerPairs = $ownerPairs;
|
||||
$this->view->spacePairs = array(0 => '') + array($kanban->space => $space->name) + $this->kanban->getSpacePairs($space->type);
|
||||
$this->view->kanban = $kanban;
|
||||
$this->view->type = $space->type;
|
||||
@@ -1844,20 +1844,21 @@ class kanban extends control
|
||||
/**
|
||||
* Ajax get contact users.
|
||||
*
|
||||
* @param string $field
|
||||
* @param int $contactListID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function ajaxGetContactUsers($contactListID)
|
||||
public function ajaxGetContactUsers($field, $contactListID)
|
||||
{
|
||||
$this->loadModel('user');
|
||||
$list = $contactListID ? $this->user->getContactListByID($contactListID) : '';
|
||||
|
||||
$users = $this->user->getPairs('devfirst|nodeleted|noclosed', $list ? $list->userList : '', $this->config->maxCount);
|
||||
|
||||
if(!$contactListID) return print(html::select('team[]', $users, '', "class='form-control chosen' multiple"));
|
||||
if(!$contactListID) return print(html::select($field . '[]', $users, '', "class='form-control picker-select' multiple"));
|
||||
|
||||
return print(html::select('team[]', $users, $list->userList, "class='form-control chosen' multiple"));
|
||||
return print(html::select($field . '[]', $users, $list->userList, "class='form-control picker-select' multiple"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1913,18 +1914,16 @@ class kanban extends control
|
||||
* @param int $spaceID
|
||||
* @param string $field team|whitelist|owner
|
||||
* @param string $selectedUser
|
||||
* @param string $space all|space
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function ajaxLoadSpaceUsers($spaceID, $field = '', $selectedUser = '')
|
||||
public function ajaxLoadUsers($spaceID, $field = '', $selectedUser = '', $type = 'space')
|
||||
{
|
||||
$space = $this->kanban->getSpaceById($spaceID);
|
||||
$accounts = '';
|
||||
if(!empty($space))
|
||||
{
|
||||
if($space->type == 'private' and !empty($space->whitelist)) $accounts = $space->whitelist;
|
||||
if($space->type != 'private') $accounts = trim($space->owner) . ',' . trim($space->team);
|
||||
}
|
||||
|
||||
if(!empty($space) and $field == 'owner' and $type != 'all') $accounts = trim($space->owner) . ',' . trim($space->team);
|
||||
|
||||
$users = $this->loadModel('user')->getPairs('noclosed|nodeleted', '', 0, $accounts);
|
||||
$multiple = in_array($field, array('team', 'whitelist')) ? 'multiple' : '';
|
||||
|
||||
@@ -8,13 +8,14 @@
|
||||
*/
|
||||
function setMailto(field, value)
|
||||
{
|
||||
var link = createLink('kanban', 'ajaxGetContactUsers', "listID=" + value);
|
||||
console.log(field);
|
||||
var link = createLink('kanban', 'ajaxGetContactUsers', 'field=' + field + '&listID=' + value);
|
||||
$.post(link, function(data)
|
||||
{
|
||||
$('#team').replaceWith(data);
|
||||
$('#team_chosen').remove();
|
||||
$('#team').chosen();
|
||||
$('.picker.picker-multi').remove();
|
||||
$('#' + field).replaceWith(data);
|
||||
$('#' + field + '_chosen').remove();
|
||||
$('#' + field).siblings('.picker').remove();
|
||||
$('#' + field).picker();
|
||||
})
|
||||
}
|
||||
|
||||
@@ -109,3 +110,22 @@ function changeType(type)
|
||||
$('#whitelistBox').addClass('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all users.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function loadAllUsers()
|
||||
{
|
||||
var link = createLink('kanban', 'ajaxLoadUsers', 'spaceID=0&field=owner&selectedUser=' + $('#owner').val() + "&type=all");
|
||||
|
||||
$.get(link, function(data)
|
||||
{
|
||||
$('#owner').replaceWith(data);
|
||||
$('#owner' + "_chosen").remove();
|
||||
$('#owner').next('.picker').remove();
|
||||
$('#owner').chosen();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ function changeValue(spaceID, type)
|
||||
function loadUsers(spaceID)
|
||||
{
|
||||
var field = spaceType == 'private' ? 'whitelist' : 'team';
|
||||
var link = createLink('kanban', 'ajaxLoadSpaceUsers', 'spaceID='+ spaceID + '&field=' + field + '&selectedUser=' + $('#' + field).val());
|
||||
var link = createLink('kanban', 'ajaxLoadUsers', 'spaceID='+ spaceID + '&field=' + field + '&selectedUser=' + $('#' + field).val());
|
||||
$.get(link, function(data)
|
||||
{
|
||||
$('#' + field).replaceWith(data);
|
||||
@@ -102,7 +102,7 @@ function loadUsers(spaceID)
|
||||
*/
|
||||
function loadOwners(spaceID)
|
||||
{
|
||||
var link = createLink('kanban', 'ajaxLoadSpaceUsers', 'spaceID='+ spaceID + '&field=owner&selectedUser=' + $('#owner').val());
|
||||
var link = createLink('kanban', 'ajaxLoadUsers', 'spaceID='+ spaceID + '&field=owner&selectedUser=' + $('#owner').val());
|
||||
|
||||
$.get(link, function(data)
|
||||
{
|
||||
|
||||
@@ -47,13 +47,19 @@
|
||||
<?php if($type != 'private'):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->kanban->owner;?></th>
|
||||
<td><?php echo html::select('owner', $users, isset($copyKanban->owner) ? $copyKanban->owner : '', "class='form-control chosen' data-drop_direction='down'");?></td>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::select('owner', $ownerPairs, isset($copyKanban->owner) ? $copyKanban->owner : '', "class='form-control chosen' data-drop_direction='down'");?>
|
||||
<span class='input-group-btn'><?php echo html::commonButton($lang->bug->allUsers, "class='btn btn-default' onclick='loadAllUsers()' data-toggle='tooltip'");?></span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->kanban->team;?></th>
|
||||
<td colspan='2'>
|
||||
<div class="input-group">
|
||||
<?php echo html::select('team[]', $users, isset($copyKanban->team) ? $copyKanban->team : '', "class='form-control picker-select' multiple data-dropDirection='bottom'");?>
|
||||
<?php echo $this->fetch('my', 'buildContactLists', 'dropdownName=team');?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -91,7 +97,12 @@
|
||||
<?php if($type == 'private'):?>
|
||||
<tr id="whitelistBox">
|
||||
<th><?php echo $lang->whitelist;?></th>
|
||||
<td><?php echo html::select('whitelist[]', $whitelist, isset($copyKanban->whitelist) ? $copyKanban->whitelist : '', 'class="form-control picker-select" multiple');?></td>
|
||||
<td colspan='2'>
|
||||
<div class="input-group">
|
||||
<?php echo html::select('whitelist[]', $users, isset($copyKanban->whitelist) ? $copyKanban->whitelist : '', 'class="form-control picker-select" multiple');?>
|
||||
<?php echo $this->fetch('my', 'buildContactLists', 'dropdownName=whitelist');?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
|
||||
@@ -36,13 +36,19 @@
|
||||
<?php if($type != 'private'):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->kanban->owner;?></th>
|
||||
<td><?php echo html::select('owner', $users, $kanban->owner, "class='form-control chosen' data-drop_direction='down'");?></td>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::select('owner', $ownerPairs, $kanban->owner, "class='form-control chosen' data-drop_direction='down'");?>
|
||||
<span class='input-group-btn'><?php echo html::commonButton($lang->bug->allUsers, "class='btn btn-default' onclick='loadAllUsers()' data-toggle='tooltip'");?></span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->kanban->team;?></th>
|
||||
<td colspan='2'>
|
||||
<div class="input-group">
|
||||
<?php echo html::select('team[]', $users, $kanban->team, "class='form-control picker-select' multiple data-dropDirection='bottom'");?>
|
||||
<?php echo $this->fetch('my', 'buildContactLists', 'dropdownName=team');?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -90,7 +96,12 @@
|
||||
<?php if($type == 'private'):?>
|
||||
<tr id="whitelistBox">
|
||||
<th><?php echo $lang->whitelist;?></th>
|
||||
<td><?php echo html::select('whitelist[]', $whitelist, $kanban->whitelist, 'class="form-control picker-select" multiple');?></td>
|
||||
<td colspan='2'>
|
||||
<div class="input-group">
|
||||
<?php echo html::select('whitelist[]', $users, $kanban->whitelist, 'class="form-control picker-select" multiple');?>
|
||||
<?php echo $this->fetch('my', 'buildContactLists', 'dropdownName=whitelist');?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user