* adjust code for linkStory method and change the style for edit method.

This commit is contained in:
chenfeiCF
2016-03-11 06:55:17 +08:00
parent 5f975e60ba
commit 1e22ef4ea7
3 changed files with 30 additions and 47 deletions

View File

@@ -916,52 +916,37 @@ class story extends control
*/
public function linkStory($storyID, $type = '', $stories = '', $browseType = '', $param = 0)
{
/* Get story, product, and products. */
$story = $this->story->getById($storyID);
$product = $this->product->getById($story->product);
$products = $this->product->getPairs();
/* Set menu. */
$this->product->setMenu($products, $product->id, $story->branch);
$queryID = ($browseType == 'bySearch') ? (int)$param : 0;
$browseLink = $this->createLink('story', 'edit', "storyID=$storyID");
$branches = $product->type != 'normal' ? $this->loadModel('branch')->getPairs($story->product) : array();
$this->commonAction($storyID);
/* Link stories. */
if(!empty($_POST))
{
$stories = $this->story->linkStories($storyID, $type, $stories);
if(isonlybody()) die(js::closeModal('parent.parent', '', "function(){parent.parent.loadLinkedStories('$storyID', '$type', '$stories')}"));
die(js::locate($browseLink, 'parent'));
die(js::locate($this->createLink('story', 'edit', "storyID=$storyID"), 'parent'));
}
/* Get story, product, products, and queryID. */
$story = $this->story->getById($storyID);
$products = $this->product->getPairs();
$queryID = ($browseType == 'bySearch') ? (int)$param : 0;
/* Build search form. */
$actionURL = $this->createLink('story', 'linkStory', "storyID=$storyID&type=$type&stories=$stories&browseType=bySearch&queryID=myQueryID", '', true);
$this->loadModel('product')->buildSearchForm($story->product, $products, $queryID, $actionURL);
$this->loadModel('search')->setSearchParams($this->config->product->search);
/* Get stories to link. */
if($browseType == 'bySearch')
{
$allStories = $this->story->getBySearch($story->product, $queryID, 'id', null);
}
else
{
$allStories = $this->story->getProductStories($story->product);
}
$allStories = array();
if($browseType == 'bySearch') $allStories = $this->story->getBySearch($story->product, $queryID, 'id', null);
/* Assign. */
$this->view->title = $this->lang->story->linkStory;
$this->view->position[] = html::a($browseLink, $story->title);
$this->view->position[] = $this->lang->story->linkStory;
$this->view->product = $product;
$this->view->products = $products;
$this->view->branches = $branches;
$this->view->type = $type;
$this->view->story = $story;
$this->view->allStories = $allStories;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->title = $this->lang->story->linkStory . "STORY" . $this->lang->colon .$this->lang->story->linkStory;
$this->view->position[] = $this->lang->story->linkStory;
$this->view->type = $type;
$this->view->allStories = $allStories;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
}

View File

@@ -1,2 +1,3 @@
.col-side .chosen-container .chosen-drop {width: 216px!important}
.col-side .chosen-container {width: 218px!important}
#linkStoriesBox > .list-unstyled > li ,#childStoriesBox > .list-unstyled > li {margin-left:-56px}

View File

@@ -14,13 +14,15 @@
<div class='container'>
<div id='titlebar'>
<div class='heading' style='margin-bottom: 15px'>
<span class='prefix'><?php echo html::icon($lang->icons['story']);?></span>
<strong><small><?php echo html::icon($lang->icons['link']);?></small> <?php echo $lang->story->linkStory;?></strong>
<span class='prefix'><?php echo html::icon($lang->icons['story']);?> <strong><?php echo $story->id;?></strong></span>
<strong><?php echo html::a($this->createLink('story', 'view', "storyID=$story->id"), $story->title);?></strong>
<small><?php echo $lang->story->linkStory;?></small>
</div>
<div id='querybox' class='show'></div>
</div>
<form method='post' class='form-condensed' target='hiddenwin' id='linkStoryForm'>
<table class='table table-form'>
<table class='table table-condensed table-hover table-striped tablesorter table-fixed' id='storyList'>
<?php if($allStories):?>
<thead>
<tr>
<th class='w-id'><?php echo $lang->idAB;?></th>
@@ -28,9 +30,6 @@
<th><?php echo $lang->story->product;?></th>
<th><?php echo $lang->story->title;?></th>
<th><?php echo $lang->story->plan;?></th>
<?php if($product->type != 'normal'):?>
<th><?php echo $lang->product->branchName[$product->type];?></th>
<?php endif;?>
<th class='w-user'><?php echo $lang->openedByAB;?></th>
<th class='w-80px'><?php echo $lang->story->estimateAB;?></th>
</tr>
@@ -39,20 +38,17 @@
<?php $storyCount = 0;?>
<?php foreach($allStories as $storyDetail):?>
<?php if(in_array($storyDetail->id, explode(',', $story->$type))) continue;?>
<?php if($storyDetail->id == $story->id) continue;?>
<?php $storyLink = $this->createLink('story', 'view', "storyID=$storyDetail->id");?>
<tr class='text-center'>
<td class='text-left'>
<input type='checkbox' name='stories[]' value='<?php echo $storyDetail->id;?>'/>
<input type='hidden' name='products[]' value='<?php echo $storyDetail->product;?>'/>
<?php echo html::a($storyLink, sprintf('%03d', $storyDetail->id));?>
</td>
<td><span class='<?php echo 'pri' . zget($lang->story->priList, $storyDetail->pri, $storyDetail->pri)?>'><?php echo zget($lang->story->priList, $storyDetail->pri, $storyDetail->pri);?></span></td>
<td><?php echo html::a($this->createLink('product', 'browse', "productID=$storyDetail->product&branch=$storyDetail->branch"), $products[$storyDetail->product], '_blank');?></td>
<td class='text-left nobr' title="<?php echo $storyDetail->title?>"><?php echo html::a($storyLink, $storyDetail->title, '_blank');?></td>
<td><?php echo $storyDetail->planTitle;?></td>
<?php if($product->type != 'normal'):?>
<td><?php if(isset($branches[$storyDetail->branch])) echo $branches[$storyDetail->branch];?></td>
<?php endif;?>
<td><?php echo $users[$storyDetail->openedBy];?></td>
<td><?php echo $storyDetail->estimate;?></td>
</tr>
@@ -60,14 +56,15 @@
<?php endforeach;?>
</tbody>
<tfoot>
<tr>
<td colspan='<?php echo $product->type == 'normal' ? '7' :'8';?>' class='text-left'>
<div class='table-actions clearfix'>
<?php if($storyCount) echo html::selectButton() . html::submitButton();?>
</div>
</td>
</tr>
<tr>
<td colspan='7' class='text-left'>
<div class='table-actions clearfix'>
<?php if($storyCount) echo html::selectButton() . html::submitButton();?>
</div>
</td>
</tr>
</tfoot>
<?php endif;?>
</table>
</form>
</div>