+ add the feature of copy module from product.

This commit is contained in:
wangchunsheng
2010-07-27 05:48:51 +00:00
parent ef0656015a
commit eb0bc57fd5
4 changed files with 66 additions and 75 deletions

View File

@@ -90,6 +90,7 @@ class tree extends control
$this->view->product = $product;
$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->currentModuleID = $currentModuleID;
$this->view->parentModules = $parentModules;
@@ -157,4 +158,16 @@ class tree extends control
$optionMenu = $this->tree->getOptionMenu($productID, $viewType, $rootModuleID);
die( html::select("module", $optionMenu, '', 'onchange=setAssignedTo()'));
}
/* ajax请求 返回某一个模块的son模块.*/
public function ajaxGetSonModules($moduleID, $productID = 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)
->andWhere('parent')->eq('0')
->andWhere('type')->eq('story')
->fetchPairs();
die(json_encode($modules));
}
}

View File

@@ -21,25 +21,26 @@
* @version $Id$
* @link http://www.zentaoms.com
*/
$lang->tree->common = '模块维护';
$lang->tree->add = "添加";
$lang->tree->edit = "编辑";
$lang->tree->addChild = "添加子模块";
$lang->tree->delete = "删除模块";
$lang->tree->browse = "模块维护";
$lang->tree->manage = "维护模块";
$lang->tree->manageProduct= "维护产品视图模块";
$lang->tree->manageProject= "维护项目视图模块";
$lang->tree->manageBug = "维护QA视图模块";
$lang->tree->manageCase = "维护用例视图模块";
$lang->tree->updateOrder = "更新排序";
$lang->tree->manageChild = "维护子模块";
$lang->tree->child = "子模块";
$lang->tree->owner = "负责人";
$lang->tree->ajaxGetOptionMenu = "接口:获取下拉列表";
$lang->tree->common = '模块维护';
$lang->tree->add = '添加';
$lang->tree->edit = '编辑';
$lang->tree->addChild = '添加子模块';
$lang->tree->delete = '删除模块';
$lang->tree->browse = '模块维护';
$lang->tree->manage = '维护模块';
$lang->tree->manageProduct = '维护产品视图模块';
$lang->tree->manageProject = '维护项目视图模块';
$lang->tree->manageBug = '维护QA视图模块';
$lang->tree->manageCase = '维护用例视图模块';
$lang->tree->updateOrder = '更新排序';
$lang->tree->manageChild = '维护子模块';
$lang->tree->syncFromProduct = '复制产品视图模块';
$lang->tree->ajaxGetOptionMenu = '接口:获取下拉列表';
$lang->tree->confirmDelete = "您确定删除该模块吗?";
$lang->tree->successSave = "成功保存";
$lang->tree->confirmDelete = '您确定删除该模块吗?';
$lang->tree->successSave = '成功保存';
$lang->tree->name = '模块名称';
$lang->tree->parent = '上级模块';
$lang->tree->child = '子模块';
$lang->tree->owner = '负责人';

View File

@@ -25,6 +25,28 @@
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/treeview.html.php';?>
<script language='javascript'>
var productID = <?php echo $productID;?>;
function syncModule()
{
link = createLink('tree', 'ajaxGetSonModules', 'moduleID=' + $('#productModule').val() + '&productID=' + productID);
$.getJSON(link, function(modules)
{
$('.helplink').addClass('hidden');
$.each(modules, function(key, value)
{
moduleName = value;
$('.text-3').each(function()
{
if(this.value == moduleName) modules[key] = null;
if(!this.value) $(this).parent().addClass('hidden');
})
});
$.each(modules, function(key, value)
{
if(value) $('#moduleBox').append("<span><input name=modules[] value=" + value + " style=margin-bottom:5px class=text-3 /><br /><span>");
})
})
}
$(document).ready(function()
{
$("a.iframe").colorbox({width:480, height:320, iframe:true, transition:'none'});
@@ -50,20 +72,26 @@ $(document).ready(function()
?>
</nobr>
</td>
<td>
<td id='moduleBox'>
<?php
if($viewType != 'story')
{
echo html::select('productModule', $productModules, '', 'class=select-3');
echo html::commonButton($lang->tree->syncFromProduct, 'onclick=syncModule()');
echo '<br />';
}
$maxOrder = 0;
foreach($sons as $sonModule)
{
if($sonModule->order > $maxOrder) $maxOrder = $sonModule->order;
echo html::input("modules[id$sonModule->id]", $sonModule->name, 'style="margin-bottom:5px"') . '<br />';
echo '<span>' . html::input("modules[id$sonModule->id]", $sonModule->name, 'class=text-3 style="margin-bottom:5px"') . '<br /></span>';
}
for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) echo html::input("modules[]", '', 'style="margin-bottom:5px"') . '<br />';
?>
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='2'>
<td class='a-center' colspan='3'>
<?php
echo html::submitButton() . html::resetButton();
echo html::hidden('parentModuleID', $currentModuleID);

View File

@@ -1,51 +0,0 @@
<?php
/**
* The create view of product module of ZenTaoMS.
*
* ZenTaoMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ZenTaoMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ZenTaoMS. If not, see <http://www.gnu.org/licenses/>.
*
* @copyright Copyright 2009-2010 青岛易软天创网络科技有限公司(www.cnezsoft.com)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package product
* @version $Id$
* @link http://www.zentaoms.com
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id='doc3'>
<form method='post' target='hiddenwin'>
<table align='center' class='table-4'>
<caption><?php echo $lang->product->create;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->product->name;?></th>
<td class='a-left'><input type='text' name='name' /></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->code;?></th>
<td class='a-left'><input type='text' name='code' /></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->desc;?></th>
<td class='a-left'><textarea name='desc' style='width:100%' rows='5'></textarea></td>
</tr>
<tr>
<td colspan='2'>
<input type='submit' value='<?php echo $lang->product->saveButton;?>' accesskey='S' />
<input type='reset' value='<?php echo $lang->reset;?>' />
</td>
</tr>
</table>
</form>
</div>
<?php include '../../common/view/footer.html.php';?>