* finish task#1559.
This commit is contained in:
@@ -6,6 +6,6 @@ $(function()
|
||||
|
||||
function changeAction(formName, actionName, actionLink)
|
||||
{
|
||||
if(actionName == 'batchClose') $('#' + formName).attr('target', 'hiddenwin');
|
||||
if(formName =='myTaskForm' && actionName == 'batchClose') $('#' + formName).attr('target', 'hiddenwin');
|
||||
$('#' + formName).attr('action', actionLink).submit();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
}
|
||||
if($canBatchClose)
|
||||
{
|
||||
$actionLink = $this->createLink('story', 'batchClose', "from=productBrowse&productID=$productID&projectID=0&orderBy=$orderBy");
|
||||
$actionLink = $this->createLink('story', 'batchClose', "productID=$productID&projectID=0");
|
||||
echo html::commonButton($lang->close, "onclick=\"changeAction('productStoryForm', 'batchClose', '$actionLink')\"");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
}
|
||||
if($canBatchClose)
|
||||
{
|
||||
$actionLink = $this->createLink('story', 'batchClose', "from=projectStory&productID=0&projectID=$project->id&orderBy=$orderBy");
|
||||
$actionLink = $this->createLink('story', 'batchClose', "productID=0&projectID=$project->id");
|
||||
echo html::commonButton($lang->close, "onclick=\"changeAction('projectStoryForm', 'batchClose', '$actionLink')\"");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ $config->story->affectedFixedNum = 7;
|
||||
$config->story->batchEdit = new stdclass();
|
||||
$config->story->batchEdit->columns = 10;
|
||||
|
||||
$config->story->batchClose = new stdclass();
|
||||
$config->story->batchClose->columns = 10;
|
||||
|
||||
$config->story->create = new stdclass();
|
||||
$config->story->edit = new stdclass();
|
||||
$config->story->change = new stdclass();
|
||||
|
||||
+59
-74
@@ -319,7 +319,7 @@ class story extends control
|
||||
$stories = $this->dao->select('*')->from(TABLE_STORY)->where('id')->in($storyIDList)->fetchAll('id');
|
||||
|
||||
/* The stories of a product. */
|
||||
if($productID and !$projectID)
|
||||
if($productID)
|
||||
{
|
||||
$this->product->setMenu($this->product->getPairs('nodeleted'), $productID);
|
||||
$product = $this->product->getByID($productID);
|
||||
@@ -327,7 +327,7 @@ class story extends control
|
||||
|
||||
}
|
||||
/* The stories of a project. */
|
||||
elseif($productID and $projectID)
|
||||
elseif($projectID)
|
||||
{
|
||||
$this->lang->story->menu = $this->lang->project->menu;
|
||||
$this->project->setMenu($this->project->getPairs('nodeleted'), $projectID);
|
||||
@@ -337,7 +337,7 @@ class story extends control
|
||||
$this->view->title = $project->name . $this->lang->colon . $this->lang->story->batchEdit;
|
||||
}
|
||||
/* The stories of my. */
|
||||
elseif(!$productID and !$projectID)
|
||||
else
|
||||
{
|
||||
$this->lang->story->menu = $this->lang->my->menu;
|
||||
$this->lang->set('menugroup.story', 'my');
|
||||
@@ -612,91 +612,76 @@ class story extends control
|
||||
/**
|
||||
* Batch close story.
|
||||
*
|
||||
* @param string $from productBrowse|projectStory|storyBatchClose
|
||||
* @param int $productID
|
||||
* @param int $projectID
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchClose($from = '', $productID = 0, $projectID = 0, $orderBy = '')
|
||||
public function batchClose($productID = 0, $projectID = 0)
|
||||
{
|
||||
/* Get post data for product-Browse or project-Story. */
|
||||
if($from == 'productBrowse' or $from == 'projectStory')
|
||||
if($this->post->closedReasons)
|
||||
{
|
||||
/* Init vars. */
|
||||
$editedStories = array();
|
||||
$storyIDList = $this->post->storyIDList ? $this->post->storyIDList : array();
|
||||
$columns = 4;
|
||||
$showSuhosinInfo = false;
|
||||
$allChanges = $this->story->batchClose();
|
||||
|
||||
/* Get all stories. */
|
||||
if(!$projectID)
|
||||
if($allChanges)
|
||||
{
|
||||
/* Set menu. */
|
||||
$this->product->setMenu($this->product->getPairs('nodeleted'), $productID);
|
||||
$allStories = $this->dao->select('*')->from(TABLE_STORY)->where($this->session->storyQueryCondition)->orderBy($orderBy)->fetchAll('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->lang->story->menu = $this->lang->project->menu;
|
||||
$this->lang->story->menuOrder = $this->lang->project->menuOrder;
|
||||
$this->project->setMenu($this->project->getPairs('nodeleted'), $projectID);
|
||||
$this->lang->set('menugroup.story', 'project');
|
||||
$allStories = $this->story->getProjectStories($projectID, $orderBy);
|
||||
}
|
||||
if(!$allStories) $allStories = array();
|
||||
|
||||
/* Initialize the stories whose need to edited. */
|
||||
foreach($allStories as $story) if(in_array($story->id, $storyIDList)) $editedStories[$story->id] = $story;
|
||||
|
||||
/* Judge whether the editedStories is too large. */
|
||||
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting(count($editedStories), $columns);
|
||||
|
||||
/* Set the sessions. */
|
||||
$this->app->session->set('showSuhosinInfo', $showSuhosinInfo);
|
||||
|
||||
/* Assign. */
|
||||
if(!$projectID)
|
||||
{
|
||||
$product = $this->product->getByID($productID);
|
||||
$this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchClose;
|
||||
}
|
||||
else
|
||||
{
|
||||
$project = $this->project->getByID($projectID);
|
||||
$this->view->title = $project->name . $this->lang->colon . $this->lang->story->batchClose;
|
||||
}
|
||||
if($showSuhosinInfo) $this->view->suhosinInfo = $this->lang->suhosinInfo;
|
||||
$this->view->position[] = $this->lang->story->common;
|
||||
$this->view->position[] = $this->lang->story->batchClose;
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story');
|
||||
$this->view->plans = $this->loadModel('productplan')->getPairs($productID);
|
||||
$this->view->productID = $productID;
|
||||
$this->view->editedStories = $editedStories;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
/* Get post data for story-batchClose. */
|
||||
elseif($from == 'storyBatchClose')
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
|
||||
$allChanges = $this->story->batchClose();
|
||||
|
||||
if($allChanges)
|
||||
foreach($allChanges as $storyID => $changes)
|
||||
{
|
||||
foreach($allChanges as $storyID => $changes)
|
||||
{
|
||||
$actionID = $this->action->create('story', $storyID, 'Closed', $this->post->comments[$storyID], ucfirst($this->post->closedReasons[$storyID]));
|
||||
$this->action->logHistory($actionID);
|
||||
$this->sendMail($storyID, $actionID);
|
||||
}
|
||||
$actionID = $this->action->create('story', $storyID, 'Closed', $this->post->comments[$storyID], ucfirst($this->post->closedReasons[$storyID]));
|
||||
$this->action->logHistory($actionID);
|
||||
$this->sendMail($storyID, $actionID);
|
||||
}
|
||||
}
|
||||
die(js::locate($this->session->storyList, 'parent'));
|
||||
}
|
||||
|
||||
$storyIDList = $this->post->storyIDList ? $this->post->storyIDList : die(js::locate($this->session->storyList, 'parent'));
|
||||
|
||||
/* Get edited stories. */
|
||||
$stories = $this->dao->select('*')->from(TABLE_STORY)->where('id')->in($storyIDList)->fetchAll('id');
|
||||
|
||||
/* The stories of a product. */
|
||||
if($productID)
|
||||
{
|
||||
$this->product->setMenu($this->product->getPairs('nodeleted'), $productID);
|
||||
$product = $this->product->getByID($productID);
|
||||
$this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchClose;
|
||||
}
|
||||
/* The stories of a project. */
|
||||
elseif($projectID)
|
||||
{
|
||||
$this->lang->story->menu = $this->lang->project->menu;
|
||||
$this->lang->story->menuOrder = $this->lang->project->menuOrder;
|
||||
$this->project->setMenu($this->project->getPairs('nodeleted'), $projectID);
|
||||
$this->lang->set('menugroup.story', 'project');
|
||||
$project = $this->project->getByID($projectID);
|
||||
$this->view->title = $project->name . $this->lang->colon . $this->lang->story->batchClose;
|
||||
}
|
||||
/* The stories of my. */
|
||||
else
|
||||
{
|
||||
$this->lang->story->menu = $this->lang->my->menu;
|
||||
$this->lang->set('menugroup.story', 'my');
|
||||
$this->lang->story->menuOrder = $this->lang->my->menuOrder;
|
||||
$this->loadModel('my')->setMenu();
|
||||
$this->view->title = $this->lang->story->batchEdit;
|
||||
}
|
||||
|
||||
/* Judge whether the editedStories is too large and set session. */
|
||||
$showSuhosinInfo = false;
|
||||
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting(count($stories), $this->config->story->batchClose->columns);
|
||||
$this->app->session->set('showSuhosinInfo', $showSuhosinInfo);
|
||||
if($showSuhosinInfo) $this->view->suhosinInfo = $this->lang->suhosinInfo;
|
||||
|
||||
$this->view->position[] = $this->lang->story->common;
|
||||
$this->view->position[] = $this->lang->story->batchClose;
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story');
|
||||
$this->view->plans = $this->loadModel('productplan')->getPairs($productID);
|
||||
$this->view->productID = $productID;
|
||||
$this->view->stories = $stories;
|
||||
$this->view->storyIDList = $storyIDList;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,37 +22,37 @@
|
||||
<th class='w-120px'><?php echo $lang->story->closedReason;?></th>
|
||||
<th class='w-p30 '> <?php echo $lang->story->comment;?></th>
|
||||
</tr>
|
||||
<?php foreach($editedStories as $story):?>
|
||||
<?php foreach($storyIDList as $storyID):?>
|
||||
<tr class='a-center'>
|
||||
<td><?php echo $story->id . html::hidden("storyIDList[$story->id]", $story->id);?></td>
|
||||
<td class='a-left'><?php echo $story->title;?></td>
|
||||
<td><?php echo $lang->story->statusList[$story->status];?></td>
|
||||
<td><?php echo $storyID . html::hidden("storyIDList[$storyID]", $storyID);?></td>
|
||||
<td class='a-left'><?php echo $stories[$storyID]->title;?></td>
|
||||
<td><?php echo $lang->story->statusList[$stories[$storyID]->status];?></td>
|
||||
|
||||
<?php if($story->status != 'closed'):?>
|
||||
<?php if($stories[$storyID]->status != 'closed'):?>
|
||||
<td>
|
||||
<div class='f-left'>
|
||||
<?php
|
||||
if($story->status == 'draft') unset($this->lang->story->reasonList['cancel']);
|
||||
echo html::select("closedReasons[$story->id]", $lang->story->reasonList, 'done', "class=w-70px onchange=setDuplicateAndChild(this.value,$story->id)");
|
||||
if($stories[$storyID]->status == 'draft') unset($this->lang->story->reasonList['cancel']);
|
||||
echo html::select("closedReasons[$storyID]", $lang->story->reasonList, 'done', "class=w-70px onchange=setDuplicateAndChild(this.value,$storyID)");
|
||||
?>
|
||||
</div>
|
||||
<div class='f-left' id='<?php echo 'duplicateStoryBox' . $story->id;?>' <?php if($story->closedReason != 'duplicate') echo "style='display:none'";?>>
|
||||
<?php echo html::input("duplicateStoryIDList[$story->id]", '', "class=w-30px placeholder='{$lang->idAB}'");?>
|
||||
<div class='f-left' id='<?php echo 'duplicateStoryBox' . $storyID;?>' <?php if($stories[$storyID]->closedReason != 'duplicate') echo "style='display:none'";?>>
|
||||
<?php echo html::input("duplicateStoryIDList[$storyID]", '', "class=w-30px placeholder='{$lang->idAB}'");?>
|
||||
</div>
|
||||
|
||||
<div class='f-left' id='<?php echo 'childStoryBox' . $story->id;?>' <?php if($story->closedReason != 'subdivided') echo "style='display:none'";?>>
|
||||
<?php echo html::input("childStoriesIDList[$story->id]", '', "class=w-30px placeholder='{$lang->idAB}'");?>
|
||||
<div class='f-left' id='<?php echo 'childStoryBox' . $storyID;?>' <?php if($stories[$storyID]->closedReason != 'subdivided') echo "style='display:none'";?>>
|
||||
<?php echo html::input("childStoriesIDList[$storyID]", '', "class=w-30px placeholder='{$lang->idAB}'");?>
|
||||
</div>
|
||||
</td>
|
||||
<?php else:?>
|
||||
<td>
|
||||
<div class='f-left'>
|
||||
<?php echo html::select("closedReasons[$story->id]", $lang->story->reasonList, $story->closedReason, 'class="w-70px" disabled="disabled"');?>
|
||||
<?php echo html::select("closedReasons[$storyID]", $lang->story->reasonList, $stories[$storyID]->closedReason, 'class="w-70px" disabled="disabled"');?>
|
||||
</div>
|
||||
</td>
|
||||
<?php endif;?>
|
||||
|
||||
<td><?php echo html::input("comments[$story->id]", '', "class='area-1'");?></td>
|
||||
<td><?php echo html::input("comments[$storyID]", '', "class='area-1'");?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php if(isset($suhosinInfo)):?>
|
||||
|
||||
Reference in New Issue
Block a user