diff --git a/config/config.php b/config/config.php index d6bd0803c3..086f7c2e26 100644 --- a/config/config.php +++ b/config/config.php @@ -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'); diff --git a/db/update4.3.sql b/db/update4.3.sql index 487f80922f..feb60a2460 100644 --- a/db/update4.3.sql +++ b/db/update4.3.sql @@ -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; diff --git a/module/common/lang/en.php b/module/common/lang/en.php index 10bf4a6765..57fa053e15 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -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'); diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index 26b747a785..f24188e87a 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -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'); diff --git a/module/customlang/config.php b/module/customlang/config.php index c71e9504b9..969e01960a 100644 --- a/module/customlang/config.php +++ b/module/customlang/config.php @@ -1,8 +1,19 @@ 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 = ''; + diff --git a/module/customlang/control.php b/module/customlang/control.php index a43b3d090f..847a20444f 100644 --- a/module/customlang/control.php +++ b/module/customlang/control.php @@ -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(); } } diff --git a/module/customlang/lang/en.php b/module/customlang/lang/en.php index cfc5a0687b..40cf1af301 100644 --- a/module/customlang/lang/en.php +++ b/module/customlang/lang/en.php @@ -1,4 +1,6 @@ customlang->common = 'Custom lang'; + $lang->customlang->story = 'Story'; $lang->customlang->task = 'Task'; $lang->customlang->bug = 'Bug'; diff --git a/module/customlang/lang/zh-cn.php b/module/customlang/lang/zh-cn.php index 26460183a6..216ad80438 100644 --- a/module/customlang/lang/zh-cn.php +++ b/module/customlang/lang/zh-cn.php @@ -1,4 +1,6 @@ customlang->common = '语言配置'; + $lang->customlang->story = '需求'; $lang->customlang->task = '任务'; $lang->customlang->bug = 'Bug'; diff --git a/module/customlang/model.php b/module/customlang/model.php index 2eae7b7713..85479a0a0d 100644 --- a/module/customlang/model.php +++ b/module/customlang/model.php @@ -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(); + } } diff --git a/module/customlang/view/header.html.php b/module/customlang/view/header.html.php index 3ff938570c..d280894543 100755 --- a/module/customlang/view/header.html.php +++ b/module/customlang/view/header.html.php @@ -2,13 +2,13 @@