From 7e891b1056ff9dfa8655320fe8957d76de1dc3e6 Mon Sep 17 00:00:00 2001 From: azhi Date: Mon, 5 Aug 2013 17:04:07 +0800 Subject: [PATCH 01/32] * code for task#1670. --- config/config.php | 2 ++ db/update4.3.sql | 2 +- module/common/lang/en.php | 2 +- module/common/lang/zh-cn.php | 2 +- module/customlang/config.php | 25 +++++++++++----- module/customlang/control.php | 22 +++++++++++++- module/customlang/lang/en.php | 2 ++ module/customlang/lang/zh-cn.php | 2 ++ module/customlang/model.php | 26 +++++++++++++++++ module/customlang/view/header.html.php | 14 ++++----- module/customlang/view/index.html.php | 14 --------- module/customlang/view/story.html.php | 40 ++++++++++++++++++++++++++ 12 files changed, 121 insertions(+), 32 deletions(-) delete mode 100644 module/customlang/view/index.html.php create mode 100644 module/customlang/view/story.html.php 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 @@
"; common::printLink('lang', 'story', "", $lang->customlang->story); echo ''; - echo ""; common::printLink('lang', 'task', "", $lang->customlang->task); echo ''; - echo ""; common::printLink('lang', 'bug', "", $lang->customlang->bug); echo ''; - echo ""; common::printLink('lang', 'testcase', "", $lang->customlang->testcase); echo ''; - echo ""; common::printLink('lang', 'testtask', "", $lang->customlang->testtask); echo ''; - echo ""; common::printLink('lang', 'todo', "", $lang->customlang->todo); echo '' ; - echo ""; common::printLink('lang', 'user', "", $lang->customlang->user); echo ''; + echo ""; common::printLink('customlang', 'story', "", $lang->customlang->story); echo ''; + echo ""; common::printLink('customlang', 'task', "", $lang->customlang->task); echo ''; + echo ""; common::printLink('customlang', 'bug', "", $lang->customlang->bug); echo ''; + echo ""; common::printLink('customlang', 'testcase', "", $lang->customlang->testcase); echo ''; + echo ""; common::printLink('customlang', 'testtask', "", $lang->customlang->testtask); echo ''; + echo ""; common::printLink('customlang', 'todo', "", $lang->customlang->todo); echo '' ; + echo ""; common::printLink('customlang', 'user', "", $lang->customlang->user); echo ''; echo ""; ?>
diff --git a/module/customlang/view/index.html.php b/module/customlang/view/index.html.php deleted file mode 100644 index 9b0b0fc9d9..0000000000 --- a/module/customlang/view/index.html.php +++ /dev/null @@ -1,14 +0,0 @@ - - * @package xxx - * @version $Id$ - * @link http://www.zentao.net - */ -?> - - diff --git a/module/customlang/view/story.html.php b/module/customlang/view/story.html.php new file mode 100644 index 0000000000..32467c8d7d --- /dev/null +++ b/module/customlang/view/story.html.php @@ -0,0 +1,40 @@ + + * @package xxx + * @version $Id$ + * @link http://www.zentao.net + */ +?> + +
+
+ config->customlang->story->fields as $key => $value) + { + echo "" . html::a(inlink('story', "field=$key"), $value) . ""; + } + ?> +
+
+
+ + + + + + $value):?> + + + + + + +
+
+ + From 159cae41207bf683d85bb19e2de9e567bbc5d809 Mon Sep 17 00:00:00 2001 From: wyd621 Date: Tue, 6 Aug 2013 08:51:09 +0800 Subject: [PATCH 02/32] * fix a bug for upgrade. --- tools/minifyfront.php | 2 ++ www/upgrade.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/minifyfront.php b/tools/minifyfront.php index 747ce05f8d..8bf7b82796 100755 --- a/tools/minifyfront.php +++ b/tools/minifyfront.php @@ -21,6 +21,7 @@ $jsFiles[] = $jqueryRoot . 'datepicker/date.js'; $jsFiles[] = $jqueryRoot . 'datepicker/min.js'; $jsFiles[] = $jqueryRoot . 'alert/min.js'; $jsFiles[] = $jqueryRoot . 'colorize/min.js'; +$jsFiles[] = $jqueryRoot . 'dropmenu/dropmenu.js'; /* Combine these js files. */ $allJSFile = $jsRoot . 'all.js'; @@ -70,6 +71,7 @@ foreach($langs as $lang) $cssCode .= file_get_contents($themeRoot . 'default/treeview.css'); $cssCode .= file_get_contents($themeRoot . 'default/datepicker.css'); $cssCode .= file_get_contents($themeRoot . 'default/alert.css'); + $cssCode .= file_get_contents($themeRoot . 'default/dropmenu.css'); /* Css file for current lang and current them. */ $cssCode .= file_get_contents($themeRoot . "lang/$lang.css"); diff --git a/www/upgrade.php b/www/upgrade.php index 9f1d1518af..e2bad61d14 100644 --- a/www/upgrade.php +++ b/www/upgrade.php @@ -37,7 +37,7 @@ $app->setDebug(); /* Check the installed version is the latest or not. */ $config->installedVersion = $common->loadModel('setting')->getVersion(); -if(version_compare($config->version, $config->installedVersion) <= 0) die(header('location: index.php')); +if(!$_SERVER['HTTP_X_REQUESTED_WITH'] and version_compare($config->version, $config->installedVersion) <= 0) die(header('location: index.php')); /* Run it. */ $app->parseRequest(); From fb7fb60ac7c8ef1cb6f023a949cc0e6fedfa2466 Mon Sep 17 00:00:00 2001 From: azhi Date: Tue, 6 Aug 2013 08:51:30 +0800 Subject: [PATCH 03/32] * fix bug: wrong colspan. --- module/task/view/batchedit.html.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/task/view/batchedit.html.php b/module/task/view/batchedit.html.php index 3d3b8eb054..beaf4af3f5 100755 --- a/module/task/view/batchedit.html.php +++ b/module/task/view/batchedit.html.php @@ -72,7 +72,8 @@ - + type != 'sprint')) ? $this->config->task->batchEdit->columns + 1 : $this->config->task->batchEdit->columns;?> + From 0fdf9dd1ec2d89908000fe44802644ab8f4bc291 Mon Sep 17 00:00:00 2001 From: wyd621 Date: Tue, 6 Aug 2013 10:50:06 +0800 Subject: [PATCH 04/32] * fix a bug #448. --- framework/router.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/router.class.php b/framework/router.class.php index 707ea028ef..aa529cb38b 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -1218,6 +1218,7 @@ class router /* If the not strict mode, the keys of passed params and defaaul params msut be the same. */ if(!isset($this->config->strictParams) or $this->config->strictParams == false) { + unset($passedParams['onlybody']); $passedParams = array_values($passedParams); $i = 0; foreach($defaultParams as $key => $defaultValue) From afa00d0be12bddb694820345a1dc0e43ca1eb2d7 Mon Sep 17 00:00:00 2001 From: xia0ta0 Date: Tue, 6 Aug 2013 15:13:54 +0800 Subject: [PATCH 05/32] * adjust bug confirm. --- module/bug/view/confirmbug.html.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/bug/view/confirmbug.html.php b/module/bug/view/confirmbug.html.php index 3ce7fa410e..ca43f7015d 100755 --- a/module/bug/view/confirmbug.html.php +++ b/module/bug/view/confirmbug.html.php @@ -22,11 +22,11 @@ js::set('page', 'confirmbug'); title;?> bug->assignedTo;?> - assignedTo, "class='text-3'");?> + assignedTo, "class='select-2'");?> - bug->severity;?> - bug->severityList, $bug->severity, 'class=select-2');?> + bug->pri;?> + bug->priList, $bug->pri, 'class=select-2');?> bug->mailto;?> From 00f604ec3d534d4d938e749d95f898d23ed2b30c Mon Sep 17 00:00:00 2001 From: xia0ta0 Date: Tue, 6 Aug 2013 15:15:41 +0800 Subject: [PATCH 06/32] * fix table width. --- module/user/view/dynamic.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/user/view/dynamic.html.php b/module/user/view/dynamic.html.php index debb912874..5322255232 100644 --- a/module/user/view/dynamic.html.php +++ b/module/user/view/dynamic.html.php @@ -27,7 +27,7 @@ ?>
- +
From 500858eb5e9597589a0fd8eefaa497cdb8fade59 Mon Sep 17 00:00:00 2001 From: wyd621 Date: Tue, 6 Aug 2013 16:11:11 +0800 Subject: [PATCH 07/32] * adjust code and fix bugs. --- module/common/control.php | 18 ++++++++++-------- module/productplan/control.php | 11 ++++++++++- module/report/model.php | 2 +- module/testcase/view/import.html.php | 2 +- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/module/common/control.php b/module/common/control.php index c6ef323199..c28778a213 100644 --- a/module/common/control.php +++ b/module/common/control.php @@ -163,18 +163,20 @@ class common extends control if(empty($method)) $method = $app->getMethodName(); $className = 'header'; - if(strpos($orderBy, $fieldName) !== false) + $order = explode('_', $orderBy); + $order[0] = trim($order[0], '`'); + if($order[0] == $fieldName) { - if(stripos($orderBy, 'desc') !== false) + if(isset($order[1]) and $order[1] == 'asc') { - $orderBy = str_ireplace('desc', 'asc', $orderBy); - $className = 'headerSortUp'; - } - elseif(stripos($orderBy, 'asc') !== false) - { - $orderBy = str_ireplace('asc', 'desc', $orderBy); + $orderBy = "`{$order[0]}`_desc"; $className = 'headerSortDown'; } + else + { + $orderBy = "`{$order[0]}`_asc"; + $className = 'headerSortUp'; + } } else { diff --git a/module/productplan/control.php b/module/productplan/control.php index 875cd55558..50f3eaaa5a 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -45,9 +45,18 @@ class productplan extends control $this->commonAction($product); $lastPlan = $this->productplan->getLast($product); + if($lastPlan) + { + $timestamp = strtotime($lastPlan->end); + $weekday = date('w', $timestamp); + $delta = 1; + if($weekday == '5' or $weekday == '6') $delta = 8 - $weekday; + + $begin = date('Y-m-d', strtotime("+$delta days", $timestamp)); + } + $this->view->begin = $lastPlan ? $begin : ''; $this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->productplan->create; - $this->view->begin = $lastPlan ? $lastPlan->end : ''; $this->display(); } diff --git a/module/report/model.php b/module/report/model.php index f7a5dba3cf..42dd2d83aa 100644 --- a/module/report/model.php +++ b/module/report/model.php @@ -121,7 +121,7 @@ $(function () series: {lines:{show: true, lineWidth: 2}, points: {show: true},hoverable: true}, legend: {noColumns: 1}, grid: { hoverable: true, clickable: true }, - xaxis: { ticks:ticks, tickFormatter: function(val) {tick = new Date(dateList[val]);;if(dateList[val] != undefined){return (tick.getMonth() + 1) + '-' + tick.getDate()}else{return ''}}}, + xaxis: { ticks:ticks, tickFormatter: function(val) {tick = new Date(dateList[val]);;if(dateList[val] != undefined){return tick.getDate() + '/' + (tick.getMonth() + 1)}else{return ''}}}, yaxis: {mode: null, min: 0, minTickSize: [1, "day"]}}; var placeholder = $("#placeholder"); diff --git a/module/testcase/view/import.html.php b/module/testcase/view/import.html.php index 6b4f5fcfc7..87d61214bd 100755 --- a/module/testcase/view/import.html.php +++ b/module/testcase/view/import.html.php @@ -1,7 +1,7 @@
action->date;?>
- + - +
testcase->importCase?>testcase->import?>
From b36a75eff0ec6517cd31b8c2200d8ed9943a40b3 Mon Sep 17 00:00:00 2001 From: wyd621 Date: Tue, 6 Aug 2013 16:31:07 +0800 Subject: [PATCH 08/32] * adjust pager. --- module/build/view/create.html.php | 2 +- module/build/view/edit.html.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/build/view/create.html.php b/module/build/view/create.html.php index 928db52764..59ef60e253 100644 --- a/module/build/view/create.html.php +++ b/module/build/view/create.html.php @@ -86,7 +86,7 @@ title, '', "class='preview'");?> bug->statusList[$bug->status];?>status == 'resolved' ? $bug->resolvedBy : html::select('resolvedBy[]', $users, $this->app->user->account, "class='w-70px'");?>status == 'resolved' ? substr($users[$bug->resolvedBy], 2) : html::select('resolvedBy[]', $users, $this->app->user->account, "class='w-70px'");?>
diff --git a/module/build/view/edit.html.php b/module/build/view/edit.html.php index e0ceb4703a..8f845383a6 100644 --- a/module/build/view/edit.html.php +++ b/module/build/view/edit.html.php @@ -105,7 +105,7 @@ bugs . ',', ',' . $bug->id . ',') !== false) echo 'checked';?>> id);?> title, '', "class='preview'");?> bug->statusList[$bug->status];?> - status == 'resolved' ? $bug->resolvedBy : html::select('resolvedBy[]', $users, $this->app->user->account, "class='w-70px'");?> + status == 'resolved' ? substr($users[$bug->resolvedBy], 2) : html::select('resolvedBy[]', $users, $this->app->user->account, "class='w-70px'");?> From b77e1b16da0507bcdb721deee540c2d79dc24ec7 Mon Sep 17 00:00:00 2001 From: azhi Date: Tue, 6 Aug 2013 17:09:23 +0800 Subject: [PATCH 09/32] * code for task#1670. --- config/config.php | 4 +- db/update4.3.sql | 17 ++-- framework/router.class.php | 13 +++ module/common/control.php | 1 + module/common/lang/en.php | 48 +++++----- module/common/lang/menuOrder.php | 18 ++-- module/common/lang/zh-cn.php | 32 +++---- module/common/model.php | 14 +++ module/custom/config.php | 18 ++++ module/custom/control.php | 48 ++++++++++ module/custom/lang/en.php | 12 +++ module/custom/lang/zh-cn.php | 12 +++ module/custom/model.php | 116 +++++++++++++++++++++++++ module/custom/view/header.html.php | 15 ++++ module/custom/view/index.html.php | 65 ++++++++++++++ module/customlang/config.php | 19 ---- module/customlang/control.php | 44 ---------- module/customlang/lang/en.php | 10 --- module/customlang/lang/zh-cn.php | 10 --- module/customlang/model.php | 41 --------- module/customlang/view/header.html.php | 15 ---- module/customlang/view/story.html.php | 40 --------- 22 files changed, 375 insertions(+), 237 deletions(-) create mode 100644 module/custom/config.php create mode 100644 module/custom/control.php create mode 100644 module/custom/lang/en.php create mode 100644 module/custom/lang/zh-cn.php create mode 100644 module/custom/model.php create mode 100755 module/custom/view/header.html.php create mode 100644 module/custom/view/index.html.php delete mode 100644 module/customlang/config.php delete mode 100644 module/customlang/control.php delete mode 100644 module/customlang/lang/en.php delete mode 100644 module/customlang/lang/zh-cn.php delete mode 100644 module/customlang/model.php delete mode 100755 module/customlang/view/header.html.php delete mode 100644 module/customlang/view/story.html.php diff --git a/config/config.php b/config/config.php index 086f7c2e26..6059aa9124 100644 --- a/config/config.php +++ b/config/config.php @@ -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'); diff --git a/db/update4.3.sql b/db/update4.3.sql index feb60a2460..5c74da0efd 100644 --- a/db/update4.3.sql +++ b/db/update4.3.sql @@ -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; diff --git a/framework/router.class.php b/framework/router.class.php index 707ea028ef..9155745cc2 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -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; } diff --git a/module/common/control.php b/module/common/control.php index c6ef323199..dd9230f9ca 100644 --- a/module/common/control.php +++ b/module/common/control.php @@ -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'); } diff --git a/module/common/lang/en.php b/module/common/lang/en.php index 57fa053e15..265923f82b 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -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(); diff --git a/module/common/lang/menuOrder.php b/module/common/lang/menuOrder.php index 1df47d8c05..c46f62f023 100644 --- a/module/common/lang/menuOrder.php +++ b/module/common/lang/menuOrder.php @@ -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; diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index f24188e87a..1ce3e653e5 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -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(); diff --git a/module/common/model.php b/module/common/model.php index 923eae6290..a7f63644cc 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -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? * diff --git a/module/custom/config.php b/module/custom/config.php new file mode 100644 index 0000000000..39a2bfdcd3 --- /dev/null +++ b/module/custom/config.php @@ -0,0 +1,18 @@ +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 = ''; diff --git a/module/custom/control.php b/module/custom/control.php new file mode 100644 index 0000000000..9d727c8601 --- /dev/null +++ b/module/custom/control.php @@ -0,0 +1,48 @@ + + * @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(); + } +} + diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php new file mode 100644 index 0000000000..90970f42d9 --- /dev/null +++ b/module/custom/lang/en.php @@ -0,0 +1,12 @@ +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'; diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php new file mode 100644 index 0000000000..62954b6207 --- /dev/null +++ b/module/custom/lang/zh-cn.php @@ -0,0 +1,12 @@ +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 = '用户'; diff --git a/module/custom/model.php b/module/custom/model.php new file mode 100644 index 0000000000..be1f04096a --- /dev/null +++ b/module/custom/model.php @@ -0,0 +1,116 @@ + + * @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(); + } + +} + diff --git a/module/custom/view/header.html.php b/module/custom/view/header.html.php new file mode 100755 index 0000000000..6bf5f36a39 --- /dev/null +++ b/module/custom/view/header.html.php @@ -0,0 +1,15 @@ + +
+
+ "; common::printLink('custom', 'index', "module=story", $lang->custom->story); echo ''; + echo ""; common::printLink('custom', 'index', "module=task", $lang->custom->task); echo ''; + echo ""; common::printLink('custom', 'index', "module=bug", $lang->custom->bug); echo ''; + echo ""; common::printLink('custom', 'index', "module=testcase", $lang->custom->testcase); echo ''; + echo ""; common::printLink('custom', 'index', "module=testtask", $lang->custom->testtask); echo ''; + echo ""; common::printLink('custom', 'index', "module=todo", $lang->custom->todo); echo '' ; + echo ""; common::printLink('custom', 'index', "module=user", $lang->custom->user); echo ''; + echo ""; + ?> +
+
diff --git a/module/custom/view/index.html.php b/module/custom/view/index.html.php new file mode 100644 index 0000000000..c79b466f23 --- /dev/null +++ b/module/custom/view/index.html.php @@ -0,0 +1,65 @@ + + * @package xxx + * @version $Id$ + * @link http://www.zentao.net + */ +?> + + + + + + + + + +EOT; +?> + +
+
+ config->custom->story->fields as $key => $value) + { + echo "" . html::a(inlink('index', "module=$module&field=$key"), $value) . ""; + } + ?> +
+
+ + + + + + + $value):?> + + + + + + +
custom->key;?>custom->value;?>
+ + +
+ + + diff --git a/module/customlang/config.php b/module/customlang/config.php deleted file mode 100644 index 969e01960a..0000000000 --- a/module/customlang/config.php +++ /dev/null @@ -1,19 +0,0 @@ -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 deleted file mode 100644 index 847a20444f..0000000000 --- a/module/customlang/control.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @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(); - } -} - diff --git a/module/customlang/lang/en.php b/module/customlang/lang/en.php deleted file mode 100644 index 40cf1af301..0000000000 --- a/module/customlang/lang/en.php +++ /dev/null @@ -1,10 +0,0 @@ -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'; diff --git a/module/customlang/lang/zh-cn.php b/module/customlang/lang/zh-cn.php deleted file mode 100644 index 216ad80438..0000000000 --- a/module/customlang/lang/zh-cn.php +++ /dev/null @@ -1,10 +0,0 @@ -customlang->common = '语言配置'; - -$lang->customlang->story = '需求'; -$lang->customlang->task = '任务'; -$lang->customlang->bug = 'Bug'; -$lang->customlang->testcase = '测试用例'; -$lang->customlang->testtask = '测试任务'; -$lang->customlang->todo = '待办'; -$lang->customlang->user = '用户'; diff --git a/module/customlang/model.php b/module/customlang/model.php deleted file mode 100644 index 85479a0a0d..0000000000 --- a/module/customlang/model.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @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(); - } -} - diff --git a/module/customlang/view/header.html.php b/module/customlang/view/header.html.php deleted file mode 100755 index d280894543..0000000000 --- a/module/customlang/view/header.html.php +++ /dev/null @@ -1,15 +0,0 @@ - -
-
- "; common::printLink('customlang', 'story', "", $lang->customlang->story); echo ''; - echo ""; common::printLink('customlang', 'task', "", $lang->customlang->task); echo ''; - echo ""; common::printLink('customlang', 'bug', "", $lang->customlang->bug); echo ''; - echo ""; common::printLink('customlang', 'testcase', "", $lang->customlang->testcase); echo ''; - echo ""; common::printLink('customlang', 'testtask', "", $lang->customlang->testtask); echo ''; - echo ""; common::printLink('customlang', 'todo', "", $lang->customlang->todo); echo '' ; - echo ""; common::printLink('customlang', 'user', "", $lang->customlang->user); echo ''; - echo ""; - ?> -
-
diff --git a/module/customlang/view/story.html.php b/module/customlang/view/story.html.php deleted file mode 100644 index 32467c8d7d..0000000000 --- a/module/customlang/view/story.html.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @package xxx - * @version $Id$ - * @link http://www.zentao.net - */ -?> - -
-
- config->customlang->story->fields as $key => $value) - { - echo "" . html::a(inlink('story', "field=$key"), $value) . ""; - } - ?> -
-
-
- - - - - - $value):?> - - - - - - -
-
- - From 107e4ec2d8e82a5ac2119d6314ed19850b9a2b7f Mon Sep 17 00:00:00 2001 From: xia0ta0 Date: Wed, 7 Aug 2013 09:24:04 +0800 Subject: [PATCH 10/32] * fix a bug : $index not defined. --- module/story/control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/story/control.php b/module/story/control.php index bc94d75b90..d35074d55a 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -805,7 +805,7 @@ class story extends control $moduleID = $this->tree->getAllChildID($moduleID); } $stories = $this->story->getProductStoryPairs($productID, $moduleID); - $select = html::select('story' . $index, $stories, $storyID, "class=''"); + $select = html::select('story', $stories, $storyID, "class=''"); /* If only need options, remove select wrap. */ if($onlyOption == 'true') die(substr($select, strpos($select, '>') + 1, -10)); From af97dcb643cb54e3a1426a36ea0c09f42c02c940 Mon Sep 17 00:00:00 2001 From: xia0ta0 Date: Wed, 7 Aug 2013 10:08:07 +0800 Subject: [PATCH 11/32] * isClickable is static function. --- module/project/model.php | 2 +- module/testcase/model.php | 2 +- module/testtask/model.php | 2 +- module/todo/model.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/module/project/model.php b/module/project/model.php index 4a6d2cbf9c..aa2347e9a5 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1439,7 +1439,7 @@ class projectModel extends model * @access public * @return bool */ - public function isClickable($project, $action) + public static function isClickable($project, $action) { $action = strtolower($action); diff --git a/module/testcase/model.php b/module/testcase/model.php index 9ffa244a84..6c50a5abe5 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -381,7 +381,7 @@ class testcaseModel extends model * @access public * @return void */ - public function isClickable($case, $action) + public static function isClickable($case, $action) { $action = strtolower($action); diff --git a/module/testtask/model.php b/module/testtask/model.php index b217ee495d..77584b03c6 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -483,7 +483,7 @@ class testtaskModel extends model * @access public * @return void */ - public function isClickable($testtask, $action) + public static function isClickable($testtask, $action) { $action = strtolower($action); diff --git a/module/todo/model.php b/module/todo/model.php index 365f6ee9cb..da6fe23075 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -333,7 +333,7 @@ class todoModel extends model * @access public * @return bool */ - public function isClickable($todo, $action) + public static function isClickable($todo, $action) { $action = strtolower($action); From 145c55b4473af26bceb7e5bc362492cfb6ed4252 Mon Sep 17 00:00:00 2001 From: azhi Date: Wed, 7 Aug 2013 10:40:10 +0800 Subject: [PATCH 12/32] * finish task#1670. * finish task#1671. * finish task#1672. * finish task#1674. * finish task#1675. * finish task#1676. * finish task#1668. --- framework/router.class.php | 1 + module/common/lang/zh-cn.php | 2 +- module/custom/config.php | 48 +++++++++++--- module/custom/control.php | 58 +++++++++++++++-- module/custom/css/common.css | 1 + module/custom/lang/en.php | 4 ++ module/custom/lang/zh-cn.php | 4 ++ module/custom/model.php | 36 +++++------ module/custom/view/index.html.php | 65 ------------------- module/custom/view/setcustom.html.php | 91 +++++++++++++++++++++++++++ 10 files changed, 214 insertions(+), 96 deletions(-) create mode 100644 module/custom/css/common.css delete mode 100644 module/custom/view/index.html.php create mode 100644 module/custom/view/setcustom.html.php diff --git a/framework/router.class.php b/framework/router.class.php index 80a8e98a1f..249c752779 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -1472,6 +1472,7 @@ class router if($moduleName == $record->module) { if(!$record->key) continue; + unset($lang->{$record->module}->{$record->section}[$record->key]); $lang->{$record->module}->{$record->section}[$record->key] = $record->value; } } diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index 1ce3e653e5..d16d99fb9a 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -283,7 +283,7 @@ $lang->convert = new stdclass(); $lang->upgrade = new stdclass(); $lang->action = new stdclass(); $lang->extension = new stdclass(); -$lang->customlang = new stdclass(); +$lang->custom = new stdclass(); $lang->editor = new stdclass(); $lang->mail = new stdclass(); $lang->sso = new stdclass(); diff --git a/module/custom/config.php b/module/custom/config.php index 39a2bfdcd3..4007559eff 100644 --- a/module/custom/config.php +++ b/module/custom/config.php @@ -6,13 +6,47 @@ $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->fields['statusList'] = '状态'; $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 = ''; +$config->custom->task = new stdClass(); +$config->custom->task->fields['priList'] = '优先级'; +$config->custom->task->fields['typeList'] = '类型'; +$config->custom->task->fields['reasonList'] = '关闭原因'; +$config->custom->task->fields['statusList'] = '状态'; +$config->custom->task->canAdd = 'priList,typeList'; + +$config->custom->bug = new stdClass(); +$config->custom->bug->fields['priList'] = '优先级'; +$config->custom->bug->fields['severityList'] = '严重程度'; +$config->custom->bug->fields['osList'] = '操作系统'; +$config->custom->bug->fields['browserList'] = '浏览器'; +$config->custom->bug->fields['typeList'] = '类型'; +$config->custom->bug->fields['resolutionList'] = '解决方案'; +$config->custom->bug->fields['statusList'] = '状态'; +$config->custom->bug->canAdd = 'priList,severityList,osList,browserList,typeList,resolutionList'; + +$config->custom->testcase = new stdClass(); +$config->custom->testcase->fields['priList'] = '优先级'; +$config->custom->testcase->fields['typeList'] = '类型'; +$config->custom->testcase->fields['stageList'] = '阶段'; +$config->custom->testcase->fields['resultList'] = '执行结果'; +$config->custom->testcase->fields['statusList'] = '状态'; +$config->custom->testcase->canAdd = 'priList,typeList,stageList'; + +$config->custom->testtask = new stdClass(); +$config->custom->testtask->fields['priList'] = '优先级'; +$config->custom->testtask->fields['statusList'] = '状态'; +$config->custom->testtask->canAdd = 'priList'; + +$config->custom->todo = new stdClass(); +$config->custom->todo->fields['priList'] = '优先级'; +$config->custom->todo->fields['typeList'] = '类型'; +$config->custom->todo->fields['statusList'] = '状态'; +$config->custom->todo->canAdd = 'priList,typeList'; + +$config->custom->user = new stdClass(); +$config->custom->user->fields['roleList'] = '角色'; +$config->custom->user->fields['statusList'] = '状态'; +$config->custom->user->canAdd = 'roleList'; diff --git a/module/custom/control.php b/module/custom/control.php index 9d727c8601..cd39d0a342 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -11,38 +11,86 @@ */ class custom extends control { + /** + * __construct + * + * @access public + * @return void + */ public function __construct() { parent::__construct(); } - public function index($module = 'story', $field = 'priList') + /** + * Index + * + * @access public + * @return void + */ + public function index() { + die(js::locate(inlink('setCustom'))); + } + + /** + * Custom + * + * @param string $module + * @param string $field + * @access public + * @return void + */ + public function setCustom($module = 'story', $field = 'priList') + { + if($module == 'user' and $field == 'priList') $field = 'roleList'; $lang = $this->app->getClientLang(); $this->app->loadLang($module); $fieldList = $this->lang->$module->$field; if(!empty($_POST)) { + $this->custom->deleteItems("{$lang}.{$module}.{$field}"); 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); + $value = $_POST['values'][$index]; + $system = $_POST['systems'][$index]; + $this->custom->setItem("{$lang}.{$module}.{$field}.{$key}.{$system}", $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->dbFields = $this->custom->getItems("{$lang}.{$module}.{$field}"); $this->view->field = $field; $this->view->module = $module; $this->view->canAdd = strpos($this->config->custom->$module->canAdd, $field) !== false; $this->display(); } + + /** + * Restore the default lang. Delete the related items. + * + * @param string $module + * @param string $field + * @param string $confirm + * @access public + * @return void + */ + public function restore($module, $field, $confirm = 'no') + { + if($confirm == 'no') + { + die(js::confirm($this->lang->custom->confirmRestore, inlink('restore', "module=$module&field=$field&confirm=yes"))); + } + + $lang = $this->app->getClientLang(); + $this->custom->deleteItems("{$lang}.{$module}.{$field}"); + die(js::reload('parent')); + } } diff --git a/module/custom/css/common.css b/module/custom/css/common.css new file mode 100644 index 0000000000..c438eadb9c --- /dev/null +++ b/module/custom/css/common.css @@ -0,0 +1 @@ +input[type='text'] {border:1px solid #ccc; padding:3px 0px} diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php index 90970f42d9..a577464f86 100644 --- a/module/custom/lang/en.php +++ b/module/custom/lang/en.php @@ -1,5 +1,6 @@ custom->common = 'Custom'; +$lang->custom->custom = 'Custom'; $lang->custom->key = 'Key'; $lang->custom->value = 'Value'; @@ -10,3 +11,6 @@ $lang->custom->testcase = 'Test case'; $lang->custom->testtask = 'Test task'; $lang->custom->todo = 'Todo'; $lang->custom->user = 'User'; + +$lang->custom->restore = 'restore'; +$lang->custom->confirmRestore = 'Are you sure to restore the default lang setting?'; diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php index 62954b6207..9667bf7ba6 100644 --- a/module/custom/lang/zh-cn.php +++ b/module/custom/lang/zh-cn.php @@ -1,5 +1,6 @@ custom->common = '自定义配置'; +$lang->custom->custom = '自定义配置'; $lang->custom->key = '键'; $lang->custom->value = '值'; @@ -10,3 +11,6 @@ $lang->custom->testcase = '测试用例'; $lang->custom->testtask = '测试任务'; $lang->custom->todo = '待办'; $lang->custom->user = '用户'; + +$lang->custom->restore = '恢复默认'; +$lang->custom->confirmRestore = '是否要恢复默认语言配置?'; diff --git a/module/custom/model.php b/module/custom/model.php index be1f04096a..c20952f2d1 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -1,20 +1,19 @@ - * @package xxx + * @author Congzhi Chen + * @package custom * @version $Id$ * @link http://www.zentao.net */ class customModel extends model { /** - * Get config of system and one user. + * Get all custom lang. * - * @param string $account * @access public * @return array */ @@ -26,7 +25,7 @@ class customModel extends model /** * Set value of an item. * - * @param string $path system.common.global.sn or system.common.sn + * @param string $path zh-cn.story.soucreList.customer.1 * @param string $value * @access public * @return void @@ -34,11 +33,13 @@ class customModel extends model public function setItem($path, $value = '') { $level = substr_count($path, '.'); - $section = ''; + $section = ''; + $system = 1; if($level <= 1) return false; if($level == 2) list($lang, $module, $key) = explode('.', $path); if($level == 3) list($lang, $module, $section, $key) = explode('.', $path); + if($level == 4) list($lang, $module, $section, $key, $system) = explode('.', $path); $item = new stdclass(); $item->lang = $lang; @@ -46,21 +47,21 @@ class customModel extends model $item->section = $section; $item->key = $key; $item->value = $value; + $item->system = $system; $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}"); - } - + /** + * Get some items + * + * @param string $paramString see parseItemParam(); + * @access public + * @return void + */ public function getItems($paramString) { - return $this->createDAO($this->parseItemParam($paramString), 'select')->fetchAll('id'); + return $this->createDAO($this->parseItemParam($paramString), 'select')->fetchAll('key'); } /** @@ -78,7 +79,7 @@ class customModel extends model /** * Parse the param string for select or delete items. * - * @param string $paramString owner=xxx&key=sn and so on. + * @param string $paramString lang=xxx&module=story§ion=sourceList&key=customer and so on. * @access public * @return array */ @@ -111,6 +112,5 @@ class customModel extends model ->beginIF($params['section'])->andWhere('section')->in($params['section'])->fi() ->beginIF($params['key'])->andWhere('`key`')->in($params['key'])->fi(); } - } diff --git a/module/custom/view/index.html.php b/module/custom/view/index.html.php deleted file mode 100644 index c79b466f23..0000000000 --- a/module/custom/view/index.html.php +++ /dev/null @@ -1,65 +0,0 @@ - - * @package xxx - * @version $Id$ - * @link http://www.zentao.net - */ -?> - - - - - - - - - -EOT; -?> - -
-
- config->custom->story->fields as $key => $value) - { - echo "" . html::a(inlink('index', "module=$module&field=$key"), $value) . ""; - } - ?> -
-
-
- - - - - - $value):?> - - - - - - -
custom->key;?>custom->value;?>
- - -
-
- - diff --git a/module/custom/view/setcustom.html.php b/module/custom/view/setcustom.html.php new file mode 100644 index 0000000000..074586eda5 --- /dev/null +++ b/module/custom/view/setcustom.html.php @@ -0,0 +1,91 @@ + + * @package custom + * @version $Id$ + * @link http://www.zentao.net + */ +?> + +
+
+ "; common::printLink('custom', 'setCustom', "module=story", $lang->custom->story); echo ''; + echo ""; common::printLink('custom', 'setCustom', "module=task", $lang->custom->task); echo ''; + echo ""; common::printLink('custom', 'setCustom', "module=bug", $lang->custom->bug); echo ''; + echo ""; common::printLink('custom', 'setCustom', "module=testcase", $lang->custom->testcase); echo ''; + echo ""; common::printLink('custom', 'setCustom', "module=testtask", $lang->custom->testtask); echo ''; + echo ""; common::printLink('custom', 'setCustom', "module=todo", $lang->custom->todo); echo '' ; + echo ""; common::printLink('custom', 'setCustom', "module=user", $lang->custom->user); echo ''; + echo ""; + ?> +
+
+ + + + + + + + + + + + + +EOT; +?> + +
+
+ custom->{$module}->fields as $key => $value) + { + echo "" . html::a(inlink('setCustom', "module=$module&field=$key"), $value) . ""; + } + ?> +
+
+
+ + + + + + + $value):?> + + system : 1;?> + + + + + + + + +
custom->key;?>custom->value;?>
+ + + + +
custom->restore, inlink('restore', "modult=$modult&field=$field"), 'hiddenwin')?>
+
+ + From aebe854ad96c58d1d41e7920d05b08ab7e33cac5 Mon Sep 17 00:00:00 2001 From: azhi Date: Wed, 7 Aug 2013 13:40:23 +0800 Subject: [PATCH 13/32] * finish task31673. * add chosen(multiple) for stageList of testcase-batchedit. * add authority for custom module. --- module/common/lang/menuOrder.php | 8 +- module/common/lang/zh-cn.php | 3 +- module/custom/js/setcustom.js | 16 ++++ module/custom/lang/en.php | 11 +-- module/custom/lang/zh-cn.php | 11 +-- module/custom/view/header.html.php | 15 ---- module/custom/view/setcustom.html.php | 115 ++++++++++++------------ module/group/lang/resource.php | 36 +++++--- module/testcase/css/batchedit.css | 1 + module/testcase/js/batchedit.js | 4 + module/testcase/lang/en.php | 7 -- module/testcase/lang/zh-cn.php | 7 -- module/testcase/view/batchedit.html.php | 16 +--- 13 files changed, 123 insertions(+), 127 deletions(-) create mode 100644 module/custom/js/setcustom.js delete mode 100755 module/custom/view/header.html.php create mode 100644 module/testcase/js/batchedit.js diff --git a/module/common/lang/menuOrder.php b/module/common/lang/menuOrder.php index c46f62f023..653733efd9 100644 --- a/module/common/lang/menuOrder.php +++ b/module/common/lang/menuOrder.php @@ -111,9 +111,10 @@ $lang->admin->menuOrder[10] = 'extension'; $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->admin->menuOrder[30] = 'custom'; +$lang->admin->menuOrder[35] = 'sso'; +$lang->admin->menuOrder[40] = 'convert'; +$lang->admin->menuOrder[45] = 'trashes'; $lang->convert->menuOrder = $lang->admin->menuOrder; $lang->upgrade->menuOrder = $lang->admin->menuOrder; $lang->action->menuOrder = $lang->admin->menuOrder; @@ -121,4 +122,5 @@ $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->custom->menuOrder = $lang->admin->menuOrder; $lang->sso->menuOrder = $lang->admin->menuOrder; diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index d16d99fb9a..de0d6594bf 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->custom = array('link' => '自定义配置|custom|index', 'subModule' => 'custom'); +$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'); @@ -316,6 +316,7 @@ $lang->menugroup->dept = 'company'; $lang->menugroup->todo = 'my'; $lang->menugroup->action = 'admin'; $lang->menugroup->extension = 'admin'; +$lang->menugroup->custom = 'admin'; $lang->menugroup->editor = 'admin'; $lang->menugroup->mail = 'admin'; $lang->menugroup->sso = 'admin'; diff --git a/module/custom/js/setcustom.js b/module/custom/js/setcustom.js new file mode 100644 index 0000000000..fc82613a9e --- /dev/null +++ b/module/custom/js/setcustom.js @@ -0,0 +1,16 @@ +function addItem(clickedButton) +{ + $(clickedButton).parent().parent().after(itemRow); +} + +function delItem(clickedButton) +{ + $(clickedButton).parent().parent().remove(); +} + +$(function() +{ + $('#' + module + 'Tab').addClass('active'); + $('#' + field + 'Tab').addClass('active'); +}) + diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php index a577464f86..080b658e2f 100644 --- a/module/custom/lang/en.php +++ b/module/custom/lang/en.php @@ -1,8 +1,10 @@ custom->common = 'Custom'; -$lang->custom->custom = 'Custom'; -$lang->custom->key = 'Key'; -$lang->custom->value = 'Value'; +$lang->custom->common = 'Custom'; +$lang->custom->index = 'Index'; +$lang->custom->setCustom = 'Set custom'; +$lang->custom->restore = 'restore'; +$lang->custom->key = 'Key'; +$lang->custom->value = 'Value'; $lang->custom->story = 'Story'; $lang->custom->task = 'Task'; @@ -12,5 +14,4 @@ $lang->custom->testtask = 'Test task'; $lang->custom->todo = 'Todo'; $lang->custom->user = 'User'; -$lang->custom->restore = 'restore'; $lang->custom->confirmRestore = 'Are you sure to restore the default lang setting?'; diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php index 9667bf7ba6..bc56aa91ea 100644 --- a/module/custom/lang/zh-cn.php +++ b/module/custom/lang/zh-cn.php @@ -1,8 +1,10 @@ custom->common = '自定义配置'; -$lang->custom->custom = '自定义配置'; -$lang->custom->key = '键'; -$lang->custom->value = '值'; +$lang->custom->common = '自定义'; +$lang->custom->index = '首页'; +$lang->custom->setCustom = '自定义配置'; +$lang->custom->restore = '恢复默认'; +$lang->custom->key = '键'; +$lang->custom->value = '值'; $lang->custom->story = '需求'; $lang->custom->task = '任务'; @@ -12,5 +14,4 @@ $lang->custom->testtask = '测试任务'; $lang->custom->todo = '待办'; $lang->custom->user = '用户'; -$lang->custom->restore = '恢复默认'; $lang->custom->confirmRestore = '是否要恢复默认语言配置?'; diff --git a/module/custom/view/header.html.php b/module/custom/view/header.html.php deleted file mode 100755 index 6bf5f36a39..0000000000 --- a/module/custom/view/header.html.php +++ /dev/null @@ -1,15 +0,0 @@ - -
-
- "; common::printLink('custom', 'index', "module=story", $lang->custom->story); echo ''; - echo ""; common::printLink('custom', 'index', "module=task", $lang->custom->task); echo ''; - echo ""; common::printLink('custom', 'index', "module=bug", $lang->custom->bug); echo ''; - echo ""; common::printLink('custom', 'index', "module=testcase", $lang->custom->testcase); echo ''; - echo ""; common::printLink('custom', 'index', "module=testtask", $lang->custom->testtask); echo ''; - echo ""; common::printLink('custom', 'index', "module=todo", $lang->custom->todo); echo '' ; - echo ""; common::printLink('custom', 'index', "module=user", $lang->custom->user); echo ''; - echo ""; - ?> -
-
diff --git a/module/custom/view/setcustom.html.php b/module/custom/view/setcustom.html.php index 074586eda5..896ee7e1ed 100644 --- a/module/custom/view/setcustom.html.php +++ b/module/custom/view/setcustom.html.php @@ -11,22 +11,9 @@ */ ?> -
-
- "; common::printLink('custom', 'setCustom', "module=story", $lang->custom->story); echo ''; - echo ""; common::printLink('custom', 'setCustom', "module=task", $lang->custom->task); echo ''; - echo ""; common::printLink('custom', 'setCustom', "module=bug", $lang->custom->bug); echo ''; - echo ""; common::printLink('custom', 'setCustom', "module=testcase", $lang->custom->testcase); echo ''; - echo ""; common::printLink('custom', 'setCustom', "module=testtask", $lang->custom->testtask); echo ''; - echo ""; common::printLink('custom', 'setCustom', "module=todo", $lang->custom->todo); echo '' ; - echo ""; common::printLink('custom', 'setCustom', "module=user", $lang->custom->user); echo ''; - echo ""; - ?> -
-
+ @@ -42,50 +29,66 @@ EOT; ?> - + + +
- custom->{$module}->fields as $key => $value) - { - echo "" . html::a(inlink('setCustom', "module=$module&field=$key"), $value) . ""; - } + "; common::printLink('custom', 'setCustom', "module=story", $lang->custom->story); echo ''; + echo ""; common::printLink('custom', 'setCustom', "module=task", $lang->custom->task); echo ''; + echo ""; common::printLink('custom', 'setCustom', "module=bug", $lang->custom->bug); echo ''; + echo ""; common::printLink('custom', 'setCustom', "module=testcase", $lang->custom->testcase); echo ''; + echo ""; common::printLink('custom', 'setCustom', "module=testtask", $lang->custom->testtask); echo ''; + echo ""; common::printLink('custom', 'setCustom', "module=todo", $lang->custom->todo); echo '' ; + echo ""; common::printLink('custom', 'setCustom', "module=user", $lang->custom->user); echo ''; ?>
-
- - - - - - - $value):?> - - system : 1;?> - - - - - - - - -
custom->key;?>custom->value;?>
- - - - -
custom->restore, inlink('restore', "modult=$modult&field=$field"), 'hiddenwin')?>
-
- + + + + + + +
+
custom->$module?>
+
+
    + custom->{$module}->fields as $key => $value) + { + echo "
  • " . html::a(inlink('setCustom', "module=$module&field=$key"), $value) . "
  • "; + } + ?> +
+
+
+
+ + + + + + + + $value):?> + + system : 1;?> + + + + + + + + +
custom->$module . ' >> ' . $config->custom->$module->fields[$field]?>
custom->key;?>custom->value;?>
+ + + + +
custom->restore, inlink('restore', "module=$module&field=$field"), 'hiddenwin')?>
+
+
diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index b04e4137db..611087db2a 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -39,20 +39,20 @@ $lang->moduleOrder[95] = 'user'; $lang->moduleOrder[100] = 'admin'; $lang->moduleOrder[105] = 'extension'; -$lang->moduleOrder[105] = 'extension'; -$lang->moduleOrder[110] = 'editor'; -$lang->moduleOrder[115] = 'convert'; -$lang->moduleOrder[120] = 'action'; +$lang->moduleOrder[110] = 'custom'; +$lang->moduleOrder[115] = 'editor'; +$lang->moduleOrder[120] = 'convert'; +$lang->moduleOrder[125] = 'action'; -$lang->moduleOrder[125] = 'mail'; -$lang->moduleOrder[130] = 'svn'; -$lang->moduleOrder[135] = 'search'; -$lang->moduleOrder[140] = 'tree'; -$lang->moduleOrder[145] = 'api'; -$lang->moduleOrder[150] = 'file'; -$lang->moduleOrder[155] = 'misc'; -$lang->moduleOrder[160] = 'sso'; -$lang->moduleOrder[165] = 'webapp'; +$lang->moduleOrder[130] = 'mail'; +$lang->moduleOrder[135] = 'svn'; +$lang->moduleOrder[140] = 'search'; +$lang->moduleOrder[145] = 'tree'; +$lang->moduleOrder[150] = 'api'; +$lang->moduleOrder[155] = 'file'; +$lang->moduleOrder[160] = 'misc'; +$lang->moduleOrder[165] = 'sso'; +$lang->moduleOrder[170] = 'webapp'; $lang->resource = new stdclass(); @@ -489,6 +489,16 @@ $lang->mail->methodOrder[20] = 'save'; $lang->mail->methodOrder[25] = 'test'; $lang->mail->methodOrder[30] = 'reset'; +/* custom. */ +$lang->resource->custom = new stdclass(); +$lang->resource->custom->index = 'index'; +$lang->resource->custom->setCustom = 'setCustom'; +$lang->resource->custom->restore = 'restore'; + +$lang->custom->methodOrder[5] = 'index'; +$lang->custom->methodOrder[10] = 'setCustom'; +$lang->custom->methodOrder[15] = 'restore'; + /* Subversion. */ $lang->resource->svn = new stdclass(); $lang->resource->svn->diff = 'diff'; diff --git a/module/testcase/css/batchedit.css b/module/testcase/css/batchedit.css index 10b4561986..b78baac20e 100755 --- a/module/testcase/css/batchedit.css +++ b/module/testcase/css/batchedit.css @@ -1 +1,2 @@ .w-340px {width:340px} +.chosen {z-index:99} diff --git a/module/testcase/js/batchedit.js b/module/testcase/js/batchedit.js new file mode 100644 index 0000000000..8bf7fc4fff --- /dev/null +++ b/module/testcase/js/batchedit.js @@ -0,0 +1,4 @@ +$(function() +{ + $(".chosen").chosen({no_results_text:noResultsMatch}); +}) diff --git a/module/testcase/lang/en.php b/module/testcase/lang/en.php index 5b2a8a9d42..78d1723562 100644 --- a/module/testcase/lang/en.php +++ b/module/testcase/lang/en.php @@ -135,13 +135,6 @@ $lang->testcase->stageList['system'] = 'System testing'; $lang->testcase->stageList['smoke'] = 'Smoking testing'; $lang->testcase->stageList['bvt'] = 'BVT testing'; -$lang->testcase->stageListAB['unittest'] = 'Unit'; -$lang->testcase->stageListAB['feature'] = 'Feature'; -$lang->testcase->stageListAB['intergrate'] = 'Integrate'; -$lang->testcase->stageListAB['system'] = 'System'; -$lang->testcase->stageListAB['smoke'] = 'Smoking'; -$lang->testcase->stageListAB['bvt'] = 'BVT'; - $lang->testcase->statusList[''] = ''; $lang->testcase->statusList['normal'] = 'Normal'; $lang->testcase->statusList['blocked'] = 'Blocked'; diff --git a/module/testcase/lang/zh-cn.php b/module/testcase/lang/zh-cn.php index a99ed5e829..70ae7811fd 100644 --- a/module/testcase/lang/zh-cn.php +++ b/module/testcase/lang/zh-cn.php @@ -135,13 +135,6 @@ $lang->testcase->stageList['system'] = '系统测试阶段'; $lang->testcase->stageList['smoke'] = '冒烟测试阶段'; $lang->testcase->stageList['bvt'] = '版本验证阶段'; -$lang->testcase->stageListAB['unittest'] = '单元'; -$lang->testcase->stageListAB['feature'] = '功能'; -$lang->testcase->stageListAB['intergrate'] = '集成'; -$lang->testcase->stageListAB['system'] = '系统'; -$lang->testcase->stageListAB['smoke'] = '冒烟'; -$lang->testcase->stageListAB['bvt'] = '版本'; - $lang->testcase->statusList[''] = ''; $lang->testcase->statusList['normal'] = '正常'; $lang->testcase->statusList['blocked'] = '被阻塞'; diff --git a/module/testcase/view/batchedit.html.php b/module/testcase/view/batchedit.html.php index bc69532211..d26bef31bd 100644 --- a/module/testcase/view/batchedit.html.php +++ b/module/testcase/view/batchedit.html.php @@ -32,21 +32,7 @@ module, "class='select-1'");?> title, 'class=text-1'); echo "*";?> testcase->typeList, $cases[$caseID]->type, 'class=select-1');?> - - testcase->stageListAB as $key => $stage) - { - if(in_array($key, explode(',', $cases[$caseID]->stage))) - { - echo "$stage "; - } - else - { - echo "$stage "; - } - } - ?> - + testcase->stageList, $cases[$caseID]->stage, "class='select-1 chosen' multiple data-placeholder='{$lang->testcase->stage}'");?> From 74b531f8102267c0874f6a1693c368b681082ab7 Mon Sep 17 00:00:00 2001 From: xia0ta0 Date: Wed, 7 Aug 2013 14:02:56 +0800 Subject: [PATCH 14/32] * fix strict warning. --- module/project/model.php | 6 ++++-- module/tree/model.php | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/module/project/model.php b/module/project/model.php index aa2347e9a5..182b0f2677 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -940,7 +940,8 @@ class projectModel extends model $BugToTasks = fixer::input('post')->get(); foreach($BugToTasks->import as $key => $value) { - $bug = $this->bug->getById($key); + $bug = $this->bug->getById($key); + $task = new stdClass(); $task->project = $projectID; $task->story = $bug->story; $task->storyVersion = $bug->story; @@ -975,13 +976,14 @@ class projectModel extends model $taskID = $this->dao->lastInsertID(); if($task->story != false) $this->story->setStage($task->story); $actionID = $this->loadModel('action')->create('task', $taskID, 'Opened', ''); + $mails[$key] = new stdClass(); $mails[$key]->taskID = $taskID; $mails[$key]->actionID = $actionID; $this->action->create('bug', $key, 'Totask', '', $taskID); $this->dao->update(TABLE_BUG)->set('toTask')->eq($taskID)->where('id')->eq($key)->exec(); - if($task->assignedTo and $task->assignedTo != $bug->assignedTo) + if(isset($task->assignedTo) and $task->assignedTo and $task->assignedTo != $bug->assignedTo) { $newBug = new stdClass(); $newBug->lastEditedBy = $this->app->user->account; diff --git a/module/tree/model.php b/module/tree/model.php index 11339b6f65..6ded9af09d 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -883,6 +883,7 @@ class treeModel extends model /* The new modules. */ if(is_numeric($moduleID)) { + $module = new stdClass(); $module->root = $rootID; $module->name = strip_tags($moduleName); $module->parent = $parentModuleID; From ea739d600b07704d3e48cfea87fc36fdb1bf6acd Mon Sep 17 00:00:00 2001 From: azhi Date: Wed, 7 Aug 2013 15:48:55 +0800 Subject: [PATCH 15/32] * adjust for load lang from db. --- framework/router.class.php | 11 ++++---- module/custom/control.php | 36 ++++++++++----------------- module/custom/lang/en.php | 3 +++ module/custom/lang/zh-cn.php | 3 +++ module/custom/model.php | 15 ++++++++--- module/custom/view/setcustom.html.php | 15 +++++++++-- 6 files changed, 49 insertions(+), 34 deletions(-) diff --git a/framework/router.class.php b/framework/router.class.php index 249c752779..e2fde411c1 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -1465,15 +1465,14 @@ class router } /* Merge from the db lang. */ - if($moduleName != 'common' and isset($lang->db->custom)) + if($moduleName != 'common' and isset($lang->db->custom[$moduleName])) { - foreach($lang->db->custom as $record) + foreach($lang->db->custom[$moduleName] as $section => $fields) { - if($moduleName == $record->module) + foreach($fields as $key => $value) { - if(!$record->key) continue; - unset($lang->{$record->module}->{$record->section}[$record->key]); - $lang->{$record->module}->{$record->section}[$record->key] = $record->value; + unset($lang->{$moduleName}->{$section}[$key]); + $lang->{$moduleName}->{$section}[$key] = $value; } } } diff --git a/module/custom/control.php b/module/custom/control.php index cd39d0a342..b761a95d27 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -11,17 +11,6 @@ */ class custom extends control { - /** - * __construct - * - * @access public - * @return void - */ - public function __construct() - { - parent::__construct(); - } - /** * Index * @@ -44,13 +33,14 @@ class custom extends control public function setCustom($module = 'story', $field = 'priList') { if($module == 'user' and $field == 'priList') $field = 'roleList'; - $lang = $this->app->getClientLang(); + $currentLang = $this->app->getClientLang(); $this->app->loadLang($module); $fieldList = $this->lang->$module->$field; if(!empty($_POST)) { - $this->custom->deleteItems("{$lang}.{$module}.{$field}"); + $lang = $_POST['lang']; + $this->custom->deleteItems("lang=$lang&module=$module§ion=$field"); foreach($_POST['keys'] as $index => $key) { $value = $_POST['values'][$index]; @@ -60,14 +50,15 @@ class custom extends control if(!dao::getError()) die(js::reload('parent')); } - $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->dbFields = $this->custom->getItems("{$lang}.{$module}.{$field}"); - $this->view->field = $field; - $this->view->module = $module; - $this->view->canAdd = strpos($this->config->custom->$module->canAdd, $field) !== false; + $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->dbFields = $this->custom->getItems("module=$module§ion=$field"); + $this->view->field = $field; + $this->view->module = $module; + $this->view->currentLang = $currentLang; + $this->view->canAdd = strpos($this->config->custom->$module->canAdd, $field) !== false; $this->display(); } @@ -88,8 +79,7 @@ class custom extends control die(js::confirm($this->lang->custom->confirmRestore, inlink('restore', "module=$module&field=$field&confirm=yes"))); } - $lang = $this->app->getClientLang(); - $this->custom->deleteItems("{$lang}.{$module}.{$field}"); + $this->custom->deleteItems("module=$module§ion=$field"); die(js::reload('parent')); } } diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php index 080b658e2f..589a104d5c 100644 --- a/module/custom/lang/en.php +++ b/module/custom/lang/en.php @@ -14,4 +14,7 @@ $lang->custom->testtask = 'Test task'; $lang->custom->todo = 'Todo'; $lang->custom->user = 'User'; +$lang->custom->currentLang = 'For current language'; +$lang->custom->allLang = 'For all language'; + $lang->custom->confirmRestore = 'Are you sure to restore the default lang setting?'; diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php index bc56aa91ea..039722fd9e 100644 --- a/module/custom/lang/zh-cn.php +++ b/module/custom/lang/zh-cn.php @@ -14,4 +14,7 @@ $lang->custom->testtask = '测试任务'; $lang->custom->todo = '待办'; $lang->custom->user = '用户'; +$lang->custom->currentLang = '适用当前语言'; +$lang->custom->allLang = '适用所有语言'; + $lang->custom->confirmRestore = '是否要恢复默认语言配置?'; diff --git a/module/custom/model.php b/module/custom/model.php index c20952f2d1..71914c1025 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -19,7 +19,17 @@ class customModel extends model */ public function getAll() { - return $this->dao->select('*')->from(TABLE_CUSTOM)->orderBy('id')->fetchAll('id'); + $allCustomLang = $this->dao->select('*')->from(TABLE_CUSTOM)->orderBy('lang,id')->fetchAll('id'); + + $currentLang = $this->app->getClientLang(); + $processedLang = array(); + foreach($allCustomLang as $id => $customLang) + { + if($customLang->lang != $currentLang and $customLang->lang != 'all') continue; + $processedLang[$customLang->module][$customLang->section][$customLang->key] = $customLang->value; + } + + return $processedLang; } /** @@ -61,7 +71,7 @@ class customModel extends model */ public function getItems($paramString) { - return $this->createDAO($this->parseItemParam($paramString), 'select')->fetchAll('key'); + return $this->createDAO($this->parseItemParam($paramString), 'select')->orderBy('lang,id')->fetchAll('key'); } /** @@ -113,4 +123,3 @@ class customModel extends model ->beginIF($params['key'])->andWhere('`key`')->in($params['key'])->fi(); } } - diff --git a/module/custom/view/setcustom.html.php b/module/custom/view/setcustom.html.php index 896ee7e1ed..13dad68c49 100644 --- a/module/custom/view/setcustom.html.php +++ b/module/custom/view/setcustom.html.php @@ -63,7 +63,7 @@ EOT;
- +
@@ -85,7 +85,18 @@ EOT; - + + + + +
custom->$module . ' >> ' . $config->custom->$module->fields[$field]?>
custom->key;?>
custom->restore, inlink('restore', "module=$module&field=$field"), 'hiddenwin')?>
+ $lang->custom->currentLang, 'all' => $lang->custom->allLang); + echo html::radio('lang', $appliedTo, 'all'); + echo html::submitButton(); + if(common::hasPriv('custom', 'restore')) echo html::linkButton($lang->custom->restore, inlink('restore', "module=$module&field=$field"), 'hiddenwin'); + ?> +
From 1f3cde2847149f66c240cc932450906dabb666f3 Mon Sep 17 00:00:00 2001 From: azhi Date: Wed, 7 Aug 2013 16:37:28 +0800 Subject: [PATCH 16/32] * code for custom set. --- module/custom/control.php | 8 +++++--- module/custom/js/{setcustom.js => set.js} | 0 module/custom/lang/en.php | 2 +- module/custom/lang/zh-cn.php | 2 +- .../view/{setcustom.html.php => set.html.php} | 18 +++++++++--------- module/group/lang/resource.php | 8 ++++---- 6 files changed, 20 insertions(+), 18 deletions(-) rename module/custom/js/{setcustom.js => set.js} (100%) rename module/custom/view/{setcustom.html.php => set.html.php} (86%) diff --git a/module/custom/control.php b/module/custom/control.php index b761a95d27..fbb0ba8355 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -19,7 +19,7 @@ class custom extends control */ public function index() { - die(js::locate(inlink('setCustom'))); + die(js::locate(inlink('set'))); } /** @@ -30,7 +30,7 @@ class custom extends control * @access public * @return void */ - public function setCustom($module = 'story', $field = 'priList') + public function set($module = 'story', $field = 'priList') { if($module == 'user' and $field == 'priList') $field = 'roleList'; $currentLang = $this->app->getClientLang(); @@ -44,10 +44,12 @@ class custom extends control foreach($_POST['keys'] as $index => $key) { $value = $_POST['values'][$index]; + if(!$value or !$key) continue; $system = $_POST['systems'][$index]; $this->custom->setItem("{$lang}.{$module}.{$field}.{$key}.{$system}", $value); } - if(!dao::getError()) die(js::reload('parent')); + if(dao::isError()) die(js::error(dao::getError())); + die(js::reload('parent')); } $this->view->title = $this->lang->custom->common . $this->lang->colon . $this->lang->custom->story; diff --git a/module/custom/js/setcustom.js b/module/custom/js/set.js similarity index 100% rename from module/custom/js/setcustom.js rename to module/custom/js/set.js diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php index 589a104d5c..7986930cf0 100644 --- a/module/custom/lang/en.php +++ b/module/custom/lang/en.php @@ -1,7 +1,7 @@ custom->common = 'Custom'; $lang->custom->index = 'Index'; -$lang->custom->setCustom = 'Set custom'; +$lang->custom->set = 'Set custom'; $lang->custom->restore = 'restore'; $lang->custom->key = 'Key'; $lang->custom->value = 'Value'; diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php index 039722fd9e..ddaa4a83b7 100644 --- a/module/custom/lang/zh-cn.php +++ b/module/custom/lang/zh-cn.php @@ -1,7 +1,7 @@ custom->common = '自定义'; $lang->custom->index = '首页'; -$lang->custom->setCustom = '自定义配置'; +$lang->custom->set = '自定义配置'; $lang->custom->restore = '恢复默认'; $lang->custom->key = '键'; $lang->custom->value = '值'; diff --git a/module/custom/view/setcustom.html.php b/module/custom/view/set.html.php similarity index 86% rename from module/custom/view/setcustom.html.php rename to module/custom/view/set.html.php index 13dad68c49..cc1471e65e 100644 --- a/module/custom/view/setcustom.html.php +++ b/module/custom/view/set.html.php @@ -1,6 +1,6 @@
"; common::printLink('custom', 'setCustom', "module=story", $lang->custom->story); echo ''; - echo ""; common::printLink('custom', 'setCustom', "module=task", $lang->custom->task); echo ''; - echo ""; common::printLink('custom', 'setCustom', "module=bug", $lang->custom->bug); echo ''; - echo ""; common::printLink('custom', 'setCustom', "module=testcase", $lang->custom->testcase); echo ''; - echo ""; common::printLink('custom', 'setCustom', "module=testtask", $lang->custom->testtask); echo ''; - echo ""; common::printLink('custom', 'setCustom', "module=todo", $lang->custom->todo); echo '' ; - echo ""; common::printLink('custom', 'setCustom', "module=user", $lang->custom->user); echo ''; + echo ""; common::printLink('custom', 'set', "module=story", $lang->custom->story); echo ''; + echo ""; common::printLink('custom', 'set', "module=task", $lang->custom->task); echo ''; + echo ""; common::printLink('custom', 'set', "module=bug", $lang->custom->bug); echo ''; + echo ""; common::printLink('custom', 'set', "module=testcase", $lang->custom->testcase); echo ''; + echo ""; common::printLink('custom', 'set', "module=testtask", $lang->custom->testtask); echo ''; + echo ""; common::printLink('custom', 'set', "module=todo", $lang->custom->todo); echo '' ; + echo ""; common::printLink('custom', 'set', "module=user", $lang->custom->user); echo ''; ?>
@@ -54,7 +54,7 @@ EOT; custom->{$module}->fields as $key => $value) { - echo "
  • " . html::a(inlink('setCustom', "module=$module&field=$key"), $value) . "
  • "; + echo "
  • " . html::a(inlink('set', "module=$module&field=$key"), $value) . "
  • "; } ?> diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index 611087db2a..b9f1514d13 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -491,12 +491,12 @@ $lang->mail->methodOrder[30] = 'reset'; /* custom. */ $lang->resource->custom = new stdclass(); -$lang->resource->custom->index = 'index'; -$lang->resource->custom->setCustom = 'setCustom'; -$lang->resource->custom->restore = 'restore'; +$lang->resource->custom->index = 'index'; +$lang->resource->custom->set = 'set'; +$lang->resource->custom->restore = 'restore'; $lang->custom->methodOrder[5] = 'index'; -$lang->custom->methodOrder[10] = 'setCustom'; +$lang->custom->methodOrder[10] = 'set'; $lang->custom->methodOrder[15] = 'restore'; /* Subversion. */ From ed3371923aab0fdce0d50955d29e5bdfa44a6840 Mon Sep 17 00:00:00 2001 From: wyd621 Date: Wed, 7 Aug 2013 16:44:41 +0800 Subject: [PATCH 17/32] * fix a bug for webapp pager. --- module/webapp/control.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/webapp/control.php b/module/webapp/control.php index 9bca1db02d..d6932ed716 100644 --- a/module/webapp/control.php +++ b/module/webapp/control.php @@ -57,6 +57,7 @@ class webapp extends control if($type == 'bysearch') $param = helper::safe64Encode($this->post->key); /* Get results from the api. */ + $recPerPage = $this->cookie->pagerWebappObtain ? $this->cookie->pagerWebappObtain : $recPerPage; $results = $this->webapp->getAppsByAPI($type, $param, $recTotal, $recPerPage, $pageID); if($results) { From 4e97e8e8cb3738d9d4786b61e363d4032be68831 Mon Sep 17 00:00:00 2001 From: azhi Date: Wed, 7 Aug 2013 16:49:10 +0800 Subject: [PATCH 18/32] * add 'system' column. --- db/update4.3.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/update4.3.sql b/db/update4.3.sql index 5c74da0efd..743ee51395 100644 --- a/db/update4.3.sql +++ b/db/update4.3.sql @@ -5,6 +5,8 @@ CREATE TABLE IF NOT EXISTS `zt_custom` ( `section` varchar(30) NOT NULL, `key` varchar(60) NOT NULL, `value` text NOT NULL, + `system` enum('0','1') NOT NULL default '1', PRIMARY KEY (`id`), UNIQUE KEY `lang` (`lang`,`module`,`section`,`key`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + From 8b5d33ef6174669e629b4163335ee6071aaf6362 Mon Sep 17 00:00:00 2001 From: wyd621 Date: Thu, 8 Aug 2013 08:12:25 +0800 Subject: [PATCH 19/32] * fix a bug for get db lang. --- module/custom/control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/custom/control.php b/module/custom/control.php index fbb0ba8355..378c585e1b 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -56,7 +56,7 @@ class custom extends control $this->view->position[] = $this->lang->custom->common; $this->view->position[] = $this->lang->custom->$module; $this->view->fieldList = $fieldList; - $this->view->dbFields = $this->custom->getItems("module=$module§ion=$field"); + $this->view->dbFields = $this->custom->getItems("lang=$currentLang,all&module=$module§ion=$field"); $this->view->field = $field; $this->view->module = $module; $this->view->currentLang = $currentLang; From 2b4218185251a95c9b799e4c8aa9934f637a6fd9 Mon Sep 17 00:00:00 2001 From: wyd621 Date: Thu, 8 Aug 2013 08:51:02 +0800 Subject: [PATCH 20/32] * init object. --- module/common/model.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/common/model.php b/module/common/model.php index a7f63644cc..a9bd1fa173 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -129,6 +129,7 @@ class commonModel extends model if(!$this->config->db->name) return; $records = $this->loadModel('custom')->getAll(); if(!$records) return; + $this->lang->db = new stdclass(); $this->lang->db->custom = $records; } From 7983d567db618190006ee7a205db8c36544e7af1 Mon Sep 17 00:00:00 2001 From: azhi Date: Thu, 8 Aug 2013 09:24:56 +0800 Subject: [PATCH 21/32] * code for task#1678. --- www/js/my.full.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/www/js/my.full.js b/www/js/my.full.js index 19193fc2bb..af06c77518 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -300,12 +300,14 @@ function toggleTreeBox() function() { $('.side').hide() + $('.divider').hide() $('.treeSlider span').css("border-right", "0 none"); $('.treeSlider span').css("border-left", "4px solid #000000"); }, function() { $('.side').show() + $('.divider').show() $('.treeSlider span').css("border-right", "4px solid #000000"); $('.treeSlider span').css("border-left", "0 none"); } From df52457ceff5bedb9a20adb35c3d07c4f5e9697c Mon Sep 17 00:00:00 2001 From: azhi Date: Thu, 8 Aug 2013 09:34:52 +0800 Subject: [PATCH 22/32] * code for task#1678. --- module/common/view/action.html.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/module/common/view/action.html.php b/module/common/view/action.html.php index 36500a98bf..cd2f2c0e57 100755 --- a/module/common/view/action.html.php +++ b/module/common/view/action.html.php @@ -132,14 +132,14 @@ $(function(){ action->printAction($action);?> history)) echo " ";?> - - id)'")?> - comment) or !empty($action->history)):?> comment)) echo "
    ";?> + + id)'")?> + comment) { @@ -148,7 +148,6 @@ $(function(){ echo "
    "; } ?> -