diff --git a/module/editor/control.php b/module/editor/control.php
index abd341c701..15acd0ccf5 100644
--- a/module/editor/control.php
+++ b/module/editor/control.php
@@ -15,8 +15,9 @@ class editor extends control
{
parent::__construct($moduleName, $methodName, $appName);
- $remoteIP = helper::getRemoteIp();
- if($remoteIP != '127.0.0.1') die($this->display('editor', 'deny'));
+ $this->active = helper::getRemoteIp() == '127.0.0.1';
+ $methodName = $this->app->getMethodName();
+ if(!$this->active and $methodName != 'index' and $methodName != 'extend') die($this->display('editor', 'deny'));
}
/**
diff --git a/module/editor/lang/de.php b/module/editor/lang/de.php
index ab15165bf6..3aa39c2f44 100644
--- a/module/editor/lang/de.php
+++ b/module/editor/lang/de.php
@@ -30,13 +30,13 @@ $lang->editor->deleteConfirm = 'Möchten Sie das löschen?';
$lang->editor->extendConfirm = 'Möchten Sie den Originalcode verwenden?';
$lang->editor->repeatFile = 'Datei existiert bereits';
$lang->editor->repeatPage = 'Seite existiert bereits. Möchten Sie die Seite überschreiben?';
-$lang->editor->noticeOkFile = 'Aus Sicherheitsgründen muss Ihr Adminkonto bestätigt werden. \n Bitte melden Sie sich an und erstellen Sie die Datei %sFile.\n Hinweis:\n 1. Die Datei ist leer.\n 2. Wenn die Datei bereits existiert, löschen Sie sie und erstellen Sie eine neue Datei.';
+$lang->editor->noticeOkFile = 'Aus Sicherheitsgründen muss Ihr Adminkonto bestätigt werden. \n Bitte melden Sie sich an und erstellen Sie die Datei %s File.\n Hinweis:\n 1. Die Datei ist leer.\n 2. Wenn die Datei bereits existiert, löschen Sie sie und erstellen Sie eine neue Datei.';
$lang->editor->editFileError = 'Sie können nur ZenTao Dateien verändern!';
$lang->editor->notWritable = "Nicht beschreibbar. Berechtigung erforderlich. Bitte versuchen Sie chmod 777 -R ";
$lang->editor->notDelete = 'Kann nicht gelöscht werden. Bitte prüfen Sie Ihre Berechtigungen!';
$lang->editor->emptyFileName = 'Bitte geben Sie einen Dateinamen an!';
-$lang->editor->onlyLocalVisit = 'This feature only works when the IP is 127.0.0.1.';
+$lang->editor->onlyLocalVisit = "This feature only works when the IP is 127.0.0.1. Document";
$lang->editor->translate['config.php'] = 'config';
$lang->editor->translate['control.php'] = 'control';
diff --git a/module/editor/lang/en.php b/module/editor/lang/en.php
index 76a77bbbcb..8b8b22bb36 100644
--- a/module/editor/lang/en.php
+++ b/module/editor/lang/en.php
@@ -30,13 +30,13 @@ $lang->editor->deleteConfirm = 'Do you want to delete it?';
$lang->editor->extendConfirm = 'Do you want to use original code?';
$lang->editor->repeatFile = 'File Name Duplicated';
$lang->editor->repeatPage = 'This page exists. Do you want to overwrite it?';
-$lang->editor->noticeOkFile = 'For security reasons, your Admin account has to be confirmed. \n Please login ZenTao server and create %sFile.\n Note:\n 1. File is blank.\n 2. If the file existed, delete it and then create a new one.';
+$lang->editor->noticeOkFile = 'For security reasons, your Admin account has to be confirmed. \n Please login ZenTao server and create %s File.\n Note:\n 1. File is blank.\n 2. If the file existed, delete it and then create a new one.';
$lang->editor->editFileError = 'You can only modify ZenTao files!';
$lang->editor->notWritable = "Not wirtable. Permission is required. Please try chmod 777 -R ";
$lang->editor->notDelete = 'Cannot be deleted. Please check your permissions!';
$lang->editor->emptyFileName = 'Please enter a File Name!';
-$lang->editor->onlyLocalVisit = 'This feature only works when the IP is 127.0.0.1.';
+$lang->editor->onlyLocalVisit = "This feature only works when the IP is 127.0.0.1. Document";
$lang->editor->translate['config.php'] = 'config';
$lang->editor->translate['control.php'] = 'control';
diff --git a/module/editor/lang/zh-cn.php b/module/editor/lang/zh-cn.php
index 5c826fafd2..3bf906db8b 100644
--- a/module/editor/lang/zh-cn.php
+++ b/module/editor/lang/zh-cn.php
@@ -36,7 +36,7 @@ $lang->editor->editFileError = '只能修改禅道文件!';
$lang->editor->notWritable = "无法写入,可能没有权限。请尝试执行 chmod 777 -R ";
$lang->editor->notDelete = '无法删除,请检查权限!';
$lang->editor->emptyFileName = '请写入一个文件名!';
-$lang->editor->onlyLocalVisit = '该功能只能在IP:127.0.0.1下访问。';
+$lang->editor->onlyLocalVisit = "该功能只能在IP:127.0.0.1下访问。说明文档";
$lang->editor->translate['config.php'] = 'config';
$lang->editor->translate['control.php'] = 'control';
diff --git a/module/editor/view/deny.html.php b/module/editor/view/deny.html.php
index 59a8eaef4c..a91c4de854 100644
--- a/module/editor/view/deny.html.php
+++ b/module/editor/view/deny.html.php
@@ -10,9 +10,14 @@
* @link http://www.zentao.net
*/
?>
-
+
+
lang->editor->onlyLocalVisit;?>
-
+
diff --git a/module/translate/control.php b/module/translate/control.php
index 0b0df34002..ba781fa399 100644
--- a/module/translate/control.php
+++ b/module/translate/control.php
@@ -23,8 +23,9 @@ class translate extends control
{
parent::__construct($moduleName, $methodName);
- $remoteIP = helper::getRemoteIp();
- if($remoteIP != '127.0.0.1')
+ $this->active = helper::getRemoteIp() == '127.0.0.1';
+ if(!$this->active) $this->app->loadLang('editor');
+ if(!$this->active and $this->app->getMethodName() != 'index')
{
$this->app->loadLang('editor');
die($this->display('translate', 'deny'));
@@ -47,6 +48,14 @@ class translate extends control
$statistics = $this->translate->getLangStatistics();
$finishedLangs = $translatingLangs = array();
foreach($this->config->translate->defaultLang as $defaultLang) $finishedLangs[$defaultLang] = $this->config->langs[$defaultLang];
+
+ $addLangs = json_decode($this->config->global->langs, true);
+ foreach($this->config->langs as $langKey => $langName)
+ {
+ if(isset($finishedLangs[$langKey])) continue;
+ if(!isset($addLangs[$langKey])) $finishedLangs[$langKey] = $langName;
+ }
+
foreach($statistics as $translateLang => $data)
{
if($data->progress == 1)
@@ -65,6 +74,7 @@ class translate extends control
$this->view->finishedLangs = $finishedLangs;
$this->view->translatingLangs = $translatingLangs;
$this->view->itemCount = $itemCount;
+ $this->view->active = $this->active;
$this->display();
}
@@ -144,6 +154,7 @@ class translate extends control
{
if(in_array($module, $modules)) break;
}
+
if(empty($referLang))
{
$langs = json_decode($this->config->global->langs, true);
@@ -156,7 +167,7 @@ class translate extends control
$referLang = $language == 'zh-cn' ? 'en' : 'zh-cn';
}
}
- $this->view->cmd = $this->translate->checkDirPriv($module);
+ $this->view->cmd = $this->translate->checkDirPriv($module, $language);
if($_POST)
{
@@ -180,9 +191,12 @@ class translate extends control
$this->view->position[] = html::a($this->createLink('translate', 'index'), $this->lang->translate->common);
$this->view->position[] = $this->lang->translate->module;
+ $translations = $this->translate->getTranslations($language, $module);
+ if(empty($translations)) $translations = $this->translate->getModuleLangs($module, $language);
+
$this->view->referItems = $referItems;
- $this->view->translations = $this->translate->getTranslations($language, $module);
$this->view->moduleGroup = $moduleGroup;
+ $this->view->translations = $translations;
$this->view->currentModule = $module;
$this->view->currentGroup = $group;
$this->view->language = $language;
@@ -323,6 +337,17 @@ class translate extends control
if(file_exists($modulePath . "/lang/{$language}.php")) copy($modulePath . "/lang/{$language}.php", $downloadPath . "module/{$moduleName}/lang/{$language}.php");
}
+ mkdir($downloadPath . 'config/ext/', 0777, true);
+ $langConfig = "langs['$language'] = '" . addslashes($this->config->langs[$language]) . "';\n";
+ $langConfig .= "\$config->productCommonList['$language'][0] = '" . $this->config->productCommonList['en'][0] . "';\n";
+ $langConfig .= "\$config->productCommonList['$language'][1] = '" . $this->config->productCommonList['en'][1] . "';\n";
+ $langConfig .= "\$config->projectCommonList['$language'][0] = '" . $this->config->projectCommonList['en'][0] . "';\n";
+ $langConfig .= "\$config->projectCommonList['$language'][1] = '" . $this->config->projectCommonList['en'][1] . "';\n";
+ $langConfig .= "\$config->charsets['$language']['utf-8'] = 'UTF-8';\n";
+ $langConfig .= "\$config->charsets['$language']['GBK'] = 'GBK';\n";
+ file_put_contents($downloadPath . "config/ext/{$language}.php", $langConfig);
+
$this->app->loadClass('pclzip', true);
$zip = new pclzip($downloadFile);
$zip->create($downloadPath, PCLZIP_OPT_REMOVE_PATH, dirname($downloadPath));
diff --git a/module/translate/js/common.js b/module/translate/js/common.js
index 4964c1d62b..add85893f8 100644
--- a/module/translate/js/common.js
+++ b/module/translate/js/common.js
@@ -1,6 +1,6 @@
function adjustKeyWidth()
{
- var maxWidth = 0;
+ var maxWidth = 30;
$('.table-data tbody tr').each(function()
{
keyWidth = $(this).find('td').eq(1).find('nobr').width();
diff --git a/module/translate/model.php b/module/translate/model.php
index aee601921a..82a372ba89 100644
--- a/module/translate/model.php
+++ b/module/translate/model.php
@@ -210,7 +210,7 @@ class translateModel extends model
* @access public
* @return void
*/
- public function checkDirPriv($moduleName = '')
+ public function checkDirPriv($moduleName = '', $language = '')
{
$cmd = '';
$moduleRoot = $this->app->getModuleRoot();
@@ -219,6 +219,7 @@ class translateModel extends model
{
if(is_dir($modulePath . '/lang') and !is_writable($modulePath . '/lang')) $cmd .= "chmod 777 {$modulePath}/lang
";
if(is_dir($modulePath . '/ext/lang') and !is_writable($modulePath . '/ext/lang')) $cmd .= "chmod -R 777 {$modulePath}/ext/lang
";
+ if($language and file_exists($modulePath . "/lang/{$language}.php") and !is_writable($modulePath . "/lang/{$language}.php")) $cmd .= "chmod 777 {$modulePath}/lang/{$language}.php
";
}
return $cmd;
}
diff --git a/module/translate/view/index.html.php b/module/translate/view/index.html.php
index fab56a6529..b0fa00658c 100644
--- a/module/translate/view/index.html.php
+++ b/module/translate/view/index.html.php
@@ -1,10 +1,11 @@
+
-translate->allItems, $itemCount);?>
-
-", '', "class='iframe btn btn-sm btn-link'");?>
-
+ translate->allItems, $itemCount);?>
+
+ ", '', "class='iframe btn btn-sm btn-link $disabled'");?>
+
@@ -24,8 +25,8 @@
}
else
{
- echo html::a(inlink('chooseModule', "language=$langKey"), $lang->translate->common, '', "class='btn btn-sm'");
- echo html::a(inlink('export', "language=$langKey"), $lang->export, '', "class='btn btn-sm iframe'");
+ echo html::a(inlink('chooseModule', "language=$langKey"), $lang->translate->common, '', "class='btn btn-sm $disabled'");
+ echo html::a(inlink('export', "language=$langKey"), $lang->export, '', "class='btn btn-sm iframe $disabled'");
}
?>
@@ -49,17 +50,20 @@
translate->progress, ($data->progress * 100) . '%');?> |
'>
translate->common, '', "class='btn btn-sm'");
- echo html::a(inlink('export', "language=$langKey"), $lang->export, '', "class='btn btn-sm iframe'");
+ echo html::a(inlink('chooseModule', "language=$langKey"), $lang->translate->common, '', "class='btn btn-sm $disabled'");
+ echo html::a(inlink('export', "language=$langKey"), $lang->export, '', "class='btn btn-sm iframe $disabled'");
?>
|
-
translate->addLang, '', "class='btn btn-primary'");?>
+
translate->addLang, '', "class='btn btn-primary $disabled'");?>
+
+ lang->editor->onlyLocalVisit;?>
+
diff --git a/module/translate/view/module.html.php b/module/translate/view/module.html.php
index 4229230956..3aa8661463 100644
--- a/module/translate/view/module.html.php
+++ b/module/translate/view/module.html.php
@@ -79,12 +79,14 @@
value != $item) ? htmlspecialchars($translation->value) : '', "class='form-control'");
+ $value = $translation;
+ if(is_object($translation)) $value = $translation->value;
+ echo html::$function('values[]', ($value != $item) ? htmlspecialchars($value) : '', "class='form-control'");
?>
|
translate->statusList, $translation->status);
if($translation->status == 'rejected') echo " ";
@@ -106,7 +108,7 @@
|
translate->statusList, $translation->status);
if($translation->status == 'rejected') echo " ";
@@ -118,7 +120,9 @@
|
value != $item) ? htmlspecialchars($translation->value) : '', "class='form-control'");
+ $value = $translation;
+ if(is_object($translation)) $value = $translation->value;
+ echo html::$function('values[]', ($value != $item) ? htmlspecialchars($value) : '', "class='form-control'");
?>
|