* Fix bug of view a flow page by path_info.

This commit is contained in:
liugang
2019-07-24 17:49:40 +08:00
parent 55c45acae5
commit aecff99932
2 changed files with 110 additions and 12 deletions
+56 -12
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,54 @@ 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->rawURI = $this->URI;
$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. */
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.
+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.
*