Merge branch 'master' of https://gitlab.zcorp.cc/easycorp/zentaopms into zentaopms_289
This commit is contained in:
@@ -114,6 +114,8 @@ class editor extends control
|
||||
|
||||
$fileName = basename($filePath);
|
||||
if(strpos($fileName, '.') !== false) $extension = substr($fileName, strpos($fileName, '.') + 1);
|
||||
if(strtolower($action) == 'newjs') $extension = 'js';
|
||||
if(strtolower($action) == 'newcss') $extension = 'css';
|
||||
}
|
||||
$this->view->fileContent = $fileContent;
|
||||
$this->view->filePath = $filePath;
|
||||
|
||||
+53
-15
@@ -14,6 +14,7 @@ class editorModel extends model
|
||||
/**
|
||||
* Get module files, contain control's methods and model's method but except ext.
|
||||
*
|
||||
* @param string $moduleName
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -45,9 +46,9 @@ class editorModel extends model
|
||||
/**
|
||||
* Get extension files.
|
||||
*
|
||||
* @param int $extPath
|
||||
* @param string $moduleName
|
||||
* @access public
|
||||
* @return void
|
||||
* @return array
|
||||
*/
|
||||
public function getExtensionFiles($moduleName)
|
||||
{
|
||||
@@ -68,9 +69,22 @@ class editorModel extends model
|
||||
{
|
||||
foreach(glob($extensionFullDir . '*') as $extensionFullFile)
|
||||
{
|
||||
$fileName = basename($extensionFullFile);
|
||||
if($fileName == 'index.html') continue;
|
||||
$extensionList[$extType][$extensionFullDir][$extensionFullFile] = $fileName;
|
||||
if($ext == 'model' and is_dir($extensionFullFile))
|
||||
{
|
||||
$extModelDir = $extensionFullFile;
|
||||
foreach(glob($extModelDir . '/*') as $extModelFile)
|
||||
{
|
||||
$fileName = basename($extModelFile);
|
||||
if($fileName == 'index.html') continue;
|
||||
$extensionList[$extType][$extensionFullDir][$extensionFullFile][$extModelFile] = $fileName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$fileName = basename($extensionFullFile);
|
||||
if($fileName == 'index.html') continue;
|
||||
$extensionList[$extType][$extensionFullDir][$extensionFullFile] = $fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,9 +149,10 @@ class editorModel extends model
|
||||
/**
|
||||
* Print tree from module files.
|
||||
*
|
||||
* @param int $files
|
||||
* @param array $files
|
||||
* @param bool $isRoot
|
||||
* @access public
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
public function printTree($files, $isRoot = true)
|
||||
{
|
||||
@@ -195,12 +210,22 @@ class editorModel extends model
|
||||
|
||||
if(strpos($filePath, DS . 'ext' . DS) !== false)
|
||||
{
|
||||
switch($fileName)
|
||||
$parentName = basename(dirname($filePath));
|
||||
if($fileName == 'lang' or $fileName == 'js' or $fileName == 'css')
|
||||
{
|
||||
case 'lang': $tree .= $file; break;
|
||||
case 'js': $tree .= "$file " . html::a($this->getExtendLink($filePath, "newJS"), $this->lang->editor->newExtend, 'editWin'); break;
|
||||
case 'css': $tree .= "$file " . html::a($this->getExtendLink($filePath, "newCSS"), $this->lang->editor->newExtend, 'editWin'); break;
|
||||
default: $tree .= "$file " . html::a($this->getExtendLink($filePath, "newExtend"), $this->lang->editor->newExtend, 'editWin');
|
||||
$tree .= $file;
|
||||
}
|
||||
elseif($parentName == 'js')
|
||||
{
|
||||
$tree .= "$file " . html::a($this->getExtendLink($filePath, "newJS"), $this->lang->editor->newExtend, 'editWin');
|
||||
}
|
||||
elseif($parentName == 'css')
|
||||
{
|
||||
$tree .= "$file " . html::a($this->getExtendLink($filePath, "newCSS"), $this->lang->editor->newExtend, 'editWin');
|
||||
}
|
||||
else
|
||||
{
|
||||
$tree .= "$file " . html::a($this->getExtendLink($filePath, "newExtend"), $this->lang->editor->newExtend, 'editWin');
|
||||
}
|
||||
}
|
||||
elseif($fileName == 'model.php')
|
||||
@@ -468,10 +493,23 @@ EOD;
|
||||
{
|
||||
$fileExtension = 'php';
|
||||
$sourceFileName = basename($filePath);
|
||||
if(strpos($sourceFileName, '.') !== false) $fileExtension = substr($sourceFileName, strpos($sourceFileName, '.') + 1);
|
||||
if(strrpos($sourceFileName, '.') !== false) $fileExtension = substr($sourceFileName, strrpos($sourceFileName, '.') + 1);
|
||||
|
||||
$fileName = empty($_POST['fileName']) ? '' : trim($this->post->fileName);
|
||||
$moduleName = $this->getClassNameByPath($filePath);
|
||||
|
||||
$methodName = '';
|
||||
if(strtolower($action) == 'newjs')
|
||||
{
|
||||
if($fileExtension != 'js') $fileExtension = 'js';
|
||||
$methodName = basename($filePath);
|
||||
}
|
||||
if(strtolower($action) == 'newcss')
|
||||
{
|
||||
if($fileExtension != 'css') $fileExtension = 'css';
|
||||
$methodName = basename($filePath);
|
||||
}
|
||||
|
||||
$extPath = $this->app->getExtensionRoot() . 'custom' . DS . $moduleName . DS . 'ext' . DS;
|
||||
if($fileName and (strpos($fileName, '.' . $fileExtension) !== (strlen($fileName) - strlen($fileExtension) - 1))) $fileName .= '.' . $fileExtension;
|
||||
switch($action)
|
||||
@@ -499,8 +537,8 @@ EOD;
|
||||
if($action == 'method') return $extPath . basename($filePath, ".{$fileExtension}") . DS . $fileName;
|
||||
if($action == 'extend') return $filePath . DS . $fileName;
|
||||
if($action == 'config') return $extPath . 'config' . DS . $fileName;
|
||||
if($action == 'js') return $extPath . 'js' . DS . basename($fileName, ".{$fileExtension}") . DS . $fileName;
|
||||
if($action == 'css') return $extPath . 'css' . DS . basename($fileName, ".{$fileExtension}") . DS . $fileName;
|
||||
if($action == 'js') return $extPath . 'js' . DS . $methodName . DS . $fileName;
|
||||
if($action == 'css') return $extPath . 'css' . DS . $methodName . DS . $fileName;
|
||||
return $extPath . 'lang' . DS . str_replace('_', '-', $action) . DS . $fileName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,398 @@
|
||||
<?php
|
||||
class editorTest
|
||||
{
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('editor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get module files.
|
||||
*
|
||||
* @param string $moduleName
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function getModuleFilesTest($moduleName)
|
||||
{
|
||||
$moduleFiles = $this->objectModel->getModuleFiles($moduleName);
|
||||
$modulePath = $this->objectModel->app->getModulePath('', $moduleName);
|
||||
if(!isset($moduleFiles[$modulePath])) return 0;
|
||||
if(!isset($moduleFiles[$modulePath][$modulePath . 'model.php'])) return 0;
|
||||
if(!isset($moduleFiles[$modulePath][$modulePath . 'model.php'][$modulePath . 'model.php/create'])) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get extension files.
|
||||
*
|
||||
* @param string $moduleName
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function getExtensionFilesTest($moduleName)
|
||||
{
|
||||
$files = $this->objectModel->getExtensionFiles($moduleName);
|
||||
$edition = $this->objectModel->config->edition;
|
||||
|
||||
if($edition == 'open') return 1;
|
||||
|
||||
$extensionRoot = $this->objectModel->app->getExtensionRoot();
|
||||
$extensionPath = $extensionRoot . $edition . DS . $moduleName . DS . 'ext' . DS . 'control' . DS;
|
||||
if(!isset($files[$edition][$extensionPath])) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get two grade files.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function getTwoGradeFilesTest()
|
||||
{
|
||||
$extensionFullDir = $this->objectModel->app->getModulePath('', 'todo');
|
||||
$files = $this->objectModel->getTwoGradeFiles($extensionFullDir);
|
||||
if(!isset($files[$extensionFullDir . 'lang'])) return 0;
|
||||
if(!isset($files[$extensionFullDir . 'lang'][$extensionFullDir . 'lang' . DS . 'zh-cn.php'])) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for analysis.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function analysisTest()
|
||||
{
|
||||
$fileName = $this->objectModel->app->getModulePath('', 'todo') . 'control.php';
|
||||
$objects = $this->objectModel->analysis($fileName);
|
||||
if(!isset($objects[$fileName . '/create'])) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for print tree.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function printTreeTest()
|
||||
{
|
||||
$files = $this->objectModel->getModuleFiles('todo');
|
||||
$tree = $this->objectModel->printTree($files);
|
||||
if(strpos($tree, 'extendTree') === false) return 0;
|
||||
if(strpos($tree, 'L2hvbWUvei9zaXRlcy96ZW50YW9tYXgvbW9kdWxlL3RvZG8vbW9kZWwucGhw') === false) return 0;
|
||||
if(strpos($tree, 'L2hvbWUvei9zaXRlcy96ZW50YW9tYXgvbW9kdWxlL3RvZG8vbW9kZWwucGhwL2JhdGNoQ3JlYXRl') === false) return 0;
|
||||
if(strpos($tree, "target='editWin'") === false) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for add link for dir.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function addLink4DirTest()
|
||||
{
|
||||
$result = '';
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
|
||||
$controlPath = $modulePath . 'control.php';
|
||||
$link = $this->objectModel->addLink4Dir($controlPath);
|
||||
$result .= (strpos($link, 'newPage') === false ? 0 : 1) . ',';
|
||||
|
||||
$modelPath = $modulePath . 'model.php';
|
||||
$link = $this->objectModel->addLink4Dir($modelPath);
|
||||
$result .= (strpos($link, 'newMethod') === false ? 0 : 1) . ',';
|
||||
|
||||
$langPath = $modulePath . 'lang';
|
||||
$link = $this->objectModel->addLink4Dir($langPath);
|
||||
$result .= (strpos($link, 'lang') === false ? 0 : 1) . ',';
|
||||
|
||||
$edition = $this->objectModel->config->edition;
|
||||
if($edition == 'open') return $result . '1,1,1,1,1';
|
||||
|
||||
$extensionRoot = $this->objectModel->app->getExtensionRoot();
|
||||
$extensionPath = $extensionRoot . $edition . DS . 'todo' . DS . 'ext' . DS;
|
||||
$extControlPath = $extensionPath . 'control';
|
||||
$link = $this->objectModel->addLink4Dir($extControlPath);
|
||||
$result .= (strpos($link, 'newExtend') === false ? 0 : 1) . ',';
|
||||
|
||||
$extModelPath = $extensionPath . 'model';
|
||||
$link = $this->objectModel->addLink4Dir($extModelPath);
|
||||
$result .= (strpos($link, 'newExtend') === false ? 0 : 1) . ',';
|
||||
|
||||
$extJSPath = $extensionPath . 'js';
|
||||
$link = $this->objectModel->addLink4Dir($extJSPath);
|
||||
$result .= (strpos($link, 'newJS') === false ? 0 : 1) . ',';
|
||||
|
||||
$extCSSPath = $extensionPath . 'css';
|
||||
$link = $this->objectModel->addLink4Dir($extCSSPath);
|
||||
$result .= (strpos($link, 'newCSS') === false ? 0 : 1) . ',';
|
||||
|
||||
$extLangPath = $extensionPath . 'lang';
|
||||
$link = $this->objectModel->addLink4Dir($extLangPath);
|
||||
$result .= (strpos($link, 'lang') === false ? 0 : 1);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for add link for file.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function addLink4FileTest()
|
||||
{
|
||||
$result = '';
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
|
||||
$viewPath = $modulePath . 'view' . DS . 'create.html.php';
|
||||
$link = $this->objectModel->addLink4File($viewPath, 'create.html.php');
|
||||
$result .= ((strpos($link, 'override') === false || strpos($link, 'newHook') === false) ? 0 : 1) . ',';
|
||||
|
||||
$controlPath = $modulePath . 'control.php' . DS . 'create';
|
||||
$link = $this->objectModel->addLink4File($controlPath, 'create');
|
||||
$result .= (strpos($link, 'extendControl') === false ? 0 : 1) . ',';
|
||||
|
||||
$modelPath = $modulePath . 'model.php' . DS . 'create';
|
||||
$link = $this->objectModel->addLink4File($modelPath, 'create');
|
||||
$result .= (strpos($link, 'extendModel') === false ? 0 : 1) . ',';
|
||||
|
||||
$langPath = $modulePath . 'lang' . DS . 'zh-cn.php';
|
||||
$link = $this->objectModel->addLink4File($langPath, 'zh-cn.php');
|
||||
$result .= ((strpos($link, 'newzh_cn') === false || strpos($link, 'extendOther') === false) ? 0 : 1) . ',';
|
||||
|
||||
$configPath = $modulePath . 'config.php';
|
||||
$link = $this->objectModel->addLink4File($configPath, 'config.php');
|
||||
$result .= ((strpos($link, 'newConfig') === false || strpos($link, 'extendOther') === false) ? 0 : 1) . ',';
|
||||
|
||||
$edition = $this->objectModel->config->edition;
|
||||
if($edition == 'open') return $result . '1,1,1,1,1,1';
|
||||
|
||||
$extensionRoot = $this->objectModel->app->getExtensionRoot();
|
||||
$extensionPath = $extensionRoot . $edition . DS . 'todo' . DS . 'ext' . DS;
|
||||
$extControlPath = $extensionPath . 'control' . DS . 'create.php';
|
||||
$link = $this->objectModel->addLink4File($extControlPath, 'create.php');
|
||||
$result .= ((strpos($link, 'delete') === false || strpos($link, 'edit') === false) ? 0 : 1) . ',';
|
||||
|
||||
$extModelPath = $extensionPath . 'model' . DS . 'zentaobiz.class.php';
|
||||
$link = $this->objectModel->addLink4File($extModelPath, 'zentaobiz.class.php');
|
||||
$result .= ((strpos($link, 'delete') === false || strpos($link, 'edit') === false) ? 0 : 1) . ',';
|
||||
|
||||
$extJSPath = $extensionPath . 'js' . DS . 'create' . DS . 'zentaobiz.js';
|
||||
$link = $this->objectModel->addLink4File($extJSPath, 'zentaobiz.js');
|
||||
$result .= ((strpos($link, 'delete') === false || strpos($link, 'edit') === false) ? 0 : 1) . ',';
|
||||
|
||||
$extCSSPath = $extensionPath . 'css' . DS . 'create' . DS . 'zentaobiz.css';
|
||||
$link = $this->objectModel->addLink4File($extCSSPath, 'zentaobiz.css');
|
||||
$result .= ((strpos($link, 'delete') === false || strpos($link, 'edit') === false) ? 0 : 1) . ',';
|
||||
|
||||
$extLangPath = $extensionPath . 'lang' . DS . 'zh-cn' . DS . 'zentaobiz.php';
|
||||
$link = $this->objectModel->addLink4File($extLangPath, 'zentaobiz.php');
|
||||
$result .= ((strpos($link, 'delete') === false || strpos($link, 'edit') === false) ? 0 : 1) . ',';
|
||||
|
||||
$extConfigPath = $extensionPath . 'config' . DS . 'zentaobiz.php';
|
||||
$link = $this->objectModel->addLink4File($extConfigPath, 'zentaobiz.php');
|
||||
$result .= ((strpos($link, 'delete') === false || strpos($link, 'edit') === false) ? 0 : 1);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get extend link.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function getExtendLinkTest()
|
||||
{
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
$viewPath = $modulePath . 'view' . DS . 'create.html.php';
|
||||
$link = $this->objectModel->getExtendLink($viewPath, 'extendOther');
|
||||
return (strpos($link, 'edit') !== false && strpos($link, 'extendOther') !== false) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get api link.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function getAPILinkTest()
|
||||
{
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
$modelPath = $modulePath . 'model.php' . DS . 'create';
|
||||
$link = $this->objectModel->getAPILink($modelPath, 'extendModel');
|
||||
return (strpos($link, 'debug') !== false && strpos($link, 'extendModel') !== false) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for extend model.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function extendModelTest()
|
||||
{
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
$modelPath = $modulePath . 'model.php' . DS . 'create';
|
||||
$content = $this->objectModel->extendModel($modelPath);
|
||||
return strpos($content, 'public function create(') === false ? 0 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for extend control.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function extendControlTest()
|
||||
{
|
||||
$result = '';
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
$filePath = $modulePath . 'control.php' . DS . 'create';
|
||||
$content = $this->objectModel->extendControl($filePath, 'yes');
|
||||
$result .= strpos($content, 'class mytodo extends todo') !== false ? '1,' : '0,';
|
||||
|
||||
$content = $this->objectModel->extendControl($filePath, 'no');
|
||||
$result .= strpos($content, 'class todo extends control') !== false ? 1 : 0;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for new control.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function newControlTest()
|
||||
{
|
||||
$filePath = $this->objectModel->app->getModulePath('', 'todo') . 'control.php' . DS . 'create';
|
||||
$content = $this->objectModel->newControl($filePath);
|
||||
return (strpos($content, 'class todo extends control') !== false && strpos($content, 'public function create(') !== false) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get param.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function getParamTest()
|
||||
{
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo') . 'control.php';
|
||||
include $modulePath;
|
||||
$params = $this->objectModel->getParam('todo', 'create');
|
||||
return $params == "\$date='today', \$userID='', \$from='todo'" ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get method code.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function getMethodCodeTest()
|
||||
{
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo') . 'control.php';
|
||||
include $modulePath;
|
||||
$code = $this->objectModel->getMethodCode('todo', 'create');
|
||||
return strpos($code, "public function create(\$date = 'today', \$userID = '', \$from = 'todo')") !== false ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get save path.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSavePathTest()
|
||||
{
|
||||
$_POST['fileName'] = 'test.php';
|
||||
$result = '';
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
$extPath = $this->objectModel->app->getExtensionRoot() . 'custom' . DS;
|
||||
|
||||
$filePath = $modulePath . 'model.php' . DS . 'create';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'extendModel');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'model' . DS . 'test.php' ? '1,' : '0,';
|
||||
|
||||
$filePath = $modulePath . 'control.php' . DS . 'create';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'extendControl');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'control' . DS . 'create.php' ? '1,' : '0,';
|
||||
|
||||
$filePath = $modulePath . 'view' . DS . 'create.html.php';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'override');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'view' . DS . 'create.html.php' ? '1,' : '0,';
|
||||
|
||||
$filePath = $modulePath . 'config.php';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'extendOther');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'config' . DS . 'test.php' ? '1,' : '0,';
|
||||
|
||||
$filePath = $modulePath . 'lang' . DS . 'zh-cn.php';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'extendOther');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'lang' . DS . 'zh-cn' . DS . 'test.php' ? '1,' : '0,';
|
||||
|
||||
$_POST['fileName'] = 'create.html.hook.php';
|
||||
$filePath = $modulePath . 'view' . DS . 'create.html.php';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'newhook');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'view' . DS . 'create.html.hook.php' ? '1,' : '0,';
|
||||
|
||||
$_POST['fileName'] = 'test.php';
|
||||
$filePath = $modulePath . 'control.php';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'newmethod');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'control' . DS . 'test.php' ? '1,' : '0,';
|
||||
|
||||
$filePath = $extPath . 'todo' . DS . 'ext' . DS . 'control';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'newextend');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'control' . DS . 'test.php' ? '1,' : '0,';
|
||||
|
||||
$filePath = $modulePath . 'config.php';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'newconfig');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'config' . DS . 'test.php' ? '1,' : '0,';
|
||||
|
||||
$_POST['fileName'] = 'test.js';
|
||||
$filePath = $extPath . 'todo' . DS . 'ext' . DS . 'js' . DS . 'create' . DS;
|
||||
$path = $this->objectModel->getSavePath($filePath, 'newJS');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'js' . DS . 'create' . DS . 'test.js' ? '1,' : '0,';
|
||||
|
||||
$_POST['fileName'] = 'test.css';
|
||||
$filePath = $extPath . 'todo' . DS . 'ext' . DS . 'css' . DS . 'create' . DS;
|
||||
$path = $this->objectModel->getSavePath($filePath, 'newCSS');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'css' . DS . 'create' . DS . 'test.css' ? '1' : '0';
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get class name by path.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getClassNameByPathTest()
|
||||
{
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
$extPath = $this->objectModel->app->getExtensionRoot() . 'custom' . DS;
|
||||
|
||||
$result = '';
|
||||
$filePath = $modulePath . 'model.php' . DS . 'create';
|
||||
$className = $this->objectModel->getClassNameByPath($filePath);
|
||||
$result .= $className == 'todo' ? '1,' : '0,';
|
||||
$filePath = $extPath . 'todo' . DS . 'ext' . DS . 'control';
|
||||
$className = $this->objectModel->getClassNameByPath($filePath);
|
||||
$result .= $className == 'todo' ? '1' : '0';
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::addLink4Dir();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
添加todo模块的链接 >> 1,1,1,1,1,1,1,1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->addLink4DirTest()) && p() && e('1,1,1,1,1,1,1,1'); //添加todo模块的链接
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::addLink4File();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
添加todo模块的链接 >> 1,1,1,1,1,1,1,1,1,1,1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->addLink4FileTest()) && p() && e('1,1,1,1,1,1,1,1,1,1,1'); //添加todo模块的链接
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::analysis();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取todo模块的文件列表 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->analysisTest()) && p() && e(1); //获取todo模块的文件列表
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::extendControl();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取todo模块的control扩展内容 >> 1,1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->extendControlTest()) && p() && e('1,1'); //获取todo模块的control扩展内容
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::extendModel();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取todo模块的model扩展内容 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->extendModelTest()) && p() && e(1); //获取todo模块的model扩展内容
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::getAPILink();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取todo模块的debug链接 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->getAPILinkTest()) && p() && e(1); //获取todo模块的debug链接
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::getClassNameByPath();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
根据文件路径获取类名 >> 1,1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->getClassNameByPathTest()) && p() && e('1,1'); //根据文件路径获取类名
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::getExtendLink();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取todo模块的扩展链接 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->getExtendLinkTest()) && p() && e(1); //获取todo模块的扩展链接
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::getExtensionFiles();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取misc模块的扩展文件列表 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->getExtensionFilesTest('misc')) && p() && e(1); //获取misc模块的扩展文件列表
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::getMethodCode();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取todo模块的create方法的参数 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->getMethodCodeTest()) && p() && e(1); //获取todo模块的create方法的参数
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::getModuleFiles();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取todo模块的文件列表 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->getModuleFilesTest('todo')) && p() && e(1); //获取todo模块的文件列表
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::getParam();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取todo模块的create方法的参数 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->getParamTest()) && p() && e(1); //获取todo模块的create方法的参数
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::getSavePath();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取todo模块的扩展文件存储路径 >> 1,1,1,1,1,1,1,1,1,1,1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->getSavePathTest()) && p() && e('1,1,1,1,1,1,1,1,1,1,1'); //获取todo模块的扩展文件存储路径
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::getTwoGradeFiles();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取todo模块的文件列表 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->getTwoGradeFilesTest()) && p() && e(1); //获取todo模块的文件列表
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::newControl();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取todo模块的control新扩展内容 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->newControlTest()) && p() && e(1); //获取todo模块的control新扩展内容
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/editor.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 editorModel::printTree();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取todo模块的文件列表 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$editor = new editorTest();
|
||||
r($editor->printTreeTest()) && p() && e(1); //获取todo模块的文件列表
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user