* code for task#1670.

This commit is contained in:
azhi
2013-08-05 17:04:07 +08:00
parent 166d35b505
commit 7e891b1056
12 changed files with 121 additions and 32 deletions
+2
View File
@@ -134,6 +134,7 @@ define('TABLE_FILE', '`' . $config->db->prefix . 'file`');
define('TABLE_HISTORY', '`' . $config->db->prefix . 'history`');
define('TABLE_EXTENSION', '`' . $config->db->prefix . 'extension`');
define('TABLE_WEBAPP', '`' . $config->db->prefix . 'webapp`');
define('TABLE_CUSTOMLANG', '`' . $config->db->prefix . 'customLang`');
$config->objectTables['product'] = TABLE_PRODUCT;
$config->objectTables['story'] = TABLE_STORY;
@@ -150,6 +151,7 @@ $config->objectTables['user'] = TABLE_USER;
$config->objectTables['doc'] = TABLE_DOC;
$config->objectTables['doclib'] = TABLE_DOCLIB;
$config->objectTables['todo'] = TABLE_TODO;
$config->objectTables['customlang'] = TABLE_CUSTOMLANG;
/* Include extension config files. */
$extConfigFiles = glob($configRoot . 'ext/*.php');
+1 -1
View File
@@ -1,7 +1,7 @@
REATE TABLE `demoTTT`.`zt_customLang` (
`id` MEDIUMINT( 8 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`lang` VARCHAR( 30 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`module` VARCHAR( 30 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`object` VARCHAR( 30 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`key` VARCHAR( 60 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`value` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
) ENGINE = MYISAM;
+1 -1
View File
@@ -272,7 +272,7 @@ $lang->admin = new stdclass();
$lang->admin->menu = new stdclass();
$lang->admin->menu->index = array('link' => 'Index|admin|index');
$lang->admin->menu->extension = array('link' => 'Extension|extension|browse', 'subModule' => 'extension,editor');
$lang->admin->menu->customlang = array('link' => 'Custom lang|customlang|index', 'subModule' => 'customlang');
$lang->admin->menu->customlang = array('link' => 'Custom lang|customlang|story', 'subModule' => 'customlang');
$lang->admin->menu->mail = array('link' => 'Email|mail|index', 'subModule' => 'mail');
$lang->admin->menu->clearData = array('link' => 'Clear data|admin|cleardata');
$lang->admin->menu->convert = array('link' => 'Import|convert|index', 'subModule' => 'convert');
+1 -1
View File
@@ -272,7 +272,7 @@ $lang->admin = new stdclass();
$lang->admin->menu = new stdclass();
$lang->admin->menu->index = array('link' => '首页|admin|index');
$lang->admin->menu->extension = array('link' => '扩展|extension|browse', 'subModule' => 'extension,editor');
$lang->admin->menu->customlang = array('link' => '语言配置|customlang|index', 'subModule' => 'customlang');
$lang->admin->menu->customlang = array('link' => '语言配置|customlang|story', 'subModule' => 'customlang');
$lang->admin->menu->mail = array('link' => '发信|mail|index', 'subModule' => 'mail');
$lang->admin->menu->clearData = array('link' => '清除数据|admin|cleardata');
$lang->admin->menu->convert = array('link' => '导入|convert|index', 'subModule' => 'convert');
+18 -7
View File
@@ -1,8 +1,19 @@
<?php
$config->lang->custom->story = '';
$config->lang->custom->task = '';
$config->lang->custom->bug = '';
$config->lang->custom->testcase = '';
$config->lang->custom->testtask = '';
$config->lang->custom->todo = '';
$config->lang->custom->user = '';
$config->customlang = new stdClass();
$config->customlang->story = new stdClass();
$config->customlang->story->fields['priList'] = '优先级';
$config->customlang->story->fields['sourceList'] = '来源';
$config->customlang->story->fields['reasonList'] = '关闭原因';
$config->customlang->story->fields['reviewResultList'] = '评审结果';
$config->customlang->story->fields['statusList'] = '状态';
$config->customlang->story->fields['stageList'] = '阶段';
$config->customlang->story->canAdd = 'reasonList,reviewResultList,sourceList,priList';
$config->customlang->task = '';
$config->customlang->bug = '';
$config->customlang->testcase = '';
$config->customlang->testtask = '';
$config->customlang->todo = '';
$config->customlang->user = '';
+21 -1
View File
@@ -16,8 +16,28 @@ class customlang extends control
parent::__construct();
}
public function index()
public function story($field = 'priList')
{
if(!empty($_POST))
{
$this->customlang->update('story', $field);
if(!dao::getError()) die(js::reload('parent'));
}
$this->app->loadLang('story');
$fieldList = array();
$standardList = $this->lang->story->$field;
$fieldList = $this->customlang->getLang('', $this->app->getClientLang(), 'story', $field);
$fieldList = $fieldList ? unserialize($fieldList->value) + $standardList: $standardList;
$this->view->title = $this->lang->customlang->common . $this->lang->colon . $this->lang->customlang->story;
$this->view->position[] = $this->lang->customlang->common;
$this->view->position[] = $this->lang->customlang->story;
$this->view->standardList = $standardList;
$this->view->fieldList = $fieldList;
$this->view->field = $field;
$this->view->canAdd = strpos($this->config->customlang->story->canAdd, $field) !== false;
$this->display();
}
}
+2
View File
@@ -1,4 +1,6 @@
<?php
$lang->customlang->common = 'Custom lang';
$lang->customlang->story = 'Story';
$lang->customlang->task = 'Task';
$lang->customlang->bug = 'Bug';
+2
View File
@@ -1,4 +1,6 @@
<?php
$lang->customlang->common = '语言配置';
$lang->customlang->story = '需求';
$lang->customlang->task = '任务';
$lang->customlang->bug = 'Bug';
+26
View File
@@ -11,5 +11,31 @@
*/
class customlangModel extends model
{
public function getLang($id, $lang, $object, $key, $value)
{
return $this->dao->select('*')->from(TABLE_CUSTOMLANG)
->where('1=1')
->beginIF($id)->andWhere('id')->eq($id)->fi()
->beginIF($lang)->andWhere('lang')->eq($lang)->fi()
->beginIF($object)->andWhere('object')->eq($object)->fi()
->beginIF($key)->andWhere('`key`')->eq($key)->fi()
->beginIF($value)->andWhere('value')->eq($value)->fi()
->fetch();
}
public function update($object, $field)
{
$item = new stdClass();
$item->lang = $this->app->getClientLang();
$item->object = $object;
$item->key = $field;
$item->value = serialize($this->post->$field);
$oldItem = $this->getLang('', $item->lang, $item->object, $item->key);
if($oldItem)
{
return $this->dao->update(TABLE_CUSTOMLANG)->set('value')->eq($item->value)->where('id')->eq($oldItem->id)->exec();
}
return $this->dao->insert(TABLE_CUSTOMLANG)->data($item)->exec();
}
}
+7 -7
View File
@@ -2,13 +2,13 @@
<div id='featurebar'>
<div class='f-left'>
<?php
echo "<span id='storyTab'>"; common::printLink('lang', 'story', "", $lang->customlang->story); echo '</span>';
echo "<span id='taskTab'>"; common::printLink('lang', 'task', "", $lang->customlang->task); echo '</span>';
echo "<span id='bugTab'>"; common::printLink('lang', 'bug', "", $lang->customlang->bug); echo '</span>';
echo "<span id='testcaseTab'>"; common::printLink('lang', 'testcase', "", $lang->customlang->testcase); echo '</span>';
echo "<span id='testtaskTab'>"; common::printLink('lang', 'testtask', "", $lang->customlang->testtask); echo '</span>';
echo "<span id='todoTab'>"; common::printLink('lang', 'todo', "", $lang->customlang->todo); echo '</span>' ;
echo "<span id='userTab'>"; common::printLink('lang', 'user', "", $lang->customlang->user); echo '</span>';
echo "<span id='storyTab'>"; common::printLink('customlang', 'story', "", $lang->customlang->story); echo '</span>';
echo "<span id='taskTab'>"; common::printLink('customlang', 'task', "", $lang->customlang->task); echo '</span>';
echo "<span id='bugTab'>"; common::printLink('customlang', 'bug', "", $lang->customlang->bug); echo '</span>';
echo "<span id='testcaseTab'>"; common::printLink('customlang', 'testcase', "", $lang->customlang->testcase); echo '</span>';
echo "<span id='testtaskTab'>"; common::printLink('customlang', 'testtask', "", $lang->customlang->testtask); echo '</span>';
echo "<span id='todoTab'>"; common::printLink('customlang', 'todo', "", $lang->customlang->todo); echo '</span>' ;
echo "<span id='userTab'>"; common::printLink('customlang', 'user', "", $lang->customlang->user); echo '</span>';
echo "<script>$('#{$this->methodName}Tab').addClass('active')</script>";
?>
</div>
-14
View File
@@ -1,14 +0,0 @@
<?php
/**
* The xxx view file of xxx module of ZenTaoPMS.
*
* @copyright Copyright 2009-2010 QingDao Nature Easy Soft Network Technology Co,LTD (www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package xxx
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include './header.html.php';?>
<?php include '../../common/view/footer.html.php';?>
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* The xxx view file of xxx module of ZenTaoPMS.
*
* @copyright Copyright 2009-2010 QingDao Nature Easy Soft Network Technology Co,LTD (www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package xxx
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include './header.html.php';?>
<div id='featurebar'>
<div class='f-left'>
<?php
foreach($this->config->customlang->story->fields as $key => $value)
{
echo "<span id='{$key}Tab'>" . html::a(inlink('story', "field=$key"), $value) . "</span>";
}
?>
</div>
</div>
<form method='post'>
<table align='center' class='table-5'>
<tr>
<th>键</th>
<th>值</th>
</tr>
<?php foreach($fieldList as $key => $value):?>
<tr class='a-center'>
<td><?php echo $key;?></td>
<td><?php echo html::input("{$field}[$key]", $value, "class='text-1'");?></td>
</tr>
<?php endforeach;?>
<tfoot><tr><td colspan='2' class='a-center'><?php echo html::submitButton()?></td></tr><tfoot>
</table>
</form>
<script>$('#<?php echo $field;?>Tab').addClass('active')</script>
<?php include '../../common/view/footer.html.php';?>