+ finishe the feature of manauge module of custo doc lib.
This commit is contained in:
@@ -45,5 +45,10 @@ class doc extends control
|
||||
/* 维护文档库模块。*/
|
||||
public function manageModule($libID)
|
||||
{
|
||||
/* 如果是自定义的文档库,则跳转到tree模块。*/
|
||||
if($libID != 'product' and $libID != 'project')
|
||||
{
|
||||
$this->locate($this->createLink('tree', 'browse', "rootID=$libID&type=customdoc"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,4 +45,9 @@ class docModel extends model
|
||||
$libs = $this->dao->select('id, name')->from(TABLE_DOCLIB)->fetchPairs();
|
||||
return $this->lang->doc->systemLibs + $libs;
|
||||
}
|
||||
|
||||
public function getLibById($libID)
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_DOCLIB)->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
+41
-39
@@ -23,75 +23,77 @@
|
||||
*/
|
||||
class tree extends control
|
||||
{
|
||||
protected $product;
|
||||
const NEW_CHILD_COUNT = 5;
|
||||
|
||||
/* 构造函数,加载产品模块。*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->loadModel('product');
|
||||
$this->loadModel('bug');
|
||||
$this->loadModel('testcase');
|
||||
}
|
||||
|
||||
/* 设置当前的产品。*/
|
||||
private function setProduct($productID)
|
||||
{
|
||||
$this->product = $this->product->getById($productID);
|
||||
}
|
||||
|
||||
/* 模块列表。*/
|
||||
public function browse($productID, $viewType, $currentModuleID = 0)
|
||||
public function browse($rootID, $viewType, $currentModuleID = 0)
|
||||
{
|
||||
$product = $this->product->getById($productID);
|
||||
/* 根据视图的不同,获得相应的产品或者文档库。*/
|
||||
if(strpos('story|bug|case', $viewType) !== false)
|
||||
{
|
||||
$product = $this->loadModel('product')->getById($rootID);
|
||||
$this->view->root = $product;
|
||||
$this->view->productModules = $this->tree->getOptionMenu($rootID, 'story');
|
||||
}
|
||||
elseif($viewType == 'customdoc')
|
||||
{
|
||||
$lib = $this->loadModel('doc')->getLibById($rootID);
|
||||
$this->view->root = $lib;
|
||||
}
|
||||
|
||||
if($viewType == 'story')
|
||||
{
|
||||
/* 设置菜单。*/
|
||||
$this->product->setMenu($this->product->getPairs(), $productID, 'product');
|
||||
$this->product->setMenu($this->product->getPairs(), $rootID, 'product');
|
||||
$this->lang->tree->menu = $this->lang->product->menu;
|
||||
$this->lang->set('menugroup.tree', 'product');
|
||||
|
||||
/* 设置导航。*/
|
||||
$header['title'] = $this->lang->tree->manageProduct . $this->lang->colon . $product->name;
|
||||
$position[] = html::a($this->createLink('product', 'browse', "product=$productID"), $product->name);
|
||||
$position[] = html::a($this->createLink('product', 'browse', "product=$rootID"), $product->name);
|
||||
$position[] = $this->lang->tree->manageProduct;
|
||||
}
|
||||
elseif($viewType == 'bug')
|
||||
{
|
||||
/* 设置菜单。*/
|
||||
$this->bug->setMenu($this->product->getPairs(), $productID);
|
||||
$this->loadModel('bug')->setMenu($this->product->getPairs(), $rootID);
|
||||
$this->lang->tree->menu = $this->lang->bug->menu;
|
||||
$this->lang->set('menugroup.tree', 'qa');
|
||||
|
||||
$header['title'] = $this->lang->tree->manageBug . $this->lang->colon . $product->name;
|
||||
$position[] = html::a($this->createLink('bug', 'browse', "product=$productID"), $product->name);
|
||||
$position[] = html::a($this->createLink('bug', 'browse', "product=$rootID"), $product->name);
|
||||
$position[] = $this->lang->tree->manageBug;
|
||||
$this->lang->set('menugroup.tree', 'qa');
|
||||
}
|
||||
elseif($viewType == 'case')
|
||||
{
|
||||
/* 设置菜单。*/
|
||||
$this->testcase->setMenu($this->product->getPairs(), $productID);
|
||||
$this->loadModel('testcase')->setMenu($this->product->getPairs(), $rootID);
|
||||
$this->lang->tree->menu = $this->lang->testcase->menu;
|
||||
$this->lang->set('menugroup.tree', 'qa');
|
||||
|
||||
$header['title'] = $this->lang->tree->manageCase . $this->lang->colon . $product->name;
|
||||
$position[] = html::a($this->createLink('testcase', 'browse', "product=$productID"), $product->name);
|
||||
$position[] = html::a($this->createLink('testcase', 'browse', "product=$rootID"), $product->name);
|
||||
$position[] = $this->lang->tree->manageCase;
|
||||
$this->lang->set('menugroup.tree', 'qa');
|
||||
}
|
||||
elseif($viewType == 'customdoc')
|
||||
{
|
||||
/* 设置菜单。*/
|
||||
$this->doc->setMenu($this->doc->getLibs(), $rootID);
|
||||
$this->lang->tree->menu = $this->lang->doc->menu;
|
||||
$this->lang->set('menugroup.tree', 'doc');
|
||||
|
||||
$header['title'] = $this->lang->tree->manageCustomDoc . $this->lang->colon . $lib->name;
|
||||
$position[] = html::a($this->createLink('doc', 'browse', "libID=$rootID"), $lib->name);
|
||||
$position[] = $this->lang->tree->manageCustomDoc;
|
||||
}
|
||||
|
||||
$parentModules = $this->tree->getParents($currentModuleID);
|
||||
$this->view->header = $header;
|
||||
$this->view->position = $position;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->product = $product;
|
||||
$this->view->rootID = $rootID;
|
||||
$this->view->viewType = $viewType;
|
||||
$this->view->modules = $this->tree->getTreeMenu($productID, $viewType, $rooteModuleID = 0, array('treeModel', 'createManageLink'));
|
||||
$this->view->productModules = $this->tree->getOptionMenu($productID, 'story');
|
||||
$this->view->sons = $this->tree->getSons($productID, $currentModuleID, $viewType);
|
||||
$this->view->modules = $this->tree->getTreeMenu($rootID, $viewType, $rooteModuleID = 0, array('treeModel', 'createManageLink'));
|
||||
$this->view->sons = $this->tree->getSons($rootID, $currentModuleID, $viewType);
|
||||
$this->view->currentModuleID = $currentModuleID;
|
||||
$this->view->parentModules = $parentModules;
|
||||
$this->display();
|
||||
@@ -128,21 +130,21 @@ class tree extends control
|
||||
}
|
||||
|
||||
/* 维护子菜单。*/
|
||||
public function manageChild($productID, $viewType)
|
||||
public function manageChild($rootID, $viewType)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->tree->manageChild($productID, $viewType, $_POST['parentModuleID'], $_POST['modules']);
|
||||
$this->tree->manageChild($rootID, $viewType, $_POST['parentModuleID'], $_POST['modules']);
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
}
|
||||
|
||||
/* 删除某一个模块。*/
|
||||
public function delete($productID, $moduleID, $confirm = 'no')
|
||||
public function delete($rootID, $moduleID, $confirm = 'no')
|
||||
{
|
||||
if($confirm == 'no')
|
||||
{
|
||||
echo js::confirm($this->lang->tree->confirmDelete, $this->createLink('tree', 'delete', "productID=$productID&moduleID=$moduleID&confirm=yes"));
|
||||
echo js::confirm($this->lang->tree->confirmDelete, $this->createLink('tree', 'delete', "rootID=$rootID&moduleID=$moduleID&confirm=yes"));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@@ -153,18 +155,18 @@ class tree extends control
|
||||
}
|
||||
|
||||
/* ajax请求: 返回某一个产品的模块列表。*/
|
||||
public function ajaxGetOptionMenu($productID, $viewType = 'product', $rootModuleID = 0)
|
||||
public function ajaxGetOptionMenu($rootID, $viewType = 'product', $rootModuleID = 0)
|
||||
{
|
||||
$optionMenu = $this->tree->getOptionMenu($productID, $viewType, $rootModuleID);
|
||||
$optionMenu = $this->tree->getOptionMenu($rootID, $viewType, $rootModuleID);
|
||||
die( html::select("module", $optionMenu, '', 'onchange=setAssignedTo()'));
|
||||
}
|
||||
|
||||
/* ajax请求: 返回某一个模块的son模块.*/
|
||||
public function ajaxGetSonModules($moduleID, $productID = 0)
|
||||
public function ajaxGetSonModules($moduleID, $rootID = 0)
|
||||
{
|
||||
if($moduleID) die(json_encode($this->dao->findByParent($moduleID)->from(TABLE_MODULE)->fetchPairs('id', 'name')));
|
||||
$modules = $this->dao->select('id, name')->from(TABLE_MODULE)
|
||||
->where('root')->eq($productID)
|
||||
->where('root')->eq($rootID)
|
||||
->andWhere('parent')->eq('0')
|
||||
->andWhere('type')->eq('story')
|
||||
->fetchPairs();
|
||||
|
||||
@@ -32,6 +32,7 @@ $lang->tree->manageProduct = '维护产品视图模块';
|
||||
$lang->tree->manageProject = '维护项目视图模块';
|
||||
$lang->tree->manageBug = '维护QA视图模块';
|
||||
$lang->tree->manageCase = '维护用例视图模块';
|
||||
$lang->tree->manageCustomDoc = '维护文档库模块';
|
||||
$lang->tree->updateOrder = '更新排序';
|
||||
$lang->tree->manageChild = '维护子模块';
|
||||
$lang->tree->syncFromProduct = '复制产品视图模块';
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/treeview.html.php';?>
|
||||
<script language='javascript'>
|
||||
var productID = <?php echo $productID;?>;
|
||||
var rootID = <?php echo $rootID;?>;
|
||||
function syncModule()
|
||||
{
|
||||
link = createLink('tree', 'ajaxGetSonModules', 'moduleID=' + $('#productModule').val() + '&productID=' + productID);
|
||||
link = createLink('tree', 'ajaxGetSonModules', 'moduleID=' + $('#productModule').val() + '&rootID=' + rootID);
|
||||
$.getJSON(link, function(modules)
|
||||
{
|
||||
$('.helplink').addClass('hidden');
|
||||
@@ -55,18 +55,18 @@ $(document).ready(function()
|
||||
<div class="yui-d0 yui-t3">
|
||||
<div class="yui-main">
|
||||
<div class="yui-b">
|
||||
<form method='post' target='hiddenwin' action='<?php echo $this->createLink('tree', 'manageChild', "product={$product->id}&viewType=$viewType");?>'>
|
||||
<form method='post' target='hiddenwin' action='<?php echo $this->createLink('tree', 'manageChild', "root={$root->id}&viewType=$viewType");?>'>
|
||||
<table align='center' class='table-1'>
|
||||
<caption><?php echo $lang->tree->manageChild;?></caption>
|
||||
<tr>
|
||||
<td width='10%'>
|
||||
<nobr>
|
||||
<?php
|
||||
echo html::a($this->createLink('tree', 'browse', "product={$product->id}&viewType=$viewType"), $product->name);
|
||||
echo html::a($this->createLink('tree', 'browse', "root={$root->id}&viewType=$viewType"), $root->name);
|
||||
echo $lang->arrow;
|
||||
foreach($parentModules as $module)
|
||||
{
|
||||
echo html::a($this->createLink('tree', 'browse', "product={$product->id}&viewType=$viewType&moduleID=$module->id"), $module->name);
|
||||
echo html::a($this->createLink('tree', 'browse', "root={$root->id}&viewType=$viewType&moduleID=$module->id"), $module->name);
|
||||
echo $lang->arrow;
|
||||
}
|
||||
?>
|
||||
@@ -74,7 +74,7 @@ $(document).ready(function()
|
||||
</td>
|
||||
<td id='moduleBox'>
|
||||
<?php
|
||||
if($viewType != 'story')
|
||||
if($viewType != 'story' and $viewType != 'customdoc')
|
||||
{
|
||||
echo html::select('productModule', $productModules, '', 'class=select-3');
|
||||
echo html::commonButton($lang->tree->syncFromProduct, 'onclick=syncModule()');
|
||||
@@ -89,7 +89,7 @@ $(document).ready(function()
|
||||
for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) echo '<span>' . html::input("modules[]", '', 'class=text-3 style="margin-bottom:5px"') . '<br /></span>';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='a-center' colspan='3'>
|
||||
<?php
|
||||
@@ -106,7 +106,7 @@ $(document).ready(function()
|
||||
</div>
|
||||
|
||||
<div class="yui-b">
|
||||
<form method='post' target='hiddenwin' action='<?php echo $this->createLink('tree', 'updateOrder', "product={$product->id}&viewType=$viewType");?>'>
|
||||
<form method='post' target='hiddenwin' action='<?php echo $this->createLink('tree', 'updateOrder', "root={$root->id}&viewType=$viewType");?>'>
|
||||
<table class='table-1'>
|
||||
<caption><?php echo $header->title;?></caption>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user