* code for task#1670.
This commit is contained in:
@@ -134,7 +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`');
|
||||
define('TABLE_CUSTOM', '`' . $config->db->prefix . 'custom`');
|
||||
|
||||
$config->objectTables['product'] = TABLE_PRODUCT;
|
||||
$config->objectTables['story'] = TABLE_STORY;
|
||||
@@ -151,7 +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;
|
||||
$config->objectTables['custom'] = TABLE_CUSTOM;
|
||||
|
||||
/* Include extension config files. */
|
||||
$extConfigFiles = glob($configRoot . 'ext/*.php');
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
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 ,
|
||||
`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;
|
||||
CREATE TABLE IF NOT EXISTS `zt_custom` (
|
||||
`id` mediumint(8) unsigned NOT NULL auto_increment,
|
||||
`lang` varchar(30) NOT NULL,
|
||||
`module` varchar(30) NOT NULL,
|
||||
`section` varchar(30) NOT NULL,
|
||||
`key` varchar(60) NOT NULL,
|
||||
`value` text NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `lang` (`lang`,`module`,`section`,`key`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
@@ -1463,6 +1463,19 @@ class router
|
||||
$loadedLangs[] = $langFile;
|
||||
}
|
||||
|
||||
/* Merge from the db lang. */
|
||||
if($moduleName != 'common' and isset($lang->db->custom))
|
||||
{
|
||||
foreach($lang->db->custom as $record)
|
||||
{
|
||||
if($moduleName == $record->module)
|
||||
{
|
||||
if(!$record->key) continue;
|
||||
$lang->{$record->module}->{$record->section}[$record->key] = $record->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->lang = $lang;
|
||||
return $lang;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ class common extends control
|
||||
$this->common->setCompany();
|
||||
$this->common->setUser();
|
||||
$this->common->loadConfigFromDB();
|
||||
$this->common->loadCustomFromDB();
|
||||
if($this->app->getViewType() == 'mhtml') $this->common->setMobileMenu();
|
||||
$this->app->loadLang('company');
|
||||
}
|
||||
|
||||
@@ -270,32 +270,32 @@ $lang->user->menu = $lang->company->menu;
|
||||
/* Admin menu. */
|
||||
$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|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');
|
||||
$lang->admin->menu->trashes = array('link' => 'Trash|action|trash', 'subModule' => 'action');
|
||||
$lang->admin->menu->sso = array('link' => 'SSO|sso|browse', 'subModule' => 'sso');
|
||||
$lang->admin->menu->index = array('link' => 'Index|admin|index');
|
||||
$lang->admin->menu->extension = array('link' => 'Extension|extension|browse', 'subModule' => 'extension,editor');
|
||||
$lang->admin->menu->custom = array('link' => 'Custom|custom|index', 'subModule' => 'custom');
|
||||
$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');
|
||||
$lang->admin->menu->trashes = array('link' => 'Trash|action|trash', 'subModule' => 'action');
|
||||
$lang->admin->menu->sso = array('link' => 'SSO|sso|browse', 'subModule' => 'sso');
|
||||
|
||||
$lang->convert = new stdclass();
|
||||
$lang->upgrade = new stdclass();
|
||||
$lang->action = new stdclass();
|
||||
$lang->extension = new stdclass();
|
||||
$lang->customlang = new stdclass();
|
||||
$lang->editor = new stdclass();
|
||||
$lang->mail = new stdclass();
|
||||
$lang->sso = new stdclass();
|
||||
$lang->convert = new stdclass();
|
||||
$lang->upgrade = new stdclass();
|
||||
$lang->action = new stdclass();
|
||||
$lang->extension = new stdclass();
|
||||
$lang->custom = new stdclass();
|
||||
$lang->editor = new stdclass();
|
||||
$lang->mail = new stdclass();
|
||||
$lang->sso = new stdclass();
|
||||
|
||||
$lang->convert->menu = $lang->admin->menu;
|
||||
$lang->upgrade->menu = $lang->admin->menu;
|
||||
$lang->action->menu = $lang->admin->menu;
|
||||
$lang->extension->menu = $lang->admin->menu;
|
||||
$lang->customlang->menu = $lang->admin->menu;
|
||||
$lang->editor->menu = $lang->admin->menu;
|
||||
$lang->mail->menu = $lang->admin->menu;
|
||||
$lang->sso->menu = $lang->admin->menu;
|
||||
$lang->convert->menu = $lang->admin->menu;
|
||||
$lang->upgrade->menu = $lang->admin->menu;
|
||||
$lang->action->menu = $lang->admin->menu;
|
||||
$lang->extension->menu = $lang->admin->menu;
|
||||
$lang->custom->menu = $lang->admin->menu;
|
||||
$lang->editor->menu = $lang->admin->menu;
|
||||
$lang->mail->menu = $lang->admin->menu;
|
||||
$lang->sso->menu = $lang->admin->menu;
|
||||
|
||||
/* Groups. */
|
||||
$lang->menugroup = new stdclass();
|
||||
|
||||
@@ -108,17 +108,17 @@ $lang->user->menuOrder = $lang->company->menuOrder;
|
||||
/* admin menu order. */
|
||||
$lang->admin->menuOrder[5] = 'index';
|
||||
$lang->admin->menuOrder[10] = 'extension';
|
||||
$lang->admin->menuOrder[15] = 'customlang';
|
||||
$lang->admin->menuOrder[15] = 'custom';
|
||||
$lang->admin->menuOrder[20] = 'editor';
|
||||
$lang->admin->menuOrder[25] = 'mail';
|
||||
$lang->admin->menuOrder[30] = 'sso';
|
||||
$lang->admin->menuOrder[35] = 'convert';
|
||||
$lang->admin->menuOrder[40] = 'trashes';
|
||||
$lang->convert->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->upgrade->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->action->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->extension->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->customlang->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->editor->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->mail->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->sso->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->convert->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->upgrade->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->action->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->extension->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->custom->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->editor->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->mail->menuOrder = $lang->admin->menuOrder;
|
||||
$lang->sso->menuOrder = $lang->admin->menuOrder;
|
||||
|
||||
@@ -270,14 +270,14 @@ $lang->user->menu = $lang->company->menu;
|
||||
/* 后台管理菜单设置。*/
|
||||
$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|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');
|
||||
$lang->admin->menu->trashes = array('link' => '回收站|action|trash', 'subModule' => 'action');
|
||||
$lang->admin->menu->sso = array('link' => '单点登录|sso|browse', 'subModule' => 'sso');
|
||||
$lang->admin->menu->index = array('link' => '首页|admin|index');
|
||||
$lang->admin->menu->extension = array('link' => '扩展|extension|browse', 'subModule' => 'extension,editor');
|
||||
$lang->admin->menu->custom = array('link' => '自定义配置|custom|index', 'subModule' => 'custom');
|
||||
$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');
|
||||
$lang->admin->menu->trashes = array('link' => '回收站|action|trash', 'subModule' => 'action');
|
||||
$lang->admin->menu->sso = array('link' => '单点登录|sso|browse', 'subModule' => 'sso');
|
||||
|
||||
$lang->convert = new stdclass();
|
||||
$lang->upgrade = new stdclass();
|
||||
@@ -288,14 +288,14 @@ $lang->editor = new stdclass();
|
||||
$lang->mail = new stdclass();
|
||||
$lang->sso = new stdclass();
|
||||
|
||||
$lang->convert->menu = $lang->admin->menu;
|
||||
$lang->upgrade->menu = $lang->admin->menu;
|
||||
$lang->action->menu = $lang->admin->menu;
|
||||
$lang->extension->menu = $lang->admin->menu;
|
||||
$lang->customlang->menu = $lang->admin->menu;
|
||||
$lang->editor->menu = $lang->admin->menu;
|
||||
$lang->mail->menu = $lang->admin->menu;
|
||||
$lang->sso->menu = $lang->admin->menu;
|
||||
$lang->convert->menu = $lang->admin->menu;
|
||||
$lang->upgrade->menu = $lang->admin->menu;
|
||||
$lang->action->menu = $lang->admin->menu;
|
||||
$lang->extension->menu = $lang->admin->menu;
|
||||
$lang->custom->menu = $lang->admin->menu;
|
||||
$lang->editor->menu = $lang->admin->menu;
|
||||
$lang->mail->menu = $lang->admin->menu;
|
||||
$lang->sso->menu = $lang->admin->menu;
|
||||
|
||||
/* 菜单分组。*/
|
||||
$lang->menugroup = new stdclass();
|
||||
|
||||
@@ -118,6 +118,20 @@ class commonModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load custom lang from db.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function loadCustomFromDB()
|
||||
{
|
||||
if(!$this->config->db->name) return;
|
||||
$records = $this->loadModel('custom')->getAll();
|
||||
if(!$records) return;
|
||||
$this->lang->db->custom = $records;
|
||||
}
|
||||
|
||||
/**
|
||||
* Juage a method of one module is open or not?
|
||||
*
|
||||
|
||||
18
module/custom/config.php
Normal file
18
module/custom/config.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$config->custom = new stdClass();
|
||||
|
||||
$config->custom->story = new stdClass();
|
||||
$config->custom->story->fields['priList'] = '优先级';
|
||||
$config->custom->story->fields['sourceList'] = '来源';
|
||||
$config->custom->story->fields['reasonList'] = '关闭原因';
|
||||
$config->custom->story->fields['reviewResultList'] = '评审结果';
|
||||
$config->custom->story->fields['statusList'] = '状态';
|
||||
$config->custom->story->fields['stageList'] = '阶段';
|
||||
$config->custom->story->canAdd = 'reasonList,reviewResultList,sourceList,priList';
|
||||
|
||||
$config->custom->task = '';
|
||||
$config->custom->bug = '';
|
||||
$config->custom->testcase = '';
|
||||
$config->custom->testtask = '';
|
||||
$config->custom->todo = '';
|
||||
$config->custom->user = '';
|
||||
48
module/custom/control.php
Normal file
48
module/custom/control.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* The control file of custom 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 custom
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class custom extends control
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index($module = 'story', $field = 'priList')
|
||||
{
|
||||
$lang = $this->app->getClientLang();
|
||||
|
||||
$this->app->loadLang($module);
|
||||
$fieldList = $this->lang->$module->$field;
|
||||
if(!empty($_POST))
|
||||
{
|
||||
foreach($_POST['keys'] as $index => $key)
|
||||
{
|
||||
// $value = $_POST['values'][$index];
|
||||
// if(isset($fieldList[$key]) and $fieldList[$key] == $value) continue;
|
||||
$this->custom->setItem("{$lang}.{$module}.{$field}.{$key}", $value);
|
||||
}
|
||||
if(!dao::getError()) die(js::reload('parent'));
|
||||
}
|
||||
|
||||
$this->view->standardList = $this->custom->getStandardList($module, $field);
|
||||
$this->view->title = $this->lang->custom->common . $this->lang->colon . $this->lang->custom->story;
|
||||
$this->view->position[] = $this->lang->custom->common;
|
||||
$this->view->position[] = $this->lang->custom->$module;
|
||||
$this->view->fieldList = $fieldList;
|
||||
$this->view->field = $field;
|
||||
$this->view->module = $module;
|
||||
$this->view->canAdd = strpos($this->config->custom->$module->canAdd, $field) !== false;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
|
||||
12
module/custom/lang/en.php
Normal file
12
module/custom/lang/en.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$lang->custom->common = 'Custom';
|
||||
$lang->custom->key = 'Key';
|
||||
$lang->custom->value = 'Value';
|
||||
|
||||
$lang->custom->story = 'Story';
|
||||
$lang->custom->task = 'Task';
|
||||
$lang->custom->bug = 'Bug';
|
||||
$lang->custom->testcase = 'Test case';
|
||||
$lang->custom->testtask = 'Test task';
|
||||
$lang->custom->todo = 'Todo';
|
||||
$lang->custom->user = 'User';
|
||||
12
module/custom/lang/zh-cn.php
Normal file
12
module/custom/lang/zh-cn.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$lang->custom->common = '自定义配置';
|
||||
$lang->custom->key = '键';
|
||||
$lang->custom->value = '值';
|
||||
|
||||
$lang->custom->story = '需求';
|
||||
$lang->custom->task = '任务';
|
||||
$lang->custom->bug = 'Bug';
|
||||
$lang->custom->testcase = '测试用例';
|
||||
$lang->custom->testtask = '测试任务';
|
||||
$lang->custom->todo = '待办';
|
||||
$lang->custom->user = '用户';
|
||||
116
module/custom/model.php
Normal file
116
module/custom/model.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* The model file of xxx module of ZenTaoCMS.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
class customModel extends model
|
||||
{
|
||||
/**
|
||||
* Get config of system and one user.
|
||||
*
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_CUSTOM)->orderBy('id')->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value of an item.
|
||||
*
|
||||
* @param string $path system.common.global.sn or system.common.sn
|
||||
* @param string $value
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setItem($path, $value = '')
|
||||
{
|
||||
$level = substr_count($path, '.');
|
||||
$section = '';
|
||||
|
||||
if($level <= 1) return false;
|
||||
if($level == 2) list($lang, $module, $key) = explode('.', $path);
|
||||
if($level == 3) list($lang, $module, $section, $key) = explode('.', $path);
|
||||
|
||||
$item = new stdclass();
|
||||
$item->lang = $lang;
|
||||
$item->module = $module;
|
||||
$item->section = $section;
|
||||
$item->key = $key;
|
||||
$item->value = $value;
|
||||
|
||||
$this->dao->replace(TABLE_CUSTOM)->data($item)->exec();
|
||||
}
|
||||
|
||||
public function getStandardList($module, $field)
|
||||
{
|
||||
$this->loadModel($module);
|
||||
$lang = $this->app->getClientLang();
|
||||
$currentList = $this->lang->$module->$field;
|
||||
$dbList = $this->getItems("{$lang}.{$module}.{$field}");
|
||||
}
|
||||
|
||||
public function getItems($paramString)
|
||||
{
|
||||
return $this->createDAO($this->parseItemParam($paramString), 'select')->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete items.
|
||||
*
|
||||
* @param string $paramString see parseItemParam();
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function deleteItems($paramString)
|
||||
{
|
||||
$this->createDAO($this->parseItemParam($paramString), 'delete')->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the param string for select or delete items.
|
||||
*
|
||||
* @param string $paramString owner=xxx&key=sn and so on.
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function parseItemParam($paramString)
|
||||
{
|
||||
/* Parse the param string into array. */
|
||||
parse_str($paramString, $params);
|
||||
|
||||
/* Init fields not set in the param string. */
|
||||
$fields = 'lang,module,section,key';
|
||||
$fields = explode(',', $fields);
|
||||
foreach($fields as $field) if(!isset($params[$field])) $params[$field] = '';
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a DAO object to select or delete one or more records.
|
||||
*
|
||||
* @param array $params the params parsed by parseItemParam() method.
|
||||
* @param string $method select|delete.
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createDAO($params, $method = 'select')
|
||||
{
|
||||
return $this->dao->$method('*')->from(TABLE_CUSTOM)->where('1 = 1')
|
||||
->beginIF($params['lang'])->andWhere('lang')->in($params['lang'])->fi()
|
||||
->beginIF($params['module'])->andWhere('module')->in($params['module'])->fi()
|
||||
->beginIF($params['section'])->andWhere('section')->in($params['section'])->fi()
|
||||
->beginIF($params['key'])->andWhere('`key`')->in($params['key'])->fi();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
15
module/custom/view/header.html.php
Executable file
15
module/custom/view/header.html.php
Executable file
@@ -0,0 +1,15 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id='featurebar'>
|
||||
<div class='f-left'>
|
||||
<?php
|
||||
echo "<span id='storyTab'>"; common::printLink('custom', 'index', "module=story", $lang->custom->story); echo '</span>';
|
||||
echo "<span id='taskTab'>"; common::printLink('custom', 'index', "module=task", $lang->custom->task); echo '</span>';
|
||||
echo "<span id='bugTab'>"; common::printLink('custom', 'index', "module=bug", $lang->custom->bug); echo '</span>';
|
||||
echo "<span id='testcaseTab'>"; common::printLink('custom', 'index', "module=testcase", $lang->custom->testcase); echo '</span>';
|
||||
echo "<span id='testtaskTab'>"; common::printLink('custom', 'index', "module=testtask", $lang->custom->testtask); echo '</span>';
|
||||
echo "<span id='todoTab'>"; common::printLink('custom', 'index', "module=todo", $lang->custom->todo); echo '</span>' ;
|
||||
echo "<span id='userTab'>"; common::printLink('custom', 'index', "module=user", $lang->custom->user); echo '</span>';
|
||||
echo "<script>$('#{$module}Tab').addClass('active')</script>";
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
65
module/custom/view/index.html.php
Normal file
65
module/custom/view/index.html.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?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
|
||||
$itemRow = <<<EOT
|
||||
<tr class='a-center'>
|
||||
<td><input type='text' class="text-1" type="text" value="" name="keys[]"></td>
|
||||
<td>
|
||||
<input type='text' class="text-1" type="text" value="" name="values[]">
|
||||
<input type='button' onclick='addItem(this)' class='icon-add' value=' '></input>
|
||||
<input type='button' onclick='delItem(this)' class='icon-delete' value=' '></input>
|
||||
</td>
|
||||
</tr>
|
||||
EOT;
|
||||
?>
|
||||
<script>
|
||||
function addItem(clickedButton)
|
||||
{
|
||||
$(clickedButton).parent().parent().after(<?php echo json_encode($itemRow);?>);
|
||||
}
|
||||
function delItem(clickedButton)
|
||||
{
|
||||
$(clickedButton).parent().parent().remove();
|
||||
}
|
||||
</script>
|
||||
<div id='featurebar'>
|
||||
<div class='f-left'>
|
||||
<?php
|
||||
foreach($this->config->custom->story->fields as $key => $value)
|
||||
{
|
||||
echo "<span id='{$key}Tab'>" . html::a(inlink('index', "module=$module&field=$key"), $value) . "</span>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<form method='post'>
|
||||
<table align='center' class='table-5'>
|
||||
<tr>
|
||||
<th class='w-100px'><?php echo $lang->custom->key;?></th>
|
||||
<th><?php echo $lang->custom->value;?></th>
|
||||
</tr>
|
||||
<?php foreach($fieldList as $key => $value):?>
|
||||
<tr class='a-center'>
|
||||
<td><?php echo $key; echo html::hidden('keys[]', $key);?></td>
|
||||
<td>
|
||||
<?php echo html::input("values[]", $value, "class='text-1'");?>
|
||||
<?php if($canAdd):?><input type='button' onclick='addItem(this)' class='icon-add' value=' '></input><?php endif;?>
|
||||
</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';?>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
$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 = '';
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The control file of xxx 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
|
||||
*/
|
||||
class customlang extends control
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
$lang->customlang->common = 'Custom lang';
|
||||
|
||||
$lang->customlang->story = 'Story';
|
||||
$lang->customlang->task = 'Task';
|
||||
$lang->customlang->bug = 'Bug';
|
||||
$lang->customlang->testcase = 'Test case';
|
||||
$lang->customlang->testtask = 'Test task';
|
||||
$lang->customlang->todo = 'Todo';
|
||||
$lang->customlang->user = 'User';
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
$lang->customlang->common = '语言配置';
|
||||
|
||||
$lang->customlang->story = '需求';
|
||||
$lang->customlang->task = '任务';
|
||||
$lang->customlang->bug = 'Bug';
|
||||
$lang->customlang->testcase = '测试用例';
|
||||
$lang->customlang->testtask = '测试任务';
|
||||
$lang->customlang->todo = '待办';
|
||||
$lang->customlang->user = '用户';
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The model file of xxx module of ZenTaoCMS.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id='featurebar'>
|
||||
<div class='f-left'>
|
||||
<?php
|
||||
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>
|
||||
</div>
|
||||
@@ -1,40 +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';?>
|
||||
<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';?>
|
||||
Reference in New Issue
Block a user