* when first load, make sure dev users at first.

* when a project selected, make sure members of this project at first.
This commit is contained in:
wangchunsheng
2012-12-18 12:28:45 +00:00
parent 9a4993d97d
commit e9f357731b
3 changed files with 53 additions and 18 deletions

View File

@@ -213,7 +213,7 @@ class bug extends control
*/
public function create($productID, $extras = '')
{
$this->view->users = $this->user->getPairs('nodeleted');
$this->view->users = $this->user->getPairs('nodeleted,devfirst');
if(empty($this->products)) $this->locate($this->createLink('product', 'create'));
if(!empty($_POST))
@@ -840,6 +840,23 @@ class bug extends control
die($owner);
}
/**
* AJAX: get assignedTo list, make sure the members of the project at the first.
*
* @param int $projectID
* @param string $selectedUser
* @access public
* @return string
*/
public function ajaxLoadAssignedTo($projectID, $selectedUser = '')
{
$allUsers = $this->loadModel('user')->getPairs('nodeleted, devfirst');
$projectMembers = $this->loadModel('project')->getTeamMemberPairs($projectID);
$assignedToList = array_merge($projectMembers, $allUsers);
die(html::select('assignedTo', $assignedToList, $selectedUser, 'class="select-3"'));
}
/**
* Send email.
*

View File

@@ -82,6 +82,7 @@ function loadProjectRelated(projectID)
loadProjectTasks(projectID);
loadProjectStories(projectID);
loadProjectBuilds(projectID);
loadAssignedTo(projectID);
}
else
{
@@ -118,18 +119,16 @@ function loadProjectStories(projectID)
}
/**
* Set the assignedTo field.
* Load assginedTo list, make use the members of this project at first.
*
* @param int $projectID
* @access public
* @return void
*/
function setAssignedTo()
function loadAssignedTo(projectID)
{
link = createLink('bug', 'ajaxGetModuleOwner', 'moduleID=' + $('#module').val() + '&productID=' + $('#product').val());
$.get(link, function(owner)
{
$('#assignedTo').val(owner);
});
link = createLink('bug', 'ajaxLoadAssignedTo', 'projectID=' + projectID + '&selectedUser=' + $('#assignedTo').val());
$('#assignedToBox').load(link)
}
/**
@@ -147,18 +146,29 @@ function loadProjectBuilds(projectID)
$('#buildBox').load(link);
}
$(function() {
$("#story").chosen({no_results_text:noResultsMatch});
$("#task").chosen({no_results_text:noResultsMatch});
$("#mailto").autocomplete(userList, { multiple: true, mustMatch: true});
setAssignedTo();
})
/**
* Set the assignedTo field.
*
* @access public
* @return void
*/
function setAssignedTo()
{
link = createLink('bug', 'ajaxGetModuleOwner', 'moduleID=' + $('#module').val() + '&productID=' + $('#product').val());
$.get(link, function(owner)
{
$('#assignedTo').val(owner);
});
}
/* Save template. */
KindEditor.plugin('savetemplate', function(K) {
KindEditor.plugin('savetemplate', function(K)
{
var self = this, name = 'savetemplate';
self.plugin.savetemplate = {
click: function(id) {
self.plugin.savetemplate =
{
click: function(id)
{
content = self.html();
jPrompt(setTemplateTitle, '','', function(r)
{
@@ -189,3 +199,11 @@ function deleteTemplate(templateID)
hiddenwin.location.href = createLink('bug', 'deleteTemplate', 'templateID=' + templateID);
$('#tplBox' + templateID).addClass('hidden');
}
$(function()
{
$("#story").chosen({no_results_text:noResultsMatch});
$("#task").chosen({no_results_text:noResultsMatch});
$("#mailto").autocomplete(userList, { multiple: true, mustMatch: true});
setAssignedTo();
})

View File

@@ -42,7 +42,7 @@ userList = "<?php echo join(',', array_keys($users));?>".split(',');
</tr>
<tr>
<th class='rowhead'><nobr><?php echo $lang->bug->lblAssignedTo;?></nobr></th>
<td> <?php echo html::select('assignedTo', $users, $assignedTo, 'class=select-3');?></td>
<td><span id='assignedToBox'><?php echo html::select('assignedTo', $users, $assignedTo, 'class=select-3');?></span></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->title;?></th>