Merge branch 'master' of git@github.com:easysoft/zentaopms

This commit is contained in:
wwccss
2013-07-22 17:11:42 +08:00
7 changed files with 52 additions and 12 deletions
+1 -1
View File
@@ -156,7 +156,7 @@ function loadProjectTasks(projectID)
*/
function loadProjectStories(projectID)
{
link = createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&productID=' + $('#product').val() + '&storyID=' + oldStoryID);
link = createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&productID=' + $('#product').val() + '&moduleID=0&storyID=' + oldStoryID);
$('#storyIdBox').load(link, function(){$('#story').chosen({no_results_text:noResultsMatch});});
}
+13 -5
View File
@@ -757,7 +757,6 @@ class story extends control
$this->loadModel('task');
$this->view->tasks = $this->task->getStoryTaskPairs($storyID, $projectID);
$this->display();
exit;
}
/**
@@ -769,10 +768,15 @@ class story extends control
* @access public
* @return void
*/
public function ajaxGetProjectStories($projectID, $productID = 0, $storyID = 0)
public function ajaxGetProjectStories($projectID, $productID = 0, $moduleID = 0, $storyID = 0)
{
$stories = $this->story->getProjectStoryPairs($projectID, $productID);
die(html::select('story', $stories, $storyID));
if($moduleID)
{
$moduleID = $this->loadModel('tree')->getStoryModule($moduleID);
$moduleID = $this->tree->getAllChildID($moduleID);
}
$stories = $this->story->getProjectStoryPairs($projectID, $productID, $moduleID);
die(html::select('story', $stories, $storyID, 'class=select-1 onchange=setPreview();'));
}
/**
@@ -786,7 +790,11 @@ class story extends control
*/
public function ajaxGetProductStories($productID, $moduleID = 0, $storyID = 0)
{
if($moduleID) $moduleID = $this->loadModel('tree')->getAllChildID($moduleID);
if($moduleID)
{
$moduleID = $this->loadModel('tree')->getStoryModule($moduleID);
$moduleID = $this->tree->getAllChildID($moduleID);
}
$stories = $this->story->getProductStoryPairs($productID, $moduleID);
die(html::select('story', $stories, $storyID, "class=''"));
}
+5 -3
View File
@@ -1049,12 +1049,13 @@ class storyModel extends model
/**
* Get stories pairs of a project.
*
* @param int $projectID
* @param int $productID
* @param int $projectID
* @param int $productID
* @param array|string $moduleIds
* @access public
* @return array
*/
public function getProjectStoryPairs($projectID = 0, $productID = 0)
public function getProjectStoryPairs($projectID = 0, $productID = 0, $moduleIds = 0)
{
$stories = $this->dao->select('t2.id, t2.title, t2.module, t2.pri, t2.estimate, t3.name AS product')
->from(TABLE_PROJECTSTORY)->alias('t1')
@@ -1065,6 +1066,7 @@ class storyModel extends model
->where('t1.project')->eq((int)$projectID)
->andWhere('t2.deleted')->eq(0)
->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi()
->beginIF($moduleIds)->andWhere('t2.module')->in($moduleIds)->fi()
->fetchAll();
if(!$stories) return array();
return $this->formatStories($stories);
+12
View File
@@ -69,6 +69,18 @@ function setAfter()
}
}
function setStories(moduleID, projectID, productID)
{
link = createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&productID=' + productID + '&moduleID=' + moduleID);
$.get(link, function(stories)
{
if(!stories) stories = '<select id="story" name="story"></select>';
$('#story').replaceWith(stories);
$('#story_chzn').remove();
$("#story").chosen({no_results_text: ''});
});
}
$(document).ready(function()
{
setPreview();
+1 -1
View File
@@ -49,7 +49,7 @@ function loadModuleMenu(projectID)
*/
function loadProjectStories(projectID)
{
link = createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&moduleId=0&storyID=' + oldStoryID);
link = createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&productID=0&moduleID=0&storyID=' + oldStoryID);
$('#storyIdBox').load(link, function(){$('#story').chosen();});
}
+2 -2
View File
@@ -35,8 +35,8 @@
</tr>
<tr>
<th class='rowhead'><?php echo $lang->task->module;?></th>
<td><span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $task->module, "class='select-3'");?></span></td>
</tr>
<td><span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $task->module, "class='select-3' onchange='setStories(this.value,$project->id,0)'");?></span></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->task->assignedTo;?></th>
<td><?php echo html::select('assignedTo[]', $members, $task->assignedTo, 'class=select-3');?></td>
+18
View File
@@ -803,6 +803,24 @@ class treeModel extends model
return $this->dao->select('name')->from(TABLE_PRODUCT)->where('id')->eq($module->root)->fetch();
}
/**
* Get the module that its type == 'story'.
*
* @param int $moduleID
* @access public
* @return void
*/
public function getStoryModule($moduleID)
{
$module = $this->dao->select('id,type,parent')->from(TABLE_MODULE)->where('id')->eq($moduleID)->fetch();
while($module->id and $module->type != 'story')
{
$module = $this->dao->select('id,type,parent')->from(TABLE_MODULE)->where('id')->eq($module->parent)->fetch();
}
return $module->id;
}
/**
* Update modules' order.
*