Merge branch 'zentaocloud/dingguodong' into 'master'
* Add codes for saas extension. See merge request easycorp/zentaopms!3303
This commit is contained in:
@@ -416,7 +416,7 @@ class baseControl
|
||||
$moduleName = basename(dirname(dirname(realpath($viewFile))));
|
||||
$extPath = $this->app->getModuleExtPath('', $moduleName, 'view');
|
||||
|
||||
$checkedOrder = array('site', 'custom', 'vision', 'xuan', 'common');
|
||||
$checkedOrder = array('site', 'saas', 'custom', 'vision', 'xuan', 'common');
|
||||
$fileName = basename($viewFile);
|
||||
foreach($checkedOrder as $checkedType)
|
||||
{
|
||||
@@ -805,6 +805,12 @@ class baseControl
|
||||
$commonActionExtFile = $actionExtPath['custom'] . strtolower($methodName) . '.php';
|
||||
if(file_exists($commonActionExtFile)) $file2Included = $commonActionExtFile;
|
||||
|
||||
if(!empty($actionExtPath['saas']))
|
||||
{
|
||||
$commonActionExtFile = $actionExtPath['saas'] . strtolower($methodName) . '.php';
|
||||
if(file_exists($commonActionExtFile)) $file2Included = $commonActionExtFile;
|
||||
}
|
||||
|
||||
if(!empty($actionExtPath['site']))
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -260,6 +260,7 @@ class baseModel
|
||||
$moduleExtPath = $this->app->getModuleExtPath($this->appName, $moduleName, 'model');
|
||||
if(!empty($moduleExtPath['site'])) $extensionFile = $moduleExtPath['site'] . 'class/' . $extensionName . '.class.php';
|
||||
if(!isset($extensionFile) or !file_exists($extensionFile)) $extensionFile = $moduleExtPath['custom'] . 'class/' . $extensionName . '.class.php';
|
||||
if(!isset($extensionFile) or !file_exists($extensionFile)) $extensionFile = $moduleExtPath['saas'] . 'class/' . $extensionName . '.class.php';
|
||||
if(!isset($extensionFile) or !file_exists($extensionFile)) $extensionFile = $moduleExtPath['vision'] . 'class/' . $extensionName . '.class.php';
|
||||
if(!isset($extensionFile) or !file_exists($extensionFile)) $extensionFile = $moduleExtPath['xuan'] . 'class/' . $extensionName . '.class.php';
|
||||
if(!isset($extensionFile) or !file_exists($extensionFile)) $extensionFile = $moduleExtPath['common'] . 'class/' . $extensionName . '.class.php';
|
||||
|
||||
@@ -1390,6 +1390,9 @@ class baseRouter
|
||||
|
||||
if($this->checkModuleName($moduleName))
|
||||
{
|
||||
$modulePath = $this->getExtensionRoot() . 'saas' . DS . $moduleName . DS;
|
||||
if(is_dir($modulePath) and (file_exists($modulePath . 'control.php') or file_exists($modulePath . 'model.php'))) return $modulePath;
|
||||
|
||||
/* 1. 最后尝试在定制开发中寻找。 Finally, try to find the module in the custom dir. */
|
||||
$modulePath = $this->getExtensionRoot() . 'custom' . DS . $moduleName . DS;
|
||||
if(is_dir($modulePath) and (file_exists($modulePath . 'control.php') or file_exists($modulePath . 'model.php'))) return $modulePath;
|
||||
@@ -1432,8 +1435,10 @@ class baseRouter
|
||||
*/
|
||||
public function getModuleExtPath($appName, $moduleName, $ext)
|
||||
{
|
||||
$saasExtPath = $this->getExtensionRoot() . 'saas' . DS . $moduleName . DS . 'ext' . DS . $ext . DS;
|
||||
|
||||
/* 检查失败或者extensionLevel为0,直接返回空。If check failed or extensionLevel == 0, return empty array. */
|
||||
if(!$this->checkModuleName($moduleName) or $this->config->framework->extensionLevel == 0) return array();
|
||||
if(!$this->checkModuleName($moduleName) or $this->config->framework->extensionLevel == 0) return array('saas' => $saasExtPath);
|
||||
|
||||
$paths = array();
|
||||
|
||||
@@ -1442,10 +1447,16 @@ class baseRouter
|
||||
$paths['xuan'] = $this->getExtensionRoot() . 'xuan' . DS . $moduleName . DS . 'ext' . DS . $ext . DS;
|
||||
$paths['vision'] = $this->config->vision == 'rnd' ? '' : $this->basePath . 'extension' . DS . $this->config->vision . DS . $moduleName . DS . 'ext' . DS . $ext . DS;
|
||||
$paths['custom'] = $this->getExtensionRoot() . 'custom' . DS . $moduleName . DS . 'ext' . DS . $ext . DS;
|
||||
if($this->config->framework->extensionLevel == 1) return $paths;
|
||||
if($this->config->framework->extensionLevel == 1)
|
||||
{
|
||||
$paths['saas'] = $saasExtPath;
|
||||
return $paths;
|
||||
}
|
||||
|
||||
/* When extensionLevel == 2. */
|
||||
$paths['site'] = empty($this->siteCode) ? '' : $this->getExtensionRoot() . $this->config->edition . DS . $moduleName . DS . 'ext' . DS . '_' . $this->siteCode . DS . $ext . DS;
|
||||
$paths['saas'] = $saasExtPath;
|
||||
|
||||
return $paths;
|
||||
}
|
||||
|
||||
@@ -1494,6 +1505,12 @@ class baseRouter
|
||||
/* 如果扩展目录为空,不包含任何扩展文件。If there's no ext paths return false.*/
|
||||
if(empty($moduleExtPaths)) return false;
|
||||
|
||||
if(!empty( $moduleExtPaths['saas']))
|
||||
{
|
||||
$this->extActionFile = $moduleExtPaths['saas'] . $this->methodName . '.php';
|
||||
if(file_exists($this->extActionFile)) return true;
|
||||
}
|
||||
|
||||
/* 1. 如果extensionLevel == 2,且扩展文件存在,返回该站点扩展文件。 If extensionLevel == 2 and site extensionFile exists, return it. */
|
||||
if($this->config->framework->extensionLevel == 2 and !empty( $moduleExtPaths['site']))
|
||||
{
|
||||
@@ -2322,6 +2339,7 @@ class baseRouter
|
||||
if(!empty($extConfigPath['common'])) $commonExtConfigFiles = helper::ls($extConfigPath['common'], '.php');
|
||||
if(!empty($extConfigPath['xuan'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['xuan'], '.php'));
|
||||
if(!empty($extConfigPath['vision'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['vision'], '.php'));
|
||||
if(!empty($extConfigPath['saas'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['saas'], '.php'));
|
||||
if(!empty($extConfigPath['custom'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['custom'], '.php'));
|
||||
}
|
||||
if($config->framework->extensionLevel == 2 and !empty($extConfigPath['site'])) $siteExtConfigFiles = helper::ls($extConfigPath['site'], '.php');
|
||||
@@ -2427,6 +2445,9 @@ class baseRouter
|
||||
{
|
||||
$path = $moduleName . DS . 'lang' . DS . $this->clientLang . '.php';
|
||||
|
||||
$modulePath = $this->getExtensionRoot() . 'saas' . DS;
|
||||
if(file_exists($modulePath . $path)) return $modulePath . $path;
|
||||
|
||||
/* 1. 如果通用版本里有此模块,优先使用。 If module is in the open edition, use it. */
|
||||
$modulePath = $this->getModuleRoot($appName);
|
||||
if(file_exists($modulePath . $path)) return $modulePath . $path;
|
||||
@@ -2489,6 +2510,7 @@ class baseRouter
|
||||
if(!empty($extLangPath['xuan'])) $commonExtLangFiles = array_merge($commonExtLangFiles, helper::ls($extLangPath['xuan'] . $this->clientLang, '.php'));
|
||||
if(!empty($extLangPath['vision'])) $commonExtLangFiles = array_merge($commonExtLangFiles, helper::ls($extLangPath['vision'] . $this->clientLang, '.php'));
|
||||
if(!empty($extLangPath['custom'])) $commonExtLangFiles = array_merge($commonExtLangFiles, helper::ls($extLangPath['custom'] . $this->clientLang, '.php'));
|
||||
if(!empty($extLangPath['saas'])) $commonExtLangFiles = array_merge($commonExtLangFiles, helper::ls($extLangPath['saas'] . $this->clientLang, '.php'));
|
||||
}
|
||||
if($this->config->framework->extensionLevel == 2 and !empty($extLangPath['site'])) $siteExtLangFiles = helper::ls($extLangPath['site'] . $this->clientLang, '.php');
|
||||
$extLangFiles = array_merge($commonExtLangFiles, $siteExtLangFiles);
|
||||
|
||||
@@ -86,7 +86,7 @@ class control extends baseControl
|
||||
|
||||
/**
|
||||
* Det default priv by workflow.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
@@ -197,6 +197,7 @@ class control extends baseControl
|
||||
$commonExtViewFile = $viewExtPath['common'] . $this->devicePrefix . $methodName . ".{$viewType}.php";
|
||||
$xuanExtViewFile = $viewExtPath['xuan'] . $this->devicePrefix . $methodName . ".{$viewType}.php";
|
||||
$visionExtViewFile = $viewExtPath['vision'] . $this->devicePrefix . $methodName . ".{$viewType}.php";
|
||||
$saasExtViewFile = $viewExtPath['saas'] . $this->devicePrefix . $methodName . ".{$viewType}.php";
|
||||
$customExtViewFile = $viewExtPath['custom'] . $this->devicePrefix . $methodName . ".{$viewType}.php";
|
||||
$siteExtViewFile = empty($viewExtPath['site']) ? '' : $viewExtPath['site'] . $this->devicePrefix . $methodName . ".{$viewType}.php";
|
||||
|
||||
@@ -217,6 +218,10 @@ class control extends baseControl
|
||||
{
|
||||
$viewFile = $xuanExtViewFile;
|
||||
}
|
||||
else if(file_exists($saasExtViewFile))
|
||||
{
|
||||
$viewFile = $saasExtViewFile;
|
||||
}
|
||||
else if(file_exists($commonExtViewFile))
|
||||
{
|
||||
$viewFile = $commonExtViewFile;
|
||||
@@ -235,10 +240,11 @@ class control extends baseControl
|
||||
$commonExtHookFiles = glob($viewExtPath['vision'] . $this->devicePrefix . $methodName . ".*.{$viewType}.hook.php");
|
||||
}
|
||||
$xuanExtHookFiles = glob($viewExtPath['xuan'] . $this->devicePrefix . $methodName . ".*.{$viewType}.hook.php");
|
||||
$saasExtHookFiles = glob($viewExtPath['saas'] . $this->devicePrefix . $methodName . ".*.{$viewType}.hook.php");
|
||||
$customExtHookFiles = glob($viewExtPath['custom'] . $this->devicePrefix . $methodName . ".*.{$viewType}.hook.php");
|
||||
|
||||
$siteExtHookFiles = empty($viewExtPath['site']) ? '' : glob($viewExtPath['site'] . $this->devicePrefix . $methodName . ".*.{$viewType}.hook.php");
|
||||
$extHookFiles = array_merge((array)$commonExtHookFiles, (array)$xuanExtHookFiles, (array)$customExtHookFiles, (array)$siteExtHookFiles);
|
||||
$extHookFiles = array_merge((array)$commonExtHookFiles, (array)$xuanExtHookFiles, (array)$saasExtHookFiles, (array)$customExtHookFiles, (array)$siteExtHookFiles);
|
||||
}
|
||||
|
||||
if(!empty($extHookFiles)) return array('viewFile' => $viewFile, 'hookFiles' => $extHookFiles);
|
||||
@@ -342,9 +348,9 @@ class control extends baseControl
|
||||
}
|
||||
|
||||
/**
|
||||
* Set workflow export fields
|
||||
*
|
||||
* @param array $fields
|
||||
* Set workflow export fields
|
||||
*
|
||||
* @param array $fields
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
|
||||
@@ -327,6 +327,7 @@ class router extends baseRouter
|
||||
if(!empty($extConfigPath['common'])) $commonExtConfigFiles = helper::ls($extConfigPath['common'], '.php');
|
||||
if(!empty($extConfigPath['xuan'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['xuan'], '.php'));
|
||||
if(!empty($extConfigPath['vision'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['vision'], '.php'));
|
||||
if(!empty($extConfigPath['saas'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['saas'], '.php'));
|
||||
if(!empty($extConfigPath['custom'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['custom'], '.php'));
|
||||
}
|
||||
if($config->framework->extensionLevel == 2 and !empty($extConfigPath['site'])) $siteExtConfigFiles = helper::ls($extConfigPath['site'], '.php');
|
||||
|
||||
Reference in New Issue
Block a user