Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
jinianlan
2019-07-24 20:05:55 +08:00
13 changed files with 135 additions and 13 deletions
+59 -13
View File
@@ -233,9 +233,7 @@ class router extends baseRouter
*/
public function loadConfig($moduleName, $appName = '')
{
$appName = '';
return parent::loadModuleConfig($moduleName, $appName);
return parent::loadModuleConfig($moduleName);
}
/**
@@ -278,16 +276,15 @@ class router extends baseRouter
{
if($flow->buildin && $this->methodName == 'browselabel')
{
$this->workflowModule = $this->moduleName;
$this->workflowMethod = 'browse';
$this->workflowModule = $this->moduleName;
$this->workflowMethod = 'browse';
$this->loadModuleConfig('workflowaction');
$this->loadModuleConfig('workflowaction');
$moduleName = 'flow';
$methodName = 'browse';
$moduleName = 'flow';
$methodName = 'browse';
$this->setModuleName($moduleName);
$this->setMethodName($methodName);
$this->setFlowURI($moduleName, $methodName);
}
else
{
@@ -302,8 +299,7 @@ class router extends baseRouter
$moduleName = 'flow';
$methodName = in_array($this->methodName, $this->config->workflowaction->default->actions) ? $this->methodName : 'operate';
$this->setModuleName($moduleName);
$this->setMethodName($methodName);
$this->setFlowURI($moduleName, $methodName);
}
}
}
@@ -313,6 +309,56 @@ class router extends baseRouter
return parent::setControlFile($exitIfNone);
}
/**
* Reset URI to flow's URI.
*
* @param string $moduleName
* @param string $methodName
* @access public
* @return void
*/
public function setFlowURI($moduleName, $methodName)
{
$this->setModuleName($moduleName);
$this->setMethodName($methodName);
if($this->config->requestType != 'GET')
{
$params = explode($this->config->requestFix, $this->URI);
/* Remove module and method. */
$params = array_slice($params, 2);
/* Prepend other params. */
if($methodName == 'operate') array_unshift($params, $this->workflowMethod);
array_unshift($params, $this->workflowModule);
array_unshift($params, $methodName);
array_unshift($params, $moduleName);
$this->URI = implode($this->config->requestFix, $params);
}
else
{
$params = parse_url($this->URI);
/* Extract $path and $query from $params. */
extract($params);
parse_str($query, $params);
/* Remove module and method. */
unset($params[$this->config->moduleVar]);
unset($params[$this->config->methodVar]);
$params = array_reverse($params);
/* Prepend other params. */
$params['module'] = $this->workflowModule;
$params[$this->config->methodVar] = $methodName;
$params[$this->config->moduleVar] = $moduleName;
$params = array_reverse($params);
$this->URI = $path . '?' . http_build_query($params);
}
}
/**
* PATH_INFO方式解析,获取$URI和$viewType。
* Parse PATH_INFO, get the $URI and $viewType.
@@ -360,7 +406,7 @@ class router extends baseRouter
$passedParams = array_reverse($passedParams);
if(!in_array($this->workflowMethod, $this->config->workflowaction->default->actions))
{
$passedParams['method'] = $this->workflowMethod;
$passedParams['action'] = $this->workflowMethod;
}
$passedParams['module'] = $this->workflowModule;
+54
View File
@@ -20,6 +20,60 @@ helper::import(dirname(dirname(__FILE__)) . '/base/pager/pager.class.php');
*/
class pager extends basePager
{
/**
* 设置模块名。
* Set the $moduleName property.
*
* @access public
* @return void
*/
public function setModuleName()
{
if(isset($this->app->workflowModule))
{
$this->moduleName = $this->app->workflowModule;
}
else
{
$this->moduleName = $this->app->getModuleName();
}
}
/**
* 设置方法名。
* Set the $methodName property.
*
* @access public
* @return void
*/
public function setMethodName()
{
if(isset($this->app->workflowMethod))
{
$this->methodName = $this->app->workflowMethod;
}
else
{
$this->methodName = $this->app->getMethodName();
}
}
/**
* 从请求网址中获取记录总数、每页记录数、页码。
* Get recTotal, recPerpage, pageID from the request params, and add them to params.
*
* @access public
* @return void
*/
public function setParams()
{
parent::setParams();
if(isset($this->app->workflowModule) && isset($this->app->workflowMethod))
{
unset($this->params['module']);
}
}
/**
* Show pager.
*
+2
View File
@@ -554,6 +554,8 @@ class bug extends control
$productName = $this->products[$productID];
$branches = $this->session->currentProductType == 'normal' ? array() : $this->loadModel('branch')->getPairs($bug->product);
$this->executeHooks($this->methodName, $bugID);
/* Header and positon. */
$this->view->title = "BUG #$bug->id $bug->title - " . $this->products[$productID];
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $productName);
+2
View File
@@ -230,6 +230,8 @@ class build extends control
$this->view->type = $type;
}
$this->executeHooks($this->methodName, $buildID);
/* Assign. */
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->build = $build;
+2
View File
@@ -394,6 +394,8 @@ class product extends control
$this->app->loadClass('pager', $static = true);
$pager = new pager(0, 30, 1);
$this->executeHooks($this->methodName, $productID);
$this->view->title = $product->name . $this->lang->colon . $this->lang->product->view;
$this->view->position[] = html::a($this->createLink($this->moduleName, 'browse'), $product->name);
$this->view->position[] = $this->lang->product->view;
+2
View File
@@ -276,6 +276,8 @@ class productplan extends control
$orderBy = str_replace('id', 'order', $orderBy);
}
$this->executeHooks($this->methodName, $planID);
if($plan->parent > 0) $this->view->parentPlan = $this->productplan->getById($plan->parent);
if($plan->parent == '-1') $this->view->childrenPlans = $this->productplan->getChildren($plan->id);
+2
View File
@@ -1441,6 +1441,8 @@ class project extends control
$this->app->loadClass('pager', $static = true);
$pager = new pager(0, 30, 1);
$this->executeHooks($this->methodName, $projectID);
$this->view->title = $this->lang->project->view;
$this->view->position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name);
$this->view->position[] = $this->view->title;
+2
View File
@@ -162,6 +162,8 @@ class release extends control
$this->commonAction($release->product);
$product = $this->product->getById($release->product);
$this->executeHooks($this->methodName, $releaseID);
$this->view->title = "RELEASE #$release->id $release->name/" . $product->name;
$this->view->position[] = $this->lang->release->view;
$this->view->release = $release;
+2
View File
@@ -705,6 +705,8 @@ class story extends control
if($project->status == 'done') $from = '';
}
$this->executeHooks($this->methodName, $storyID);
$title = "STORY #$story->id $story->title - $product->name";
$position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$story->branch"), $product->name);
$position[] = $this->lang->story->common;
+2
View File
@@ -606,6 +606,8 @@ class task extends control
$project = $this->project->getById($task->project);
$this->project->setMenu($this->project->getPairs(), $project->id);
$this->executeHooks($this->methodName, $taskID);
$title = "TASK#$task->id $task->name / $project->name";
$position[] = html::a($this->createLink('project', 'browse', "projectID=$task->project"), $project->name);
$position[] = $this->lang->task->common;
+2
View File
@@ -516,6 +516,8 @@ class testcase extends control
->fetch('count');
$case->caseFails = $caseFails;
$this->executeHooks($this->methodName, $caseID);
$this->view->position[] = $this->lang->testcase->common;
$this->view->position[] = $this->lang->testcase->view;
+2
View File
@@ -142,6 +142,8 @@ class testsuite extends control
$this->app->loadClass('pager', $static = true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
$this->executeHooks($this->methodName, $suiteID);
$this->view->title = "SUITE #$suite->id $suite->name/" . $this->products[$productID];
$this->view->position[] = html::a($this->createLink('testsuite', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = $this->lang->testsuite->common;
+2
View File
@@ -216,6 +216,8 @@ class testtask extends control
$this->testtask->setMenu($this->products, $productID, $task->branch, $taskID);
$this->executeHooks($this->methodName, $taskID);
$this->view->title = "TASK #$task->id $task->name/" . $this->products[$productID];
$this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = $this->lang->testtask->common;