This commit is contained in:
滔哥
2017-10-31 21:15:18 +08:00
19 changed files with 201 additions and 127 deletions
-1
View File
@@ -196,7 +196,6 @@ $lang->product->menu->roadmap = 'Roadmap|product|roadmap|productID=%s';
$lang->product->menu->doc = array('link' => 'Document|doc|objectLibs|type=product&objectID=%s&from=product', 'subModule' => 'doc');
$lang->product->menu->branch = '@branch@|branch|manage|productID=%s';
$lang->product->menu->module = 'Module|tree|browse|productID=%s&view=story';
$lang->product->menu->category = 'Category|tree|browse|productID=%s&view=category';
$lang->product->menu->view = array('link' => 'Overview|product|view|productID=%s', 'alias' => 'edit');
$lang->product->menu->project = "{$lang->projectCommon}|product|project|status=all&productID=%s";
$lang->product->menu->create = array('link' => "<i class='icon-plus'></i>&nbsp;Add{$lang->productCommon}|product|create", 'float' => 'right');
-2
View File
@@ -196,7 +196,6 @@ $lang->product->menu->roadmap = '路线图|product|roadmap|productID=%s';
$lang->product->menu->doc = array('link' => '文档|doc|objectLibs|type=product&objectID=%s&from=product', 'subModule' => 'doc');
$lang->product->menu->branch = '@branch@|branch|manage|productID=%s';
$lang->product->menu->module = '模块|tree|browse|productID=%s&view=story';
$lang->product->menu->category = '目录|tree|browse|productID=%s&view=category';
$lang->product->menu->view = array('link' => '概况|product|view|productID=%s', 'alias' => 'edit');
$lang->product->menu->project = "{$lang->projectCommon}|product|project|status=all&productID=%s";
$lang->product->menu->create = array('link' => "<i class='icon-plus'></i>&nbsp;添加{$lang->productCommon}|product|create", 'float' => 'right');
@@ -788,7 +787,6 @@ if(isset($config->global->flow) and $config->global->flow == 'onlyTest')
unset($lang->product->menu->roadmap);
unset($lang->product->menu->doc);
unset($lang->product->menu->module);
unset($lang->product->menu->category);
unset($lang->product->menu->index);
$lang->product->menu->build = array('link' => '版本|product|build', 'subModule' => 'build');
+1 -1
View File
@@ -222,7 +222,7 @@ function toggleAcl(acl)
$(document).ready(function()
{
$('[data-id="create"] a').modalTrigger({type: 'iframe', width: 800});
$('[data-id="create"] a[href*=doc][href*=createLib]').modalTrigger({type: 'iframe', width: 800});
$('#modulemenu .nav li').removeClass('active');
if(typeof(type) != 'undefined') $('#modulemenu .nav li[data-id="' + type + '"]').addClass('active');
+25 -7
View File
@@ -394,6 +394,7 @@ class product extends control
$this->view->actions = $this->loadModel('action')->getList('product', $productID);
$this->view->users = $this->user->getPairs('noletter');
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->categories = $this->loadModel('tree')->getOptionMenu($rootID = 0, $type = 'category');
$this->display();
}
@@ -584,7 +585,23 @@ class product extends control
$productsPinyin = common::convert2Pinyin($productPairs);
foreach($products as $key => $product) $product->key = $productsPinyin[$product->name];
$this->view->products = $products;
/* Sort products as categories' order first. */
$categories = $this->loadModel('tree')->getOptionMenu($rootID = 0, $type = 'category');
$productList = array();
foreach($categories as $id => $category)
{
foreach($products as $product)
{
if($product->category == $id)
{
$product->name = ltrim($category. '/' . $product->name, '/');
$productList[] = $product;
}
}
}
$this->view->products = $productList;
$this->display();
}
@@ -631,6 +648,7 @@ class product extends control
* All product.
*
* @param int $productID
* @param int $category
* @param string $status
* @param string $orderBy
* @param int $recTotal
@@ -639,7 +657,7 @@ class product extends control
* @access public
* @return void
*/
public function all($productID = 0, $status = 'noclosed', $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 10, $pageID = 1)
public function all($productID = 0, $category = 0, $status = 'noclosed', $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 10, $pageID = 1)
{
$this->session->set('productList', $this->app->getURI(true));
$productID = $this->product->saveState($productID, $this->products);
@@ -652,13 +670,13 @@ class product extends control
$this->app->loadLang('my');
$this->view->title = $this->lang->product->allProduct;
$this->view->position[] = $this->lang->product->allProduct;
$this->view->productStats = $this->product->getStats($orderBy, $pager, $status);
$this->view->productStats = $this->product->getStats($orderBy, $pager, $status, $category);
$this->view->categoryTree = $this->loadModel('tree')->getTreeMenu(0, $viewType = 'category', $startModuleID = 0, array('treeModel', 'createCategoryLink'), array('productID' => $productID, 'status' => $status));
$this->view->productID = $productID;
$this->view->pager = $pager;
$this->view->recTotal = $pager->recTotal;
$this->view->recPerPage = $pager->recPerPage;
$this->view->orderBy = $orderBy;
$this->view->category = $category;
$this->view->status = $status;
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->display();
}
+10 -4
View File
@@ -181,6 +181,8 @@ class productModel extends model
{
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProduct();
$product = $this->dao->findById($productID)->from(TABLE_PRODUCT)->fetch();
if(!$product) return false;
return $this->loadModel('file')->replaceImgURL($product, 'desc');
}
@@ -201,13 +203,15 @@ class productModel extends model
*
* @param string $status
* @param int $limit
* @param int $category
* @access public
* @return array
*/
public function getList($status = 'all', $limit = 0)
public function getList($status = 'all', $limit = 0, $category = 0)
{
return $this->dao->select('*')->from(TABLE_PRODUCT)
->where('deleted')->eq(0)
->beginIF($category > 0)->andWhere('category')->eq($category)->fi()
->beginIF($status == 'noclosed')->andWhere('status')->ne('closed')->fi()
->beginIF($status != 'all' and $status != 'noclosed' and $status != 'involved')->andWhere('status')->in($status)->fi()
->beginIF($status == 'involved')
@@ -664,17 +668,19 @@ class productModel extends model
* Get product stats.
*
* @param string $orderBy
* @param int $pager
* @param object $pager
* @param string $status
* @param int $category
* @access public
* @return array
*/
public function getStats($orderBy = 'order_desc', $pager = null, $status = 'noclosed')
public function getStats($orderBy = 'order_desc', $pager = null, $status = 'noclosed', $category = 0)
{
$this->loadModel('report');
$this->loadModel('story');
$this->loadModel('bug');
$products = $this->getList($status);
$products = $this->getList($status, $limit = 0, $category);
foreach($products as $productID => $product)
{
if(!$this->checkPriv($product)) unset($products[$productID]);
+92 -75
View File
@@ -20,89 +20,106 @@
<?php echo html::a($this->createLink('product', 'create'), "<i class='icon-plus'></i> " . $lang->product->create,'', "class='btn'") ?>
</div>
<ul class='nav'>
<?php echo "<li id='noclosedTab'>" . html::a(inlink("all", "productID=$productID&status=noclosed"), $lang->product->unclosed) . '</li>';?>
<?php echo "<li id='closedTab'>" . html::a(inlink("all", "productID=$productID&status=closed"), $lang->product->statusList['closed']) . '</li>';?>
<?php echo "<li id='allTab'>" . html::a(inlink("all", "productID=$productID&status=all"), $lang->product->allProduct) . '</li>';?>
<?php echo "<li id='noclosedTab'>" . html::a(inlink("all", "productID=$productID&category=&status=noclosed"), $lang->product->unclosed) . '</li>';?>
<?php echo "<li id='closedTab'>" . html::a(inlink("all", "productID=$productID&category=&status=closed"), $lang->product->statusList['closed']) . '</li>';?>
<?php echo "<li id='allTab'>" . html::a(inlink("all", "productID=$productID&category=&status=all"), $lang->product->allProduct) . '</li>';?>
</ul>
</div>
<div class='block' id='productbox'>
<?php if(empty($productStats)):?>
<div class='container mw-500px'>
<div class='alert'>
<i class='icon icon-info-sign'></i>
<div class='content'>
<h5><?php echo $lang->my->home->noProductsTip ?></h5>
<?php echo html::a($this->createLink('product', 'create'), "<i class='icon-plus'></i> " . $lang->my->home->createProduct,'', "class='btn btn-success'") ?>
<div class='side' id='treebox'>
<a class='side-handle' data-id='productTree'><i class='icon-caret-left'></i></a>
<div class='side-body'>
<div class='panel panel-sm'>
<div class='panel-heading nobr'><?php echo html::icon($lang->icons['product']);?> <strong><?php echo $lang->product->category;?></strong></div>
<div class='panel-body'>
<?php echo $categoryTree;?>
<div class='text-right'>
<?php common::printLink('tree', 'browse', "rootID=&view=category", $lang->tree->manageCategory);?>
</div>
</div>
</div>
</div>
</div>
<?php else:?>
<?php $canOrder = (common::hasPriv('product', 'updateOrder') and strpos($orderBy, 'order') !== false)?>
<form method='post' action='<?php echo inLink('batchEdit', "productID=$productID");?>' id='productsForm'>
<table class='table table-condensed table-hover table-striped tablesorter table-datatable table-selectable' id='productList'>
<?php $vars = "productID=$productID&status=$status&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<thead>
<tr>
<th class='w-id'><?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th><?php common::printOrderLink('name', $orderBy, $vars, $lang->product->name);?></th>
<th class='w-80px'><?php echo $lang->product->activeStories;?></th>
<th class='w-80px'><?php echo $lang->product->changedStories;?></th>
<th class='w-80px'><?php echo $lang->product->draftStories;?></th>
<th class='w-80px'><?php echo $lang->product->closedStories;?></th>
<th class='w-80px'><?php echo $lang->product->plans;?></th>
<th class='w-80px'><?php echo $lang->product->releases;?></th>
<th class='w-80px'><?php echo $lang->product->bugs;?></th>
<th class='w-80px'><?php echo $lang->product->unResolvedBugs;?></th>
<th class='w-80px'><?php echo $lang->product->assignToNullBugs;?></th>
<?php if($canOrder):?>
<th class='w-60px sort-default'><?php common::printOrderLink('order', $orderBy, $vars, $lang->product->updateOrder);?></th>
<?php endif;?>
</tr>
</thead>
<?php $canBatchEdit = common::hasPriv('product', 'batchEdit'); ?>
<tbody class='sortable' id='productTableList'>
<?php foreach($productStats as $product):?>
<tr class='text-center' data-id='<?php echo $product->id ?>' data-order='<?php echo $product->code ?>'>
<td class='cell-id'>
<?php if($canBatchEdit):?>
<input type='checkbox' name='productIDList[<?php echo $product->id;?>]' value='<?php echo $product->id;?>' />
<div class='main'>
<?php if(empty($productStats)):?>
<div class='block' id='productbox'>
<div class='container mw-500px'>
<div class='alert'>
<i class='icon icon-info-sign'></i>
<div class='content'>
<h5><?php echo $lang->my->home->noProductsTip ?></h5>
<?php echo html::a($this->createLink('product', 'create'), "<i class='icon-plus'></i> " . $lang->my->home->createProduct,'', "class='btn btn-success'") ?>
</div>
</div>
</div>
</div>
<?php else:?>
<script>setTreeBox();</script>
<?php $canOrder = (common::hasPriv('product', 'updateOrder') and strpos($orderBy, 'order') !== false)?>
<form method='post' action='<?php echo inLink('batchEdit', "productID=$productID");?>' id='productsForm'>
<table class='table table-condensed table-hover table-striped tablesorter table-datatable table-selectable' id='productList'>
<?php $vars = "category=$category&productID=$productID&status=$status&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<thead>
<tr>
<th class='w-id'><?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th><?php common::printOrderLink('name', $orderBy, $vars, $lang->product->name);?></th>
<th class='w-80px'><?php echo $lang->product->activeStories;?></th>
<th class='w-80px'><?php echo $lang->product->changedStories;?></th>
<th class='w-80px'><?php echo $lang->product->draftStories;?></th>
<th class='w-80px'><?php echo $lang->product->closedStories;?></th>
<th class='w-80px'><?php echo $lang->product->plans;?></th>
<th class='w-80px'><?php echo $lang->product->releases;?></th>
<th class='w-80px'><?php echo $lang->product->bugs;?></th>
<th class='w-80px'><?php echo $lang->product->unResolvedBugs;?></th>
<th class='w-80px'><?php echo $lang->product->assignToNullBugs;?></th>
<?php if($canOrder):?>
<th class='w-60px sort-default'><?php common::printOrderLink('order', $orderBy, $vars, $lang->product->updateOrder);?></th>
<?php endif;?>
<?php echo html::a($this->createLink('product', 'view', 'product=' . $product->id), sprintf('%03d', $product->id));?>
</td>
<td class='text-left' title='<?php echo $product->name?>'><?php echo html::a($this->createLink('product', 'view', 'product=' . $product->id), $product->name);?></td>
<td><?php echo $product->stories['active']?></td>
<td><?php echo $product->stories['changed']?></td>
<td><?php echo $product->stories['draft']?></td>
<td><?php echo $product->stories['closed']?></td>
<td><?php echo $product->plans?></td>
<td><?php echo $product->releases?></td>
<td><?php echo $product->bugs?></td>
<td><?php echo $product->unResolved;?></td>
<td><?php echo $product->assignToNull;?></td>
<?php if($canOrder):?>
<td class='sort-handler'><i class="icon icon-move"></i></td>
<?php endif;?>
</tr>
<?php endforeach;?>
</tbody>
<tfoot>
<tr>
<td colspan='<?php echo $canOrder ? 12 : 11?>'>
<div class='table-actions clearfix'>
<?php if($canBatchEdit and !empty($productStats)):?>
<?php echo html::selectButton();?>
<?php echo html::submitButton($lang->product->batchEdit);?>
</tr>
</thead>
<?php $canBatchEdit = common::hasPriv('product', 'batchEdit'); ?>
<tbody class='sortable' id='productTableList'>
<?php foreach($productStats as $product):?>
<tr class='text-center' data-id='<?php echo $product->id ?>' data-order='<?php echo $product->code ?>'>
<td class='cell-id'>
<?php if($canBatchEdit):?>
<input type='checkbox' name='productIDList[<?php echo $product->id;?>]' value='<?php echo $product->id;?>' />
<?php endif;?>
<?php if(!$canOrder and common::hasPriv('product', 'updateOrder')) echo html::a(inlink('all', "productID=$productID&status=$status&order=order_desc&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"), $lang->product->updateOrder, '' , "class='btn'");?>
</div>
<?php $pager->show();?>
</td>
</tr>
</tfoot>
</table>
</form>
<?php endif;?>
<?php echo html::a($this->createLink('product', 'view', 'product=' . $product->id), sprintf('%03d', $product->id));?>
</td>
<td class='text-left' title='<?php echo $product->name?>'><?php echo html::a($this->createLink('product', 'view', 'product=' . $product->id), $product->name);?></td>
<td><?php echo $product->stories['active']?></td>
<td><?php echo $product->stories['changed']?></td>
<td><?php echo $product->stories['draft']?></td>
<td><?php echo $product->stories['closed']?></td>
<td><?php echo $product->plans?></td>
<td><?php echo $product->releases?></td>
<td><?php echo $product->bugs?></td>
<td><?php echo $product->unResolved;?></td>
<td><?php echo $product->assignToNull;?></td>
<?php if($canOrder):?>
<td class='sort-handler'><i class="icon icon-move"></i></td>
<?php endif;?>
</tr>
<?php endforeach;?>
</tbody>
<tfoot>
<tr>
<td colspan='<?php echo $canOrder ? 12 : 11?>'>
<div class='table-actions clearfix'>
<?php if($canBatchEdit and !empty($productStats)):?>
<?php echo html::selectButton();?>
<?php echo html::submitButton($lang->product->batchEdit);?>
<?php endif;?>
<?php if(!$canOrder and common::hasPriv('product', 'updateOrder')) echo html::a(inlink('all', "productID=$productID&category=$category&status=$status&order=order_desc&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"), $lang->product->updateOrder, '' , "class='btn'");?>
</div>
<?php $pager->show();?>
</td>
</tr>
</tfoot>
</table>
</form>
<?php endif;?>
</div>
<script>$("#<?php echo $status;?>Tab").addClass('active');</script>
<?php js::set('orderBy', $orderBy)?>
+3 -2
View File
@@ -24,11 +24,12 @@
<form class='form-condensed' method='post' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th class='w-80px'><?php echo $lang->comment;?></th>
<th><?php echo $lang->comment;?></th>
<td><?php echo html::textarea('comment', '', "rows='6' class='form-control'");?></td>
</tr>
<tr>
<td colspan='2' class='text-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
<th></th>
<td><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
</form>
+2 -1
View File
@@ -32,7 +32,8 @@
</tr>
<tr>
<th><?php echo $lang->product->category;?></th>
<td><?php echo html::select('category', $categories, '', "class='form-control chosen'");?></td><td></td>
<td><?php echo html::select('category', $categories, '', "class='form-control chosen'");?></td>
<td><?php if(!$categories) common::printLink('tree', 'browse', "rootID=&view=category", $lang->tree->manageCategory);?></td>
</tr>
<tr>
<th><?php echo $lang->product->PO;?></th>
+2 -1
View File
@@ -33,7 +33,8 @@
</tr>
<tr>
<th><?php echo $lang->product->category;?></th>
<td><?php echo html::select('category', $categories, $product->category, "class='form-control chosen'");?></td><td></td>
<td><?php echo html::select('category', $categories, $product->category, "class='form-control chosen'");?></td>
<td><?php if(!$categories) common::printLink('tree', 'browse', 'rootID=&view=category', $lang->tree->manageCategory);?></td>
</tr>
<tr>
<th><?php echo $lang->product->PO;?></th>
+4
View File
@@ -69,6 +69,10 @@
<th><?php echo $lang->product->code;?></th>
<td><?php echo $product->code;?></td>
</tr>
<tr>
<th><?php echo $lang->product->category;?></th>
<td><?php echo zget($categories, $product->category);?></td>
</tr>
<tr>
<th><?php echo $lang->product->PO;?></th>
<td><?php echo zget($users, $product->PO);?></td>
+1 -1
View File
@@ -26,7 +26,7 @@ class productplan extends control
$this->view->product = $product;
$this->view->branch = $branch;
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID);
$this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$this->view->product->id}&branch=$branch"), $this->view->product->name);
$this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$productID}&branch=$branch"), $product->name);
$this->product->setMenu($this->product->getPairs(), $productID, $branch);
}
+15 -1
View File
@@ -1217,11 +1217,13 @@ class projectModel extends model
/* Link stories. */
$projectStories = $this->loadModel('story')->getProjectStoryPairs($projectID);
$lastOrder = (int)$this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($projectID)->orderBy('order_desc')->limit(1)->fetch('order');
foreach($stories as $storyID)
{
if(!isset($projectStories[$storyID]))
{
$story = $this->dao->findById($storyID)->fields("$projectID as project, id as story, product, version")->from(TABLE_STORY)->fetch();
$story->order = ++$lastOrder;
$this->dao->insert(TABLE_PROJECTSTORY)->data($story)->exec();
}
}
@@ -1377,7 +1379,8 @@ class projectModel extends model
{
if($this->post->stories == false) return false;
$this->loadModel('action');
$versions = $this->loadModel('story')->getVersions($this->post->stories);
$versions = $this->loadModel('story')->getVersions($this->post->stories);
$lastOrder = (int)$this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($projectID)->orderBy('order_desc')->limit(1)->fetch('order');
foreach($this->post->stories as $key => $storyID)
{
$productID = (int)$this->post->products[$storyID];
@@ -1386,6 +1389,7 @@ class projectModel extends model
$data->product = $productID;
$data->story = $storyID;
$data->version = $versions[$storyID];
$data->order = ++$lastOrder;
$this->dao->insert(TABLE_PROJECTSTORY)->data($data)->exec();
$this->story->setStage($storyID);
$this->action->create('story', $storyID, 'linked2project', '', $projectID);
@@ -1403,8 +1407,18 @@ class projectModel extends model
public function unlinkStory($projectID, $storyID)
{
$this->dao->delete()->from(TABLE_PROJECTSTORY)->where('project')->eq($projectID)->andWhere('story')->eq($storyID)->limit(1)->exec();
$order = 1;
$storys = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($projectID)->orderBy('order')->fetchAll();
foreach($storys as $projectstory)
{
if($projectstory->order != $order) $this->dao->update(TABLE_PROJECTSTORY)->set('`order`')->eq($order)->where('project')->eq($projectID)->andWhere('story')->eq($projectstory->story)->exec();
$order++;
}
$this->loadModel('story')->setStage($storyID);
$this->loadModel('action')->create('story', $storyID, 'unlinkedfromproject', '', $projectID);
$tasks = $this->dao->select('id')->from(TABLE_TASK)->where('story')->eq($storyID)->andWhere('project')->eq($projectID)->andWhere('status')->in('wait,doing')->fetchPairs('id');
$this->dao->update(TABLE_TASK)->set('status')->eq('cancel')->where('id')->in($tasks)->exec();
foreach($tasks as $taskID)
+2
View File
@@ -186,11 +186,13 @@ class storyModel extends model
if($projectID != 0 and $story->status != 'draft')
{
$lastOrder = (int)$this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($projectID)->orderBy('order_desc')->limit(1)->fetch('order');
$this->dao->insert(TABLE_PROJECTSTORY)
->set('project')->eq($projectID)
->set('product')->eq($this->post->product)
->set('story')->eq($storyID)
->set('version')->eq(1)
->set('order')->eq($lastOrder + 1)
->exec();
}
+1 -1
View File
@@ -177,7 +177,7 @@ class testsuiteModel extends model
*/
public function getById($suiteID, $setImgSize = false)
{
$suite = $this->dao->select("*")->from(TABLE_TESTSUITE)->where('id')->eq((int)$suiteID)->fetch();
$suite = $this->dao->select('*')->from(TABLE_TESTSUITE)->where('id')->eq((int)$suiteID)->fetch();
$suite = $this->loadModel('file')->replaceImgURL($suite, 'desc');
if($setImgSize) $suite->desc = $this->file->setImgSize($suite->desc);
return $suite;
+1 -1
View File
@@ -28,7 +28,7 @@ class tree extends control
if(strpos('story|bug|case|category', $viewType) !== false)
{
$product = $this->loadModel('product')->getById($rootID);
if($product->type != 'normal')
if(!empty($product->type) && $product->type != 'normal')
{
$branches = $this->loadModel('branch')->getPairs($product->id);
if($currentModuleID)
-1
View File
@@ -71,6 +71,5 @@ function toggleCopy()
$(document).ready(function()
{
toggleCopy();
$('[data-id="create"] a').modalTrigger({type: 'iframe', width: 500});
$('[data-id="edit"] a').modalTrigger({type: 'iframe', width: 500});
});
+32 -20
View File
@@ -752,20 +752,38 @@ class treeModel extends model
/**
* Create link of a story.
*
* @param object $module
* @param string $type
* @param object $module
* @access public
* @return string
*/
public function createStoryLink($type, $module)
{
$linkHtml = html::a(helper::createLink('product', 'browse', "root={$module->root}&branch=&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
return $linkHtml;
return html::a(helper::createLink('product', 'browse', "root={$module->root}&branch=&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
}
/**
* Create link of a product.
*
* @param string $type
* @param object $module
* @param array $extra
* @access public
* @return string
*/
public function createCategoryLink($type, $module, $extra)
{
$productID = $extra['productID'];
$status = $extra['status'];
return html::a(helper::createLink('product', 'all', "productID={$productID}&category={$module->id}&status={$status}"), $module->name, '_self', "id='module{$module->id}'");
}
/**
* Create link of a task.
*
* @param object $module
* @param string $type
* @param object $module
* @param array $extra
* @access public
* @return string
*/
@@ -773,8 +791,7 @@ class treeModel extends model
{
$projectID = $extra['projectID'];
$productID = $extra['productID'];
$linkHtml = html::a(helper::createLink('project', 'task', "root={$projectID}&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
return $linkHtml;
return html::a(helper::createLink('project', 'task', "root={$projectID}&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
}
/**
@@ -790,8 +807,7 @@ class treeModel extends model
{
$projectID = $extra['projectID'];
$productID = $extra['productID'];
$linkHtml = html::a(helper::createLink('project', 'story', "root={$projectID}&orderBy=&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
return $linkHtml;
return html::a(helper::createLink('project', 'story', "root={$projectID}&orderBy=&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
}
/**
@@ -803,9 +819,7 @@ class treeModel extends model
*/
public function createDocLink($type, $module, $extra = '')
{
$libID = $module->root;
$linkHtml = html::a(helper::createLink('doc', 'browse', "libID={$libID}&browseType=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
return $linkHtml;
return html::a(helper::createLink('doc', 'browse', "libID={$module->root}&browseType=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
}
/**
@@ -877,8 +891,7 @@ class treeModel extends model
*/
public function createBugLink($type, $module)
{
$linkHtml = html::a(helper::createLink('bug', 'browse', "root={$module->root}&branch=&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
return $linkHtml;
return html::a(helper::createLink('bug', 'browse', "root={$module->root}&branch=&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
}
/**
@@ -890,8 +903,7 @@ class treeModel extends model
*/
public function createCaseLink($type, $module)
{
$linkHtml = html::a(helper::createLink('testcase', 'browse', "root={$module->root}&branch=&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
return $linkHtml;
return html::a(helper::createLink('testcase', 'browse', "root={$module->root}&branch=&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
}
/**
@@ -903,8 +915,7 @@ class treeModel extends model
*/
public function createTestTaskLink($type, $module, $extra)
{
$linkHtml = html::a(helper::createLink('testtask', 'cases', "taskID=$extra&type=byModule&module={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
return $linkHtml;
return html::a(helper::createLink('testtask', 'cases', "taskID=$extra&type=byModule&module={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
}
/**
@@ -917,8 +928,7 @@ class treeModel extends model
*/
public function createCaseLibLink($type, $module)
{
$linkHtml = html::a(helper::createLink('testsuite', 'library', "root={$module->root}&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
return $linkHtml;
return html::a(helper::createLink('testsuite', 'library', "root={$module->root}&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
}
/**
@@ -935,7 +945,7 @@ class treeModel extends model
{
if($type == 'story') return html::a(helper::createLink('product', 'browse', "productID={$rootID}&branch=$branchID"), $branch, '_self', "id='branch{$branchID}'");
if($type == 'bug') return html::a(helper::createLink('bug', 'browse', "productID={$rootID}&branch=$branchID"), $branch, '_self', "id='branch{$branchID}'");
if($type == 'case') return html::a(helper::createLink('testcase', 'browse', "productID={$rootID}&branch=$branchID"), $branch, '_self', "id='branch{$branchID}'");
if($type == 'case') return html::a(helper::createLink('testcase', 'browse', "productID={$rootID}&branch=$branchID"), $branch, '_self', "id='branch{$branchID}'");
}
/**
@@ -1195,6 +1205,8 @@ class treeModel extends model
*/
public function manageChild($rootID, $type, $parentModuleID, $childs)
{
if($type == 'category') $rootID = 0;
$this->checkUnique($rootID, $type, $parentModuleID, $childs);
$parentModule = $this->getByID($parentModuleID);
+9 -7
View File
@@ -11,7 +11,8 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php $hasBranch = (strpos('story|bug|case', $viewType) !== false and $root->type != 'normal') ? true : false;?>
<?php js::set('viewType', $viewType);?>
<?php $hasBranch = (strpos('story|bug|case', $viewType) !== false and (!empty($root->type) && $root->type != 'normal')) ? true : false;?>
<?php $name = $viewType == 'category' ? $lang->tree->category : $lang->tree->name;?>
<div id='featurebar'>
<div class='heading'><?php echo $viewType == 'category' ? $lang->tree->manageCategory : $lang->tree->common;?></div>
@@ -28,7 +29,7 @@
</div>
</div>
<div class='col-sm-8'>
<form id='childrenForm' class='form-condensed' method='post' target='hiddenwin' action='<?php echo $this->createLink('tree', 'manageChild', "root={$root->id}&viewType=$viewType");?>'>
<form id='childrenForm' class='form-condensed' method='post' target='hiddenwin' action='<?php echo $this->createLink('tree', 'manageChild', "root=$rootID&viewType=$viewType");?>'>
<div class='panel'>
<div class='panel-heading'>
<i class='icon-sitemap'></i>
@@ -45,11 +46,11 @@
<td class='parentModule'>
<nobr>
<?php
echo html::a($this->createLink('tree', 'browse', "root={$root->id}&viewType=$viewType"), $root->name);
echo html::a($this->createLink('tree', 'browse', "root=$rootID&viewType=$viewType"), empty($root->name) ? '' : $root->name);
echo $lang->arrow;
foreach($parentModules as $module)
{
echo html::a($this->createLink('tree', 'browse', "root={$root->id}&viewType=$viewType&moduleID=$module->id"), $module->name);
echo html::a($this->createLink('tree', 'browse', "root=$rootID&viewType=$viewType&moduleID=$module->id"), $module->name);
echo $lang->arrow;
}
?>
@@ -180,8 +181,8 @@ $(function()
subModules:
{
linkTemplate: '<?php echo helper::createLink('tree', 'browse', "rootID=$rootID&viewType=$viewType&moduleID={0}&branch={1}"); ?>',
title: '<?php echo $viewType == 'category' ? $lang->tree->categoryChild : $lang->tree->child ?>',
template: '<a href="javascript:;"><?php echo $viewType == 'category' ? $lang->tree->categoryChild : $lang->tree->child?></a>'
title: '<?php echo $viewType == 'category' ? '': $lang->tree->child ?>',
template: '<a href="javascript:;"><?php echo $viewType == 'category' ? '': $lang->tree->child?></a>'
}
},
action: function(event)
@@ -209,7 +210,7 @@ $(function()
var item = $li.data();
orders['orders[' + item.id + ']'] = $li.attr('data-order') || item.order;
});
$.post('<?php echo $this->createLink('tree', 'updateOrder', "root={$root->id}&viewType=$viewType");?>', orders).error(function()
$.post('<?php echo $this->createLink('tree', 'updateOrder', "rootID=$rootID&viewType=$viewType");?>', orders).error(function()
{
bootbox.alert(lang.timeout);
});
@@ -245,6 +246,7 @@ $(function()
$tree.find('[data-toggle="tooltip"]').tooltip();
$('#modulemenu > .nav > li > a[href*=tree][href*=browse]').not('[href*=<?php echo $viewType;?>]').parent().removeClass('active');
if(viewType == 'category') $('#modulemenu > .nav > li > a[href*=product][href*=all]').parent('li[data-id=all]').addClass('active');
});
</script>
<?php
+1 -1
View File
@@ -44,7 +44,7 @@
</tbody>
<tfoot>
<tr>
<td colspan='5'><?php $pager->show();?></td>
<td colspan='6'><?php $pager->show();?></td>
</tr>
</tfoot>
</table>