* adjust for editor and translate.
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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. <a href='https://api.zentao.pm/goto.php?item=howtodevelop'>Document</a>";
|
||||
|
||||
$lang->editor->translate['config.php'] = 'config';
|
||||
$lang->editor->translate['control.php'] = 'control';
|
||||
|
||||
@@ -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. <a href='https://api.zentao.pm/goto.php?item=howtodevelop'>Document</a>";
|
||||
|
||||
$lang->editor->translate['config.php'] = 'config';
|
||||
$lang->editor->translate['control.php'] = 'control';
|
||||
|
||||
@@ -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下访问。<a href='https://api.zentao.net/goto.php?item=howtodevelop'>说明文档</a>";
|
||||
|
||||
$lang->editor->translate['config.php'] = 'config';
|
||||
$lang->editor->translate['control.php'] = 'control';
|
||||
|
||||
@@ -10,9 +10,14 @@
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../dev/view/header.html.php';?>
|
||||
<?php include '../../common/view/header.lite.html.php';?>
|
||||
<style>
|
||||
html{height:100%}
|
||||
body{height:100%;padding-bottom:0px;}
|
||||
#mainContent{height:100%}
|
||||
</style>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='alert alert-warning'><?php echo $this->lang->editor->onlyLocalVisit;?></div>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
<?php include '../../common/view/footer.lite.html.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 = "<?php\n";
|
||||
$langConfig .= "\$config->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));
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 <br />";
|
||||
if(is_dir($modulePath . '/ext/lang') and !is_writable($modulePath . '/ext/lang')) $cmd .= "chmod -R 777 {$modulePath}/ext/lang <br />";
|
||||
if($language and file_exists($modulePath . "/lang/{$language}.php") and !is_writable($modulePath . "/lang/{$language}.php")) $cmd .= "chmod 777 {$modulePath}/lang/{$language}.php <br />";
|
||||
}
|
||||
return $cmd;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php $disabled = $active ? '' : "disabled";?>
|
||||
<div class='center-block mw-800px'>
|
||||
<div id="mainMenu" class="clearfix">
|
||||
<?php printf($lang->translate->allItems, $itemCount);?>
|
||||
<div class='pull-right'>
|
||||
<?php echo html::a(inlink('setting'), "<i class='icon icon-cog'></i>", '', "class='iframe btn btn-sm btn-link'");?>
|
||||
</div>
|
||||
<?php printf($lang->translate->allItems, $itemCount);?>
|
||||
<div class='pull-right'>
|
||||
<?php echo html::a(inlink('setting'), "<i class='icon icon-cog'></i>", '', "class='iframe btn btn-sm btn-link $disabled'");?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-sm-6' id='finishedLangs'>
|
||||
@@ -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'");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@@ -49,17 +50,20 @@
|
||||
<td class='text-progress text-center'><?php printf($lang->translate->progress, ($data->progress * 100) . '%');?></td>
|
||||
<td class='actions <?php echo common::checkEnLang() ? 'w-130px' : 'w-95px';?>'>
|
||||
<?php
|
||||
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'");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</table>
|
||||
</div>
|
||||
<p class='text-center'><?php echo html::a(inlink('addLang'), $lang->translate->addLang, '', "class='btn btn-primary'");?></p>
|
||||
<p class='text-center'><?php echo html::a(inlink('addLang'), $lang->translate->addLang, '', "class='btn btn-primary $disabled'");?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(!$active):?>
|
||||
<div class='alert alert-warning'><?php echo $this->lang->editor->onlyLocalVisit;?></div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -79,12 +79,14 @@
|
||||
<td class='translated'>
|
||||
<?php
|
||||
$function = $hasNL ? 'textarea' : 'input';
|
||||
echo html::$function('values[]', ($translation and $translation->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'");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if($translation)
|
||||
if(is_object($translation))
|
||||
{
|
||||
echo zget($lang->translate->statusList, $translation->status);
|
||||
if($translation->status == 'rejected') echo " <span title='$translation->reason'><i class='icon icon-help'></i></span>";
|
||||
@@ -106,7 +108,7 @@
|
||||
</td>
|
||||
<td rowspan='2'>
|
||||
<?php
|
||||
if($translation)
|
||||
if(is_object($translation))
|
||||
{
|
||||
echo zget($lang->translate->statusList, $translation->status);
|
||||
if($translation->status == 'rejected') echo " <span title='$translation->reason'><i class='icon icon-help'></i></span>";
|
||||
@@ -118,7 +120,9 @@
|
||||
<td class='translated'>
|
||||
<?php
|
||||
$function = $hasNL ? 'textarea' : 'input';
|
||||
echo html::$function('values[]', ($translation and $translation->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'");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user