+ adjust for editor module.
This commit is contained in:
@@ -73,6 +73,8 @@ $lang->openedByAB = 'Open';
|
||||
$lang->assignedToAB = 'To';
|
||||
$lang->typeAB = 'Type';
|
||||
|
||||
$lang->common->common = 'Common module';
|
||||
|
||||
/* The main menu. */
|
||||
$lang->menu->my = 'Dashboard|my|index';
|
||||
$lang->menu->product = 'Product|product|index';
|
||||
|
||||
@@ -73,6 +73,8 @@ $lang->openedByAB = '创建';
|
||||
$lang->assignedToAB = '指派';
|
||||
$lang->typeAB = '类型';
|
||||
|
||||
$lang->common->common = '公有模块';
|
||||
|
||||
/* 主导航菜单。*/
|
||||
$lang->menu->my = '我的地盘|my|index';
|
||||
$lang->menu->product = '产品视图|product|index';
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$config->editor->sort[] = 'model.php';
|
||||
$config->editor->sort[] = 'control.php';
|
||||
$config->editor->sort[] = 'view';
|
||||
$config->editor->sort[] = 'lang';
|
||||
$config->editor->sort[] = 'config.php';
|
||||
$config->editor->sort[] = 'js';
|
||||
$config->editor->sort[] = 'css';
|
||||
$config->editor->sort[] = 'ext';
|
||||
|
||||
$config->editor->extSort[] = 'model';
|
||||
$config->editor->extSort[] = 'control';
|
||||
$config->editor->extSort[] = 'view';
|
||||
$config->editor->extSort[] = 'lang';
|
||||
$config->editor->extSort[] = 'js';
|
||||
$config->editor->extSort[] = 'css';
|
||||
$config->editor->extSort[] = 'config';
|
||||
|
||||
@@ -17,15 +17,43 @@ class editor extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function index($filePath = '', $action = '', $isExtends = '')
|
||||
public function index()
|
||||
{
|
||||
$this->view->moduleList = $this->editor->getModules();
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show this module of files.
|
||||
*
|
||||
* @param string $moduleDir
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function extend($moduleDir = '')
|
||||
{
|
||||
$moduleFiles = $this->editor->getModuleFiles($moduleDir);
|
||||
$this->view->module = $moduleDir;
|
||||
$this->view->tree = $this->editor->printTree($moduleFiles);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit extend.
|
||||
*
|
||||
* @param string $filePath
|
||||
* @param string $action
|
||||
* @param string $isExtends
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function edit($filePath = '', $action = '', $isExtends = '')
|
||||
{
|
||||
$allModules = $this->editor->getModuleFiles();
|
||||
$this->view->tree = $this->editor->printTree($allModules);
|
||||
$this->view->safeFilePath = $filePath;
|
||||
$filePath = helper::safe64Decode($filePath);
|
||||
$fileContent = '';
|
||||
if($filePath)
|
||||
{
|
||||
$filePath = helper::safe64Decode($filePath);
|
||||
if($action == 'extendOther' and file_exists($filePath))
|
||||
{
|
||||
$this->view->showContent = htmlspecialchars(file_get_contents($filePath));
|
||||
@@ -35,6 +63,11 @@ class editor extends control
|
||||
if(file_exists($filePath))
|
||||
{
|
||||
$fileContent = file_get_contents($filePath);
|
||||
if($action == 'override')
|
||||
{
|
||||
$fileContent = str_replace('../../', '../../../', $fileContent);
|
||||
$fileContent = str_replace(array('\'./', '"./'), array('\'../../view/', '"../../view'), $fileContent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -80,8 +113,6 @@ class editor extends control
|
||||
if(file_exists($saveFilePath) and !$this->post->override) die(js::confirm($this->lang->editor->repeatPage, $extendLink, '', 'parent'));
|
||||
die(js::locate($extendLink, 'parent'));
|
||||
}
|
||||
$allModules = $this->editor->getModuleFiles();
|
||||
$this->view->tree = $this->editor->printTree($allModules);
|
||||
$this->view->filePath = $filePath;
|
||||
$this->display();
|
||||
}
|
||||
@@ -101,7 +132,7 @@ class editor extends control
|
||||
if($action != 'edit' and $action != 'newPage') $filePath = $this->editor->getSavePath($filePath, $action);
|
||||
if($action != 'edit' and $action != 'newPage' and file_exists($filePath) and !$this->post->override) die(js::error($this->lang->editor->repeatFile));
|
||||
$this->editor->save($filePath);
|
||||
die(js::locate(inlink('index', "filePath=" . helper::safe64Encode($filePath) . "&action=edit"), 'parent'));
|
||||
die(js::locate(inlink('edit', "filePath=" . helper::safe64Encode($filePath) . "&action=edit"), 'parent'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#extendTree li {list-style-type:none;}
|
||||
#extendTree .active {color:blue; font-weight:bold}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
$(function()
|
||||
{
|
||||
$("#extendTree").treeview();
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
$(function()
|
||||
{
|
||||
var showHeight = $(window).height() - 125;
|
||||
$('#editWin').height(showHeight);
|
||||
$('#extendWin').height(showHeight);
|
||||
});
|
||||
@@ -9,6 +9,7 @@ $lang->editor->newPage = 'New page';
|
||||
$lang->editor->override = 'override';
|
||||
$lang->editor->edit = 'Edit extend';
|
||||
|
||||
$lang->editor->moduleList = 'Module list';
|
||||
$lang->editor->filePath = "File Path:";
|
||||
$lang->editor->sourceFile = 'Source file:';
|
||||
$lang->editor->fileName = "File name:";
|
||||
@@ -29,3 +30,52 @@ $lang->editor->repeatPage = 'This page has extisted. Is override?';
|
||||
$lang->editor->notWritable = "Can't writable, maybe no power. please try chmod 777 -R ";
|
||||
$lang->editor->notDelete = "Can't delete, please check power!";
|
||||
$lang->editor->emptyFileName = 'Please write file name';
|
||||
|
||||
$lang->editor->translate['config.php'] = 'Config file';
|
||||
$lang->editor->translate['config'] = 'Config extend';
|
||||
$lang->editor->translate['control.php'] = 'Control file';
|
||||
$lang->editor->translate['control'] = 'Control extend';
|
||||
$lang->editor->translate['model.php'] = 'Model file';
|
||||
$lang->editor->translate['model'] = 'Model extend';
|
||||
$lang->editor->translate['view'] = 'View file';
|
||||
$lang->editor->translate['lang'] = 'Language file';
|
||||
$lang->editor->translate['en'] = 'English';
|
||||
$lang->editor->translate['zh-cn'] = 'Chinese Simple';
|
||||
$lang->editor->translate['zh-tw'] = 'Chinese Traditional';
|
||||
$lang->editor->translate['js'] = 'Javascript';
|
||||
$lang->editor->translate['css'] = 'Css';
|
||||
$lang->editor->translate['ext'] = 'Extend file';
|
||||
|
||||
$lang->editor->modules['action'] = 'Logs';
|
||||
$lang->editor->modules['admin'] = 'Admin';
|
||||
$lang->editor->modules['api'] = 'API';
|
||||
$lang->editor->modules['bug'] = 'Bug';
|
||||
$lang->editor->modules['build'] = 'Build';
|
||||
$lang->editor->modules['common'] = 'Common module';
|
||||
$lang->editor->modules['company'] = 'Company';
|
||||
$lang->editor->modules['convert'] = 'Import';
|
||||
$lang->editor->modules['dept'] = 'Department';
|
||||
$lang->editor->modules['doc'] = 'Doc';
|
||||
$lang->editor->modules['extension'] = 'Extension';
|
||||
$lang->editor->modules['file'] = 'File';
|
||||
$lang->editor->modules['group'] = 'Group';
|
||||
$lang->editor->modules['index'] = 'Index';
|
||||
$lang->editor->modules['install'] = 'Install';
|
||||
$lang->editor->modules['misc'] = 'Misc';
|
||||
$lang->editor->modules['my'] = 'Dashboard';
|
||||
$lang->editor->modules['product'] = 'Product';
|
||||
$lang->editor->modules['productplan'] = 'Plan';
|
||||
$lang->editor->modules['project'] = 'Project';
|
||||
$lang->editor->modules['qa'] = 'QA';
|
||||
$lang->editor->modules['release'] = 'Release';
|
||||
$lang->editor->modules['report'] = 'Report';
|
||||
$lang->editor->modules['search'] = 'Search';
|
||||
$lang->editor->modules['story'] = 'Story';
|
||||
$lang->editor->modules['task'] = 'Task';
|
||||
$lang->editor->modules['testcase'] = 'Case';
|
||||
$lang->editor->modules['testtask'] = 'Test task';
|
||||
$lang->editor->modules['todo'] = 'TODO';
|
||||
$lang->editor->modules['tree'] = 'Module manage';
|
||||
$lang->editor->modules['upgrade'] = 'Upgrade';
|
||||
$lang->editor->modules['user'] = 'User';
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ $lang->editor->newPage = '新增页面';
|
||||
$lang->editor->override = '覆盖';
|
||||
$lang->editor->edit = '编辑扩展';
|
||||
|
||||
$lang->editor->moduleList = '模块列表';
|
||||
$lang->editor->filePath = "文件路径:";
|
||||
$lang->editor->sourceFile = '源文件:';
|
||||
$lang->editor->fileName = "文件名:";
|
||||
@@ -29,3 +30,51 @@ $lang->editor->repeatPage = '已经有此页面。是否覆盖?';
|
||||
$lang->editor->notWritable = "无法写入,可能没有权限。请尝试执行 chmod 777 -R ";
|
||||
$lang->editor->notDelete = '无法删除,请检查权限!';
|
||||
$lang->editor->emptyFileName = '请写入一个文件名!';
|
||||
|
||||
$lang->editor->translate['config.php'] = '配置文件';
|
||||
$lang->editor->translate['config'] = '配置扩展';
|
||||
$lang->editor->translate['control.php'] = '控制文件';
|
||||
$lang->editor->translate['control'] = '控制扩展';
|
||||
$lang->editor->translate['model.php'] = '模型文件';
|
||||
$lang->editor->translate['model'] = '模型扩展';
|
||||
$lang->editor->translate['view'] = '模板文件';
|
||||
$lang->editor->translate['lang'] = '语言文件';
|
||||
$lang->editor->translate['en'] = '英文';
|
||||
$lang->editor->translate['zh-cn'] = '中文简体';
|
||||
$lang->editor->translate['zh-tw'] = '中文繁体';
|
||||
$lang->editor->translate['js'] = 'JS脚本';
|
||||
$lang->editor->translate['css'] = 'CSS样式';
|
||||
$lang->editor->translate['ext'] = '扩展文件';
|
||||
|
||||
$lang->editor->modules['action'] = '系统日志';
|
||||
$lang->editor->modules['admin'] = '后台管理';
|
||||
$lang->editor->modules['api'] = 'API接口';
|
||||
$lang->editor->modules['bug'] = '缺陷管理';
|
||||
$lang->editor->modules['build'] = 'Build';
|
||||
$lang->editor->modules['common'] = '公有模块';
|
||||
$lang->editor->modules['company'] = '组织视图';
|
||||
$lang->editor->modules['convert'] = '从其他系统导入';
|
||||
$lang->editor->modules['dept'] = '部门结构';
|
||||
$lang->editor->modules['doc'] = '文档视图';
|
||||
$lang->editor->modules['extension'] = '插件管理';
|
||||
$lang->editor->modules['file'] = '附件';
|
||||
$lang->editor->modules['group'] = '权限分组';
|
||||
$lang->editor->modules['index'] = '首页';
|
||||
$lang->editor->modules['install'] = '安装';
|
||||
$lang->editor->modules['misc'] = '杂项';
|
||||
$lang->editor->modules['my'] = '我的地盘';
|
||||
$lang->editor->modules['product'] = '产品视图';
|
||||
$lang->editor->modules['productplan'] = '产品计划';
|
||||
$lang->editor->modules['project'] = '项目视图';
|
||||
$lang->editor->modules['qa'] = 'QA视图';
|
||||
$lang->editor->modules['release'] = '发布';
|
||||
$lang->editor->modules['report'] = '报表';
|
||||
$lang->editor->modules['search'] = '搜索';
|
||||
$lang->editor->modules['story'] = '需求';
|
||||
$lang->editor->modules['task'] = '任务';
|
||||
$lang->editor->modules['testcase'] = '用例管理';
|
||||
$lang->editor->modules['testtask'] = '测试任务';
|
||||
$lang->editor->modules['todo'] = 'TODO';
|
||||
$lang->editor->modules['tree'] = '模块维护';
|
||||
$lang->editor->modules['upgrade'] = '升级';
|
||||
$lang->editor->modules['user'] = '用户';
|
||||
|
||||
+122
-46
@@ -11,45 +11,61 @@
|
||||
*/
|
||||
class editorModel extends model
|
||||
{
|
||||
/**
|
||||
* Get all modules
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getModules()
|
||||
{
|
||||
$modules = glob($this->app->getModuleRoot() . '*');
|
||||
$moduleList = '<ul>';
|
||||
foreach($modules as $module)
|
||||
{
|
||||
$module = basename($module);
|
||||
if($module == 'editor' or $module == 'help' or $module == 'setting') continue;
|
||||
$moduleName = !empty($this->lang->editor->modules[$module]) ? $this->lang->editor->modules[$module] : $module;
|
||||
$moduleList .= '<li>' . html::a(inlink('extend', "moduleDir=$module"), $moduleName, 'extendWin') . '</li>';
|
||||
}
|
||||
$moduleList .= '</ul>';
|
||||
return $moduleList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module files, contain control's methods and model's method but except ext.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getModuleFiles()
|
||||
public function getModuleFiles($moduleDir)
|
||||
{
|
||||
$moduleRoot = $this->app->getModuleRoot();
|
||||
$allModules = array();
|
||||
$moduleDirs = scandir($moduleRoot);
|
||||
foreach($moduleDirs as $moduleDir)
|
||||
$moduleFullDir = $moduleRoot . $moduleDir;
|
||||
$moduleFiles = scandir($moduleFullDir);
|
||||
foreach($moduleFiles as $moduleFile)
|
||||
{
|
||||
if($moduleDir == '.' or $moduleDir == '..' or $moduleDir == '.svn') continue;
|
||||
$moduleFullDir = $moduleRoot . $moduleDir;
|
||||
$moduleFiles = scandir($moduleFullDir);
|
||||
foreach($moduleFiles as $moduleFile)
|
||||
if($moduleFile == '.' or $moduleFile == '..' or $moduleFile == '.svn') continue;
|
||||
$moduleFullFile = $moduleFullDir . '/' . $moduleFile;
|
||||
if($moduleFile == 'control.php' or $moduleFile == 'model.php')
|
||||
{
|
||||
if($moduleFile == '.' or $moduleFile == '..' or $moduleFile == '.svn') continue;
|
||||
$moduleFullFile = $moduleFullDir . '/' . $moduleFile;
|
||||
if($moduleFile == 'control.php' or $moduleFile == 'model.php')
|
||||
{
|
||||
$allModules[$moduleFullDir][$moduleFullFile] = $this->analysis($moduleFullFile);
|
||||
}
|
||||
elseif($moduleFile == 'ext')
|
||||
{
|
||||
$allModules[$moduleFullDir][$moduleFullFile] = $this->getExtensionFiles($moduleFullFile);
|
||||
}
|
||||
elseif(is_dir($moduleFullFile))
|
||||
{
|
||||
$ext = ($moduleFile == 'js' or $moduleFile == 'css') ? $moduleFile : 'php';
|
||||
foreach(glob($moduleFullFile . '/' . "*.$ext") as $fileName) $allModules[$moduleFullDir][$moduleFullFile][$fileName] = basename($fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
$allModules[$moduleFullDir][$moduleFullFile] = $moduleFile;
|
||||
}
|
||||
$allModules[$moduleFullDir][$moduleFullFile] = $this->analysis($moduleFullFile);
|
||||
}
|
||||
elseif($moduleFile == 'ext')
|
||||
{
|
||||
$allModules[$moduleFullDir][$moduleFullFile] = $this->getExtensionFiles($moduleFullFile);
|
||||
}
|
||||
elseif(is_dir($moduleFullFile))
|
||||
{
|
||||
$ext = ($moduleFile == 'js' or $moduleFile == 'css') ? $moduleFile : 'php';
|
||||
foreach(glob($moduleFullFile . '/' . "*.$ext") as $fileName) $allModules[$moduleFullDir][$moduleFullFile][$fileName] = basename($fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
$allModules[$moduleFullDir][$moduleFullFile] = $moduleFile;
|
||||
}
|
||||
}
|
||||
$allModules = $this->sortModule($moduleFullDir, $allModules);
|
||||
return $allModules;
|
||||
}
|
||||
|
||||
@@ -87,9 +103,32 @@ class editorModel extends model
|
||||
}
|
||||
}
|
||||
}
|
||||
$extensionList = $this->sortModule($extPath, $extensionList, true);
|
||||
return $extensionList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort module
|
||||
*
|
||||
* @param string $filePath
|
||||
* @param string $moduleFiles
|
||||
* @param bool $isExtension
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function sortModule($filePath, $moduleFiles, $isExtension = false)
|
||||
{
|
||||
$sort = $isExtension ? 'extSort' : 'sort';
|
||||
$sortModules = array();
|
||||
if(!$isExtension) $moduleFiles = $moduleFiles[$filePath];
|
||||
foreach($this->config->editor->$sort as $sort)
|
||||
{
|
||||
$sortKey = empty($sort) ? $filePath : $filePath . '/' . $sort;
|
||||
if(array_key_exists($sortKey, $moduleFiles)) $sortModules[$sortKey] = $moduleFiles[$sortKey];
|
||||
}
|
||||
return $sortModules;
|
||||
}
|
||||
|
||||
/**
|
||||
* if a directory has two grage, this method will get files
|
||||
*
|
||||
@@ -140,6 +179,7 @@ class editorModel extends model
|
||||
{
|
||||
$methodName = $method->name;
|
||||
if($method->getFileName() != $fileName) continue;
|
||||
if($methodName == '__construct') continue;
|
||||
$classMethod[$fileName . '/' . $methodName] = $methodName;
|
||||
}
|
||||
return $classMethod;
|
||||
@@ -155,7 +195,14 @@ class editorModel extends model
|
||||
public function printTree($files, $isRoot = true)
|
||||
{
|
||||
if(empty($files) or !is_array($files)) return false;
|
||||
$tree = $isRoot ? "<ul id='tree'>\n" : "<ul>\n";
|
||||
$tree = $isRoot ? "<ul id='extendTree'>\n" : "<ul>\n";
|
||||
if($isRoot)
|
||||
{
|
||||
$langFile = key($files) . '/lang/' . $this->cookie->lang. '.php';
|
||||
if(file_exists($langFile)) include_once $langFile;
|
||||
$module = basename(key($files));
|
||||
$this->module = empty($lang) ? '' : $lang->$module;
|
||||
}
|
||||
foreach($files as $key => $file)
|
||||
{
|
||||
$tree .= "<li>\n";
|
||||
@@ -185,28 +232,39 @@ class editorModel extends model
|
||||
{
|
||||
$tree = '';
|
||||
$fileName = basename($filePath);
|
||||
if(isset($this->lang->editor->modules[$fileName]))
|
||||
{
|
||||
$file = "<span title='$fileName'>" . $this->lang->editor->modules[$fileName] . '</span>';
|
||||
}
|
||||
elseif(isset($this->lang->editor->translate[$fileName]))
|
||||
{
|
||||
$file = "<span title='$fileName'>" . $this->lang->editor->translate[$fileName] . '</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$file = "<span title='$fileName'>$fileName</span>";
|
||||
}
|
||||
if(strpos($filePath, '/ext/') !== false)
|
||||
{
|
||||
if($fileName == 'lang' or $fileName == 'js' or $fileName == 'css')
|
||||
switch($fileName)
|
||||
{
|
||||
$tree .= $fileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
$tree .= "$fileName " . html::a($this->getExtendLink($filePath, "newExtend"), $this->lang->editor->newExtend);
|
||||
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');
|
||||
}
|
||||
}
|
||||
elseif($fileName == 'model.php')
|
||||
{
|
||||
$tree .= "$fileName " . html::a($this->getExtendLink($filePath, 'newMethod'), $this->lang->editor->newMethod);
|
||||
$tree .= "$file " . html::a($this->getExtendLink($filePath, 'newMethod'), $this->lang->editor->newMethod, 'editWin');
|
||||
}
|
||||
elseif($fileName == 'control.php')
|
||||
{
|
||||
$tree .= "$fileName " . html::a(inlink('newPage', "filePath=" . helper::safe64Encode($filePath)), $this->lang->editor->newPage);
|
||||
$tree .= "$file " . html::a(inlink('newPage', "filePath=" . helper::safe64Encode($filePath)), $this->lang->editor->newPage, 'editWin');
|
||||
}
|
||||
else
|
||||
{
|
||||
$tree .= $fileName;
|
||||
$tree .= $file;
|
||||
}
|
||||
return $tree;
|
||||
}
|
||||
@@ -222,13 +280,27 @@ class editorModel extends model
|
||||
public function addLink4File($filePath, $file)
|
||||
{
|
||||
$tree = '';
|
||||
if(isset($this->module->$file) and !is_object($this->module->$file) and !is_array($this->module->$file))
|
||||
{
|
||||
$file = "<span title='$file'>" . $this->module->$file . '</span>';
|
||||
}
|
||||
elseif(isset($this->lang->editor->translate[$file]))
|
||||
{
|
||||
$file = "<span title='$file'>" . $this->lang->editor->translate[$file] . '</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$file = "<span title='$file'>$file</span>";
|
||||
}
|
||||
if(strpos($filePath, '/ext/') !== false)
|
||||
{
|
||||
$tree .= "$file " . html::a($this->getExtendLink($filePath, "edit"), $this->lang->edit) . html::a(inlink('delete', 'path=' . helper::safe64Encode($filePath)), $this->lang->delete, 'hiddenwin') . "\n";
|
||||
$tree .= "$file " . html::a($this->getExtendLink($filePath, "edit"), $this->lang->edit, 'editWin');
|
||||
$tree .= html::a(inlink('delete', 'path=' . helper::safe64Encode($filePath)), $this->lang->delete, 'hiddenwin') . "\n";
|
||||
}
|
||||
elseif(basename(dirname($filePath))== 'view')
|
||||
{
|
||||
$tree .= "$file " . html::a($this->getExtendLink($filePath, "override"), $this->lang->editor->override) . html::a($this->getExtendLink($filePath, "newHook"), $this->lang->editor->newHook) . "\n";
|
||||
$tree .= "$file " . html::a($this->getExtendLink($filePath, "override"), $this->lang->editor->override, 'editWin');
|
||||
$tree .= html::a($this->getExtendLink($filePath, "newHook"), $this->lang->editor->newHook, 'editWin') . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -236,9 +308,9 @@ class editorModel extends model
|
||||
$action = 'extendOther';
|
||||
if($parentDir == 'control.php') $action = 'extendControl';
|
||||
if($parentDir == 'model.php') $action = 'extendModel';
|
||||
$tree .= "$file " . html::a($this->getExtendLink($filePath, $action), $this->lang->editor->extend);
|
||||
if($parentDir == 'lang') $tree .= html::a($this->getExtendLink($filePath, "new" . str_replace('-', '_', basename($filePath, '.php'))), $this->lang->editor->newLang);
|
||||
if(basename($filePath) == 'config.php') $tree .= html::a($this->getExtendLink($filePath, "newConfig"), $this->lang->editor->newConfig);
|
||||
$tree .= "$file " . html::a($this->getExtendLink($filePath, $action), $this->lang->editor->extend, 'editWin');
|
||||
if($parentDir == 'lang') $tree .= html::a($this->getExtendLink($filePath, "new" . str_replace('-', '_', basename($filePath, '.php'))), $this->lang->editor->newLang, 'editWin');
|
||||
if(basename($filePath) == 'config.php') $tree .= html::a($this->getExtendLink($filePath, "newConfig"), $this->lang->editor->newConfig, 'editWin');
|
||||
}
|
||||
return $tree;
|
||||
}
|
||||
@@ -254,7 +326,7 @@ class editorModel extends model
|
||||
*/
|
||||
public function getExtendLink($filePath, $action, $isExtends = '')
|
||||
{
|
||||
return inlink('index', "filePath=" . helper::safe64Encode($filePath) . "&action=$action&isExtends=$isExtends");
|
||||
return inlink('edit', "filePath=" . helper::safe64Encode($filePath) . "&action=$action&isExtends=$isExtends");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -269,14 +341,14 @@ class editorModel extends model
|
||||
$fileContent = $this->post->fileContent;
|
||||
if(get_magic_quotes_gpc()) $fileContent = stripslashes($fileContent);
|
||||
$dirPath = dirname($filePath);
|
||||
if(!is_dir($dirPath) and is_writable(dirname($dirPath))) mkdir($dirPath, 0777, true);
|
||||
$extFilePath = substr($filePath, 0, strpos($filePath, '/ext/') + 4);
|
||||
if(!is_dir($dirPath) and is_writable($extFilePath)) mkdir($dirPath, 0777, true);
|
||||
if(is_writable($dirPath))
|
||||
{
|
||||
file_put_contents($filePath, $fileContent);
|
||||
}
|
||||
else
|
||||
{
|
||||
$extFilePath = substr($filePath, 0, strpos($filePath, '/ext/') + 4);
|
||||
die(js::alert($this->lang->editor->notWritable . $extFilePath));
|
||||
}
|
||||
}
|
||||
@@ -290,6 +362,7 @@ class editorModel extends model
|
||||
*/
|
||||
public function extendModel($filePath)
|
||||
{
|
||||
include(dirname($filePath));
|
||||
$className = basename(dirname(dirname($filePath)));
|
||||
$methodName = basename($filePath);
|
||||
$methodParam = $this->getParam($className, $methodName, 'Model');
|
||||
@@ -311,6 +384,7 @@ EOD;
|
||||
*/
|
||||
public function extendControl($filePath, $isExtends)
|
||||
{
|
||||
include(dirname($filePath));
|
||||
$className = basename(dirname(dirname($filePath)));
|
||||
$methodName = basename($filePath);
|
||||
if($isExtends == 'yes')
|
||||
@@ -335,7 +409,7 @@ EOD;
|
||||
<?php
|
||||
class $className extends control
|
||||
{
|
||||
$methodcode
|
||||
$methodCode
|
||||
}
|
||||
EOD;
|
||||
}
|
||||
@@ -459,6 +533,8 @@ EOD;
|
||||
elseif($action == 'method') return $extPath . basename($filePath, '.php') . '/' . $fileName;
|
||||
elseif($action == 'extend') return $filePath . '/' . $fileName;
|
||||
elseif($action == 'config') return $extPath . 'config/' . $fileName;
|
||||
elseif($action == 'js') return $extPath . 'js/' . substr($fileName, 0, strrpos($fileName, '.')) . '/' . $fileName;
|
||||
elseif($action == 'css') return $extPath . 'css/' . substr($fileName, 0, strrpos($fileName, '.')) . '/' . $fileName;
|
||||
else return $extPath . 'lang/' . str_replace('_', '-', $action) . '/' . $fileName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* The editor view file of dir module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2011 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
|
||||
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
|
||||
* @author Yidong Wang <yidong@cnezsoft.com>
|
||||
* @package editor
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.lite.html.php';?>
|
||||
<?php include '../../common/view/colorbox.html.php';?>
|
||||
<form method='post' target='hiddenwin' action='<?php echo inlink('save', "filePath=$safeFilePath&action=$action")?>'>
|
||||
<table class='table-1'>
|
||||
<?php if($filePath):?>
|
||||
<caption>
|
||||
<?php echo "<span class='strong'>{$lang->editor->filePath}</span>"?>
|
||||
<?php echo $filePath?>
|
||||
</caption>
|
||||
<?php endif?>
|
||||
<?php $rows = 39?>
|
||||
<?php if(!empty($showContent)):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->editor->sourceFile?></th>
|
||||
<td>
|
||||
<div style='width:100%; height:300px; overflow:auto'>
|
||||
<?php echo "<pre>$showContent</pre>"?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php $rows = 20?>
|
||||
<?php endif?>
|
||||
<tr>
|
||||
<th class='w-80px'><?php echo $lang->editor->fileContent?></th>
|
||||
<td>
|
||||
<?php echo html::textarea('fileContent', $fileContent, "class='area-1' rows=$rows")?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if($action and $action != 'edit' and $action != 'newPage' and $action != 'override' and $action != 'extendControl'):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->editor->fileName?></th>
|
||||
<td>
|
||||
<?php
|
||||
echo html::input('fileName', '', "class=text-5");
|
||||
if($action == 'newHook')
|
||||
{
|
||||
echo $lang->editor->exampleHook;
|
||||
}
|
||||
elseif($action and $action == 'extendOther' and strpos(basename($filePath), '.js') !== false or $action == 'newJS')
|
||||
{
|
||||
echo $lang->editor->exampleJs;
|
||||
}
|
||||
elseif($action and $action == 'extendOther' and strpos(basename($filePath), '.css') !== false or $action == 'newCSS')
|
||||
{
|
||||
echo $lang->editor->exampleCss;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $lang->editor->examplePHP;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php if($action and $action != 'edit' and $action != 'newPage'):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->editor->overrideFile?></th>
|
||||
<td><input type='checkbox' name='override' id='override' /> <?php echo $lang->editor->isOverride?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr><td colspan='2' align='center'><?php echo html::submitButton()?><td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php include '../../common/view/footer.lite.html.php';?>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* The editor view file of dir module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2011 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
|
||||
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
|
||||
* @author Yidong Wang <yidong@cnezsoft.com>
|
||||
* @package editor
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.lite.html.php';?>
|
||||
<?php include '../../common/view/treeview.html.php';?>
|
||||
<table class='table-1'>
|
||||
<caption><?php echo isset($lang->editor->modules[$module])? $lang->editor->modules[$module] : $module;?></caption>
|
||||
<tr>
|
||||
<td valign='top'><?php echo $tree?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php include '../../common/view/footer.lite.html.php';?>
|
||||
@@ -11,78 +11,14 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/treeview.html.php';?>
|
||||
<table class='table-1'>
|
||||
<tr>
|
||||
<td width='300' valign='top'>
|
||||
<?php echo $tree?>
|
||||
<br />
|
||||
</td>
|
||||
<td valign='top'>
|
||||
<form method='post' target='hiddenwin' action='<?php echo inlink('save', "filePath=$safeFilePath&action=$action")?>'>
|
||||
<table class='table-1'>
|
||||
<caption>
|
||||
<?php
|
||||
if(empty($action)) echo '';
|
||||
else echo isset($lang->editor->$action) ? $lang->editor->$action : $lang->editor->extend;
|
||||
?>
|
||||
</caption>
|
||||
<?php if($filePath):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->editor->filePath?></th>
|
||||
<td><?php echo $filePath?></td>
|
||||
</tr>
|
||||
<?php endif?>
|
||||
<?php $rows = 40?>
|
||||
<?php if(!empty($showContent)):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->editor->sourceFile?></th>
|
||||
<td><?php echo "<pre>$showContent</pre>"?></td>
|
||||
</tr>
|
||||
<?php $rows = 20?>
|
||||
<?php endif?>
|
||||
<tr>
|
||||
<th class='w-80px'><?php echo $lang->editor->fileContent?></th>
|
||||
<td>
|
||||
<?php echo html::textarea('fileContent', $fileContent, "class='area-1' rows=$rows")?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if($action and $action != 'edit' and $action != 'newPage' and $action != 'override'):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->editor->fileName?></th>
|
||||
<td>
|
||||
<?php
|
||||
echo html::input('fileName', '', "class=text-5");
|
||||
if($action == 'newHook')
|
||||
{
|
||||
echo $lang->editor->exampleHook;
|
||||
}
|
||||
elseif($action and $action == 'extendOther' and strpos(basename($filePath), '.js') !== false)
|
||||
{
|
||||
echo $lang->editor->exampleJs;
|
||||
}
|
||||
elseif($action and $action == 'extendOther' and strpos(basename($filePath), '.css') !== false)
|
||||
{
|
||||
echo $lang->editor->exampleCss;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $lang->editor->examplePHP;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php if($action and $action != 'edit' and $action != 'newPage'):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->editor->overrideFile?></th>
|
||||
<td><input type='checkbox' name='override' id='override' /> <?php echo $lang->editor->isOverride?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr><td colspan='2' align='center'><?php echo html::submitButton()?><td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<tr valign='top'>
|
||||
<td width='160'>
|
||||
<div class='box-title'><?php echo $lang->editor->moduleList?></div>
|
||||
<div class='box-content'><?php echo $moduleList?></div>
|
||||
</td>
|
||||
<td width='300'><iframe frameborder='0' name='extendWin' id='extendWin' width='100%'></iframe></td>
|
||||
<td><iframe frameborder='0' name='editWin' id='editWin' width='100%'></iframe></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -10,35 +10,24 @@
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/treeview.html.php';?>
|
||||
<?php include '../../common/view/header.lite.html.php';?>
|
||||
<form method='post' target='hiddenwin'>
|
||||
<table class='table-1'>
|
||||
<caption><?php echo $lang->editor->newPage?></caption>
|
||||
<tr>
|
||||
<td width='300' valign='top'>
|
||||
<?php echo $tree?>
|
||||
<br />
|
||||
</td>
|
||||
<td valign='top'>
|
||||
<form method='post' target='hiddenwin'>
|
||||
<table class='table-1'>
|
||||
<caption><?php echo $lang->editor->newPage?></caption>
|
||||
<tr>
|
||||
<th class='w-70px'><?php echo $lang->editor->filePath?></th>
|
||||
<td><?php echo $filePath?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->editor->pageName?></th>
|
||||
<td>
|
||||
<?php
|
||||
echo html::input('fileName', '', "class=text-5");
|
||||
echo $lang->editor->examplePHP;
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan='2' align='center'><?php echo html::submitButton()?><td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<th class='w-70px'><?php echo $lang->editor->filePath?></th>
|
||||
<td><?php echo $filePath?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->editor->pageName?></th>
|
||||
<td>
|
||||
<?php
|
||||
echo html::input('fileName', '', "class=text-5");
|
||||
echo $lang->editor->examplePHP;
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan='2' align='center'><?php echo html::submitButton()?><td></tr>
|
||||
</table>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
</form>
|
||||
<?php include '../../common/view/footer.lite.html.php';?>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<?php
|
||||
$lang->index->common = 'Index';
|
||||
$lang->index->index = 'Index'
|
||||
$lang->index->index = 'Index';
|
||||
|
||||
Reference in New Issue
Block a user