From c5087451c71cd0765d18361db0547f01f53be77f Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Sat, 13 Jul 2013 01:11:23 +0000 Subject: [PATCH] * code for task#1541. --- module/editor/lang/en.php | 1 + module/editor/lang/zh-cn.php | 1 + module/editor/model.php | 20 ++++++++++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/module/editor/lang/en.php b/module/editor/lang/en.php index fcc91e720f..b7bc10ce97 100644 --- a/module/editor/lang/en.php +++ b/module/editor/lang/en.php @@ -4,6 +4,7 @@ $lang->editor->api = 'API'; $lang->editor->index = 'Index'; $lang->editor->newMethod = 'New method'; $lang->editor->extend = 'Extend'; +$lang->editor->api = 'API'; $lang->editor->newLang = 'New language'; $lang->editor->newConfig = 'New config'; $lang->editor->newHook = 'New hook'; diff --git a/module/editor/lang/zh-cn.php b/module/editor/lang/zh-cn.php index f4a55574e7..40421bbbe7 100644 --- a/module/editor/lang/zh-cn.php +++ b/module/editor/lang/zh-cn.php @@ -4,6 +4,7 @@ $lang->editor->api = 'API'; $lang->editor->index = '首页'; $lang->editor->newMethod = '新增方法'; $lang->editor->extend = '扩展'; +$lang->editor->api = 'API'; $lang->editor->newLang = '新增语言'; $lang->editor->newConfig = '新增配置'; $lang->editor->newHook = '新增钩子'; diff --git a/module/editor/model.php b/module/editor/model.php index bf3c6822fd..783ffbb508 100644 --- a/module/editor/model.php +++ b/module/editor/model.php @@ -334,9 +334,11 @@ class editorModel extends model $parentDir = basename(dirname($filePath)); $action = 'extendOther'; if($parentDir == 'control.php') $action = 'extendControl'; - if($parentDir == 'model.php') $action = 'extendModel'; + if($parentDir == 'model.php') $action = 'extendModel'; + $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($action != 'extendOther') $tree .= html::a($this->getAPILink($filePath, $action), $this->lang->editor->api, '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; @@ -356,6 +358,20 @@ class editorModel extends model return inlink('edit', "filePath=" . helper::safe64Encode($filePath) . "&action=$action&isExtends=$isExtends"); } + /** + * Get api link. + * + * @param int $filePath + * @param int $action + * @param string $type + * @access public + * @return string + */ + public function getAPILink($filePath, $action) + { + return helper::createLink('api', 'view', "filePath=" . helper::safe64Encode($filePath) . "&action=$action"); + } + /** * Save file to extension. *