* code for task#1374.
This commit is contained in:
@@ -109,7 +109,7 @@ class project extends control
|
||||
* @return void
|
||||
*/
|
||||
public function task($projectID = 0, $status = 'all', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 100, $pageID = 1)
|
||||
{
|
||||
{
|
||||
$this->loadModel('tree');
|
||||
|
||||
/* Set browseType, productID, moduleID and queryID. */
|
||||
@@ -167,6 +167,7 @@ class project extends control
|
||||
{
|
||||
if($this->session->taskQuery == false) $this->session->set('taskQuery', ' 1 = 1');
|
||||
}
|
||||
|
||||
/* Limit current project when no project. */
|
||||
if(strpos($this->session->taskQuery, "`project` =") === false) $this->session->set('taskQuery', $this->session->taskQuery . " AND `project` = $projectID");
|
||||
if(strpos($this->session->taskQuery, "deleted =") === false) $this->session->set('taskQuery', $this->session->taskQuery . " AND deleted = '0'");
|
||||
@@ -185,7 +186,7 @@ class project extends control
|
||||
$this->config->project->search['actionURL'] = $this->createLink('project', 'task', "projectID=$projectID&status=bySearch¶m=myQueryID");
|
||||
$this->config->project->search['queryID'] = $queryID;
|
||||
$this->config->project->search['params']['project']['values'] = array(''=>'', $projectID => $this->projects[$projectID], 'all' => $this->lang->project->allProject);
|
||||
$this->config->project->search['params']['module']['values'] = $this->tree->getOptionMenu($projectID, $viewType = 'task', $startModuleID = 0);
|
||||
$this->config->project->search['params']['module']['values'] = $this->tree->getTaskOptionMenu($projectID, $startModuleID = 0);
|
||||
$this->loadModel('search')->setSearchParams($this->config->project->search);
|
||||
|
||||
/* Assign. */
|
||||
@@ -203,7 +204,7 @@ class project extends control
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->project = $project;
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->moduleTree = $this->tree->getTreeMenu($projectID, $viewType = 'task', $startModuleID = 0, array('treeModel', 'createTaskLink'));
|
||||
$this->view->moduleTree = $this->tree->getTaskTreeMenu($projectID, $productID = 0, $startModuleID = 0, array('treeModel', 'createTaskLink'));
|
||||
$this->view->projectTree = $this->project->tree();
|
||||
|
||||
$this->display();
|
||||
|
||||
@@ -26,10 +26,10 @@ var browseType = '<?php echo $browseType;?>';
|
||||
<div class='box-content'>
|
||||
<?php echo $moduleTree;?>
|
||||
<div class='a-right'>
|
||||
<?php common::printLink('project', 'edit', "projectID=$projectID", $lang->edit);?>
|
||||
<?php common::printLink('project', 'delete', "projectID=$projectID&confirm=no", $lang->delete, 'hiddenwin');?>
|
||||
<?php common::printLink('tree', 'browse', "rootID=$projectID&view=task", $lang->tree->manage);?>
|
||||
<?php common::printLink('tree', 'fix', "root=$projectID&type=task", $lang->tree->fix, 'hiddenwin');?>
|
||||
<?php common::printLink('project', 'edit', "projectID=$projectID", $lang->edit);?>
|
||||
<?php common::printLink('project', 'delete', "projectID=$projectID&confirm=no", $lang->delete, 'hiddenwin');?>
|
||||
<?php common::printLink('tree', 'browsetask', "rootID=$projectID&productID=0", $lang->tree->manage);?>
|
||||
<?php common::printLink('tree', 'fix', "root=$projectID&type=task", $lang->tree->fix, 'hiddenwin');?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -238,7 +238,7 @@ class task extends control
|
||||
$this->view->position[] = $this->lang->task->edit;
|
||||
$this->view->stories = $this->story->getProjectStoryPairs($this->view->project->id);
|
||||
$this->view->members = $this->loadModel('user')->appendDeleted($this->view->members, $this->view->task->assignedTo);
|
||||
$this->view->modules = $this->tree->getOptionMenu($this->view->task->project, $viewType = 'task');
|
||||
$this->view->modules = $this->tree->getTaskOptionMenu($this->view->task->project);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
+55
-29
@@ -31,12 +31,6 @@ class tree extends control
|
||||
$this->view->root = $product;
|
||||
$this->view->productModules = $this->tree->getOptionMenu($rootID, 'story');
|
||||
}
|
||||
elseif($viewType == 'task')
|
||||
{
|
||||
$project = $this->loadModel('project')->getById($rootID);
|
||||
$this->view->root = $project;
|
||||
$this->view->projectModules = $this->tree->getOptionMenu($rootID, 'task');
|
||||
}
|
||||
|
||||
/* The viewType is doc. */
|
||||
elseif(strpos($viewType, 'doc') !== false)
|
||||
@@ -77,25 +71,6 @@ class tree extends control
|
||||
$position[] = html::a($this->createLink('product', 'browse', "product=$rootID"), $product->name);
|
||||
$position[] = $this->lang->tree->manageProduct;
|
||||
}
|
||||
elseif($viewType == 'task')
|
||||
{
|
||||
$this->lang->set('menugroup.tree', 'project');
|
||||
$this->project->setMenu($this->project->getPairs(), $rootID, 'task');
|
||||
$this->lang->tree->menu = $this->lang->project->menu;
|
||||
$this->lang->tree->menuOrder = $this->lang->project->menuOrder;
|
||||
|
||||
$projects = $this->project->getPairs();
|
||||
unset($projects[$rootID]);
|
||||
$currentProject = key($projects);
|
||||
|
||||
$this->view->allProject = $projects;
|
||||
$this->view->currentProject = $currentProject;
|
||||
$this->view->projectModules = $this->tree->getOptionMenu($currentProject, 'task');
|
||||
|
||||
$title = $project->name . $this->lang->colon . $this->lang->tree->manageProject;
|
||||
$position[] = html::a($this->createLink('project', 'task', "projectID=$rootID"), $project->name);
|
||||
$position[] = $this->lang->tree->manageProject;
|
||||
}
|
||||
elseif($viewType == 'bug')
|
||||
{
|
||||
$this->loadModel('bug')->setMenu($this->product->getPairs(), $rootID);
|
||||
@@ -156,6 +131,48 @@ class tree extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Browse task module.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param int $productID
|
||||
* @param int $currentModuleID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browseTask($rootID, $productID = 0, $currentModuleID = 0)
|
||||
{
|
||||
$project = $this->loadModel('project')->getById($rootID);
|
||||
$this->view->root = $project;
|
||||
|
||||
$this->lang->set('menugroup.tree', 'project');
|
||||
$this->project->setMenu($this->project->getPairs(), $rootID);
|
||||
$this->lang->tree->menu = $this->lang->project->menu;
|
||||
$this->lang->tree->menuOrder = $this->lang->project->menuOrder;
|
||||
|
||||
$projects = $this->project->getPairs();
|
||||
unset($projects[$rootID]);
|
||||
$currentProject = key($projects);
|
||||
$parentModules = $this->tree->getParents($currentModuleID);
|
||||
|
||||
$title = $project->name . $this->lang->colon . $this->lang->tree->manageProject;
|
||||
$position[] = html::a($this->createLink('project', 'task', "projectID=$rootID"), $project->name);
|
||||
$position[] = $this->lang->tree->manageProject;
|
||||
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->rootID = $rootID;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->allProject = $projects;
|
||||
$this->view->currentProject = $currentProject;
|
||||
$this->view->projectModules = $this->tree->getTaskOptionMenu($currentProject, $productID);
|
||||
$this->view->modules = $this->tree->getTaskTreeMenu($rootID, $productID, $rooteModuleID = 0, array('treeModel', 'createTaskManageLink'));
|
||||
$this->view->sons = $this->tree->getTaskSons($rootID, $productID, $currentModuleID);
|
||||
$this->view->currentModuleID = $currentModuleID;
|
||||
$this->view->parentModules = $parentModules;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a module.
|
||||
*
|
||||
@@ -171,15 +188,24 @@ class tree extends control
|
||||
echo js::alert($this->lang->tree->successSave);
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
|
||||
$module = $this->tree->getById($moduleID);
|
||||
if($module->owner == null and $module->root != 0)
|
||||
{
|
||||
$module->owner = $this->loadModel('product')->getById($module->root)->QD;
|
||||
}
|
||||
$this->view->module = $module;
|
||||
$this->view->type = $type;
|
||||
$this->view->optionMenu = $this->tree->getOptionMenu($this->view->module->root, $this->view->module->type);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted');
|
||||
|
||||
if($type == 'task')
|
||||
{
|
||||
$this->view->optionMenu = $this->tree->getTaskOptionMenu($module->root);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->view->optionMenu = $this->tree->getOptionMenu($module->root, $module->type);
|
||||
}
|
||||
$this->view->module = $module;
|
||||
$this->view->type = $type;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted');
|
||||
|
||||
/* Remove self and childs from the $optionMenu. Because it's parent can't be self or childs. */
|
||||
$childs = $this->tree->getAllChildId($moduleID);
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
function syncModule(rootID, type)
|
||||
{
|
||||
moduleID = type == 'task' ? $('#projectModule').val() : $('#productModule').val();
|
||||
type = type == 'task' ? 'task' : 'story';
|
||||
|
||||
link = createLink('tree', 'ajaxGetSonModules', 'moduleID=' + moduleID + '&rootID=' + rootID + '&type=' + type);
|
||||
$.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) $('#sonModule').append("<span><input name=modules[] value=" + value + " style=margin-bottom:5px class=text-3 /><br /><span>");
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function syncProject(obj)
|
||||
{
|
||||
link = createLink('tree', 'ajaxGetOptionMenu', 'rootID=' + obj.value + "&viewType=task&rootModuleID=0&returnType=json");
|
||||
$.getJSON(link, function(modules)
|
||||
{
|
||||
$('.helplink').addClass('hidden');
|
||||
$('#' + type + 'Module').empty();
|
||||
$.each(modules, function(key, value)
|
||||
{
|
||||
$('#' + type + 'Module').append('<option value=' + key + '>' + value + '</option')
|
||||
});
|
||||
})
|
||||
$('#copyModule').attr('onclick', null);
|
||||
$('#copyModule').bind('click', function(){syncModule(obj.value, 'task')});
|
||||
}
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("a.iframe").colorbox({width:480, height:240, iframe:true, transition:'none'});
|
||||
});
|
||||
+239
-29
@@ -44,23 +44,14 @@ class treeModel extends model
|
||||
if($startModule) $startModulePath = $startModule->path . '%';
|
||||
}
|
||||
|
||||
/* Get createdVersion. */
|
||||
if($type == 'task')
|
||||
{
|
||||
$createdVersion = $this->dao->select('openedVersion')->from(TABLE_PROJECT)
|
||||
->where('id')->eq($rootID)
|
||||
->fetch('openedVersion');
|
||||
}
|
||||
else
|
||||
if($type == 'bug' or $type == 'case')
|
||||
{
|
||||
/* Get createdVersion. */
|
||||
$createdVersion = $this->dao->select('createdVersion')->from(TABLE_PRODUCT)
|
||||
->where('id')->eq($rootID)
|
||||
->fetch('createdVersion');
|
||||
}
|
||||
|
||||
if($createdVersion and version_compare($createdVersion, '4.1', '>') and $type != 'story')
|
||||
{
|
||||
if($type == 'bug' or $type == 'case')
|
||||
if($createdVersion and version_compare($createdVersion, '4.1', '>'))
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_MODULE)
|
||||
->where('root')->eq((int)$rootID)
|
||||
@@ -69,20 +60,9 @@ class treeModel extends model
|
||||
->orderBy('grade desc, type desc, `order`')
|
||||
->get();
|
||||
}
|
||||
|
||||
/* $type == 'task' */
|
||||
$products = $this->dao->select('product')->from(TABLE_PROJECTPRODUCT)
|
||||
->where('project')->eq($rootID)
|
||||
->fetchPairs();
|
||||
$products = implode(',', $products);
|
||||
return $this->dao->select('*')->from(TABLE_MODULE)
|
||||
->where("((root = $rootID and type = 'task') OR (root in($products) and type = 'story'))")
|
||||
->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi()
|
||||
->orderBy('grade desc, type, `order`')
|
||||
->get();
|
||||
}
|
||||
|
||||
/* $createdVersion > 4.1 or $type == 'story' */
|
||||
/* $createdVersion < 4.1 or $type == 'story','task'. */
|
||||
return $this->dao->select('*')->from(TABLE_MODULE)
|
||||
->where('root')->eq((int)$rootID)
|
||||
->andWhere('type')->eq($type)
|
||||
@@ -103,8 +83,8 @@ class treeModel extends model
|
||||
public function getOptionMenu($rootID, $type = 'story', $startModule = 0)
|
||||
{
|
||||
$treeMenu = array();
|
||||
$stmt = $this->dbh->query($this->buildMenuQuery($rootID, $type, $startModule));
|
||||
$modules = array();
|
||||
$stmt = $this->dbh->query($this->buildMenuQuery($rootID, $type, $startModule));
|
||||
$modules = array();
|
||||
while($module = $stmt->fetch()) $modules[$module->id] = $module;
|
||||
|
||||
foreach($modules as $module)
|
||||
@@ -156,6 +136,96 @@ class treeModel extends model
|
||||
return $lastMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an option menu of task in html.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param int $startModule
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTaskOptionMenu($rootID, $productID = 0, $startModule = 0)
|
||||
{
|
||||
/* If createdVersion <= 4.1, go to getOptionMenu(). */
|
||||
$createdVersion = $this->dao->select('openedVersion')->from(TABLE_PROJECT)
|
||||
->where('id')->eq($rootID)
|
||||
->fetch('openedVersion');
|
||||
$products = $this->loadModel('product')->getProductsByProject($rootID);
|
||||
if(!$createdVersion or version_compare($createdVersion, '4.1', '<=') or !$products)
|
||||
{
|
||||
return $this->getOptionMenu($rootID, 'task', $startModule);
|
||||
}
|
||||
|
||||
/* createdVersion > 4.1. */
|
||||
$startModulePath = '';
|
||||
if($startModule > 0)
|
||||
{
|
||||
$startModule = $this->getById($startModule);
|
||||
if($startModule)
|
||||
{
|
||||
$startModulePath = $startModule->path . '%';
|
||||
$modulePaths = explode(",", $startModulePath);
|
||||
$rootModule = $this->getById($modulePahts[0]);
|
||||
$productID = $rootModule->root;
|
||||
}
|
||||
}
|
||||
$treeMenu = array();
|
||||
$lastMenu[] = '/';
|
||||
foreach($products as $id => $product)
|
||||
{
|
||||
$modules = $this->dao->select('*')->from(TABLE_MODULE)
|
||||
->where("((root = $rootID and type = 'task') OR (root = $id and type = 'story'))")
|
||||
->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi()
|
||||
->orderBy('grade desc, type, `order`')
|
||||
->fetchAll('id');
|
||||
foreach($modules as $module)
|
||||
{
|
||||
$parentModules = explode(',', $module->path);
|
||||
$moduleName = '/' . $product;
|
||||
foreach($parentModules as $parentModuleID)
|
||||
{
|
||||
if(empty($parentModuleID) or !isset($modules[$parentModuleID])) continue;
|
||||
$moduleName .= '/' . $modules[$parentModuleID]->name;
|
||||
}
|
||||
$moduleName = rtrim($moduleName, '/');
|
||||
$moduleName .= "|$module->id\n";
|
||||
|
||||
if(isset($treeMenu[$module->id]) and !empty($treeMenu[$module->id]))
|
||||
{
|
||||
if(isset($treeMenu[$module->parent]))
|
||||
{
|
||||
$treeMenu[$module->parent] .= $moduleName;
|
||||
}
|
||||
else
|
||||
{
|
||||
$treeMenu[$module->parent] = $moduleName;;
|
||||
}
|
||||
$treeMenu[$module->parent] .= $treeMenu[$module->id];
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($treeMenu[$module->parent]) and !empty($treeMenu[$module->parent]))
|
||||
{
|
||||
$treeMenu[$module->parent] .= $moduleName;
|
||||
}
|
||||
else
|
||||
{
|
||||
$treeMenu[$module->parent] = $moduleName;
|
||||
}
|
||||
}
|
||||
}
|
||||
$topMenu = @array_pop($treeMenu);
|
||||
$topMenu = explode("\n", trim($topMenu));
|
||||
foreach($topMenu as $menu)
|
||||
{
|
||||
if(!strpos($menu, '|')) continue;
|
||||
list($label, $moduleID) = explode('|', $menu);
|
||||
$lastMenu[$moduleID] = $label;
|
||||
}
|
||||
}
|
||||
return $lastMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tree menu in html.
|
||||
*
|
||||
@@ -199,6 +269,89 @@ class treeModel extends model
|
||||
return $lastMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tree menu of task in html.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param int $productID
|
||||
* @param int $startModule
|
||||
* @param int $userFunc
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTaskTreeMenu($rootID, $productID = 0, $startModule = 0, $userFunc, $extra = '')
|
||||
{
|
||||
/* If createdVersion <= 4.1, go to getTreeMenu(). */
|
||||
$createdVersion = $this->dao->select('openedVersion')->from(TABLE_PROJECT)
|
||||
->where('id')->eq($rootID)
|
||||
->fetch('openedVersion');
|
||||
$products = $this->loadModel('product')->getProductsByProject($rootID);
|
||||
if(!$createdVersion or version_compare($createdVersion, '4.1', '<=') or !$products)
|
||||
{
|
||||
return $this->getTreeMenu($rootID, 'task', $startModule, $userFunc, $extra);
|
||||
}
|
||||
|
||||
/* createdVersion > 4.1. */
|
||||
$menu = "<ul class='tree'>";
|
||||
|
||||
/* Set the start module. */
|
||||
$startModulePath = '';
|
||||
if($startModule > 0)
|
||||
{
|
||||
$startModule = $this->getById($startModule);
|
||||
if($startModule) $startModulePath = $startModule->path . '%';
|
||||
}
|
||||
|
||||
foreach($products as $id => $product)
|
||||
{
|
||||
if($userFunc[1] == 'createTaskManageLink')
|
||||
{
|
||||
$menu .= "<li>" . $product;
|
||||
}
|
||||
else
|
||||
{
|
||||
$menu .= "<li>" . html::a(helper::createLink('project', 'task', "root=$rootID&status=byProduct&praram=$id"), $product);
|
||||
}
|
||||
|
||||
/* tree menu. */
|
||||
$treeMenu = array();
|
||||
$query = $this->dao->select('*')->from(TABLE_MODULE)
|
||||
->where("((root = $rootID and type = 'task') OR (root = $id and type = 'story'))")
|
||||
->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi()
|
||||
->orderBy('grade desc, type, `order`')
|
||||
->get();
|
||||
$stmt = $this->dbh->query($query);
|
||||
while($module = $stmt->fetch())
|
||||
{
|
||||
$linkHtml = call_user_func($userFunc, $rootID, $id, $module, $extra);
|
||||
|
||||
if(isset($treeMenu[$module->id]) and !empty($treeMenu[$module->id]))
|
||||
{
|
||||
if(!isset($treeMenu[$module->parent])) $treeMenu[$module->parent] = '';
|
||||
$treeMenu[$module->parent] .= "<li>$linkHtml";
|
||||
$treeMenu[$module->parent] .= "<ul>" . $treeMenu[$module->id] . "</ul>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($treeMenu[$module->parent]) and !empty($treeMenu[$module->parent]))
|
||||
{
|
||||
$treeMenu[$module->parent] .= "<li>$linkHtml\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$treeMenu[$module->parent] = "<li>$linkHtml\n";
|
||||
}
|
||||
}
|
||||
$treeMenu[$module->parent] .= "</li>\n";
|
||||
}
|
||||
|
||||
$lastMenu = "<ul class='tree'>" . @array_pop($treeMenu) . "</ul>\n";
|
||||
$menu .= $lastMenu . '</li>';
|
||||
}
|
||||
return $menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tree menu of product document library.
|
||||
*
|
||||
@@ -320,9 +473,9 @@ class treeModel extends model
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createTaskLink($type, $module)
|
||||
public function createTaskLink($rootID, $productID, $module)
|
||||
{
|
||||
$linkHtml = html::a(helper::createLink('project', 'task', "root={$module->root}&type=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
|
||||
$linkHtml = html::a(helper::createLink('project', 'task', "root={$rootID}&type=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
|
||||
return $linkHtml;
|
||||
}
|
||||
|
||||
@@ -368,6 +521,32 @@ class treeModel extends model
|
||||
return $linkHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the task manage link of a module.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $module
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createTaskManageLink($rootID, $productID, $module)
|
||||
{
|
||||
$linkHtml = $module->name;
|
||||
$linkHtml .= $module->type != 'story' ? ' [' . strtoupper(substr($module->type, 0, 1)) . ']' : '';
|
||||
if($module->type == 'story')
|
||||
{
|
||||
if(common::hasPriv('tree', 'browseTask')) $linkHtml .= ' ' . html::a(helper::createLink('tree', 'browsetask', "rootID=$rootID&productID=$productID&module={$module->id}"), $this->lang->tree->child);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(common::hasPriv('tree', 'edit')) $linkHtml .= ' ' . html::a(helper::createLink('tree', 'edit', "module={$module->id}&type=task"), $this->lang->tree->edit, '', 'class="iframe"');
|
||||
if(common::hasPriv('tree', 'browseTask')) $linkHtml .= ' ' . html::a(helper::createLink('tree', 'browsetask', "rootID=$rootID&productID=$productID&module={$module->id}"), $this->lang->tree->child);
|
||||
if(common::hasPriv('tree', 'delete')) $linkHtml .= ' ' . html::a(helper::createLink('tree', 'delete', "root={$module->root}&module={$module->id}"), $this->lang->delete, 'hiddenwin');
|
||||
if(common::hasPriv('tree', 'updateorder')) $linkHtml .= ' ' . html::input("orders[$module->id]", $module->order, 'style="width:30px;text-align:center"');
|
||||
}
|
||||
return $linkHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create link of a bug.
|
||||
*
|
||||
@@ -437,10 +616,41 @@ class treeModel extends model
|
||||
->andWhere('parent')->eq((int)$moduleID)
|
||||
->beginIF($type == 'story')->andWhere('type')->eq($type)->fi()
|
||||
->beginIF($type != 'story')->andWhere('type')->in("$type,story")->fi()
|
||||
->orderBy('type,`order`')
|
||||
->orderBy('type desc,`order`')
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sons of a task module.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param int $productID
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTaskSons($rootID, $productID, $moduleID)
|
||||
{
|
||||
if($moduleID)
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_MODULE)
|
||||
->where('root')->eq((int)$rootID)
|
||||
->andWhere('parent')->eq((int)$moduleID)
|
||||
->andWhere('type')->in("task,story")
|
||||
->orderBy('type,`order`')
|
||||
->fetchAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_MODULE)
|
||||
->where('parent')->eq(0)
|
||||
->andWhere("root = $rootID and type = 'task'")
|
||||
->orWhere("root = $productID and type = 'story'")
|
||||
->orderBy('type,`order`')
|
||||
->fetchAll();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id list of a module's childs.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* The browse view file of tree module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2013 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
|
||||
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
|
||||
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
||||
* @package tree
|
||||
* @version $Id: browse.html.php 4796 2013-06-06 02:21:59Z zhujinyonging@gmail.com $
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/treeview.html.php';?>
|
||||
<table class='cont-lt5'>
|
||||
<tr valign='top'>
|
||||
<td class='side'>
|
||||
<form method='post' target='hiddenwin' action='<?php echo $this->createLink('tree', 'updateOrder', "root={$root->id}&viewType=task");?>'>
|
||||
<table class='table-1'>
|
||||
<caption><?php echo $title;?></caption>
|
||||
<tr>
|
||||
<td>
|
||||
<div id='main'><?php echo $modules;?></div>
|
||||
<div class='a-center'>
|
||||
<?php if(common::hasPriv('tree', 'updateorder')) echo html::submitButton($lang->tree->updateOrder);?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
<td class='divider'></td>
|
||||
<td>
|
||||
<form method='post' target='hiddenwin' action='<?php echo $this->createLink('tree', 'manageChild', "root={$root->id}&viewType=task");?>'>
|
||||
<table align='center' class='table-1'>
|
||||
<?php $manageChild = 'manageTaskChild';?>
|
||||
<caption><?php echo $lang->tree->$manageChild;?></caption>
|
||||
<tr>
|
||||
<td width='10%'>
|
||||
<nobr>
|
||||
<?php
|
||||
echo html::a($this->createLink('tree', 'browsetask', "root={$root->id}&productID=$productID&viewType=task"), $root->name);
|
||||
echo $lang->arrow;
|
||||
foreach($parentModules as $module)
|
||||
{
|
||||
echo html::a($this->createLink('tree', 'browsetask', "root={$root->id}&productID=$productID&moduleID=$module->id"), $module->name);
|
||||
echo $lang->arrow;
|
||||
}
|
||||
?>
|
||||
</nobr>
|
||||
</td>
|
||||
<td id='moduleBox'>
|
||||
<?php
|
||||
if($allProject)
|
||||
{
|
||||
echo html::select('allProject', $allProject, '', 'onchange=syncProject(this)');
|
||||
echo html::select('projectModule', $projectModules, '');
|
||||
echo html::commonButton($lang->tree->syncFromProject, "id='copyModule' onclick='syncModule($currentProject, \"task\")'");
|
||||
}
|
||||
echo '<br />';
|
||||
$maxOrder = 0;
|
||||
echo '<div id="sonModule">';
|
||||
foreach($sons as $sonModule)
|
||||
{
|
||||
if($sonModule->order > $maxOrder) $maxOrder = $sonModule->order;
|
||||
$disabled = $sonModule->type == 'task' ? '' : 'disabled="true"';
|
||||
echo '<span>' . html::input("modules[id$sonModule->id]", $sonModule->name, 'class=text-3 style="margin-bottom:5px" ' . $disabled) . '<br /></span>';
|
||||
}
|
||||
for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) echo '<span>' . html::input("modules[]", '', 'class=text-3 style="margin-bottom:5px"') . '<br /></span>';
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan='2'>
|
||||
<?php
|
||||
echo html::submitButton() . html::backButton();
|
||||
echo html::hidden('parentModuleID', $currentModuleID);
|
||||
echo html::hidden('maxOrder', $maxOrder);
|
||||
?>
|
||||
<input type='hidden' value='<?php echo $currentModuleID;?>' name='parentModuleID' />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
Reference in New Issue
Block a user