From fa707a14649d5c21fde35fb5eba56992432b328d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 21 Aug 2017 16:00:42 +0800 Subject: [PATCH 01/29] * code for task #3100. --- module/git/config.php | 3 ++- module/git/model.php | 32 ++++++++++++++++++++++++++------ module/svn/config.php | 1 + module/svn/model.php | 14 +++++++------- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/module/git/config.php b/module/git/config.php index c5c8b2e310..8033ef700f 100644 --- a/module/git/config.php +++ b/module/git/config.php @@ -18,7 +18,8 @@ $config->git->encodings = 'utf-8'; $config->git->client = ''; $i = 1; -$config->git->repos[$i]['path'] = ''; +$config->git->repos[$i]['path'] = ''; +$config->git->repos[$i]['encoding'] = 'utf-8'; /* $i ++; diff --git a/module/git/model.php b/module/git/model.php index e377f375c2..ee564f1356 100644 --- a/module/git/model.php +++ b/module/git/model.php @@ -426,13 +426,23 @@ class gitModel extends model exec("{$this->client} config core.quotepath false"); $subPath = substr($path, strlen($repo->path)); if($subPath{0} == '/' or $subPath{0} == '\\') $subPath = substr($subPath, 1); + + $encodings = explode(',', $this->config->git->encodings); + foreach($encodings as $encoding) + { + $encoding = trim($encoding); + if($encoding == 'utf-8') continue; + $subPath = helper::convertEncoding($subPath, 'utf-8', $encoding); + if($subPath) break; + } + exec("$this->client rev-list -n 2 $revision -- $subPath", $lists); if(count($lists) == 2) list($nowRevision, $preRevision) = $lists; - $cmd = "$this->client diff $preRevision $nowRevision -- $subPath"; + $cmd = "$this->client diff $preRevision $nowRevision -- $subPath 2>&1"; $diff = `$cmd`; - $encodings = isset($repo->encodings) ? $repo->encodings : $this->config->svn->encodings; - if($encodings or $encodings != 'utf-8') $diff = helper::convertEncoding($diff, $encodings); + $encoding = isset($repo->encoding) ? $repo->encoding : 'utf-8'; + if($encoding and $encoding != 'utf-8') $diff = helper::convertEncoding($diff, $encoding); return $diff; } @@ -457,13 +467,23 @@ class gitModel extends model $subPath = substr($path, strlen($repo->path)); if($subPath{0} == '/' or $subPath{0} == '\\') $subPath = substr($subPath, 1); + + $encodings = explode(',', $this->config->git->encodings); + foreach($encodings as $encoding) + { + $encoding = trim($encoding); + if($encoding == 'utf-8') continue; + $subPath = helper::convertEncoding($subPath, 'utf-8', $encoding); + if($subPath) break; + } + chdir($repo->path); exec("{$this->client} config core.quotepath false"); - $cmd = "$this->client show $revision:$subPath"; + $cmd = "$this->client show $revision:$subPath 2>&1"; $code = `$cmd`; - $encodings = isset($repo->encodings) ? $repo->encodings : $this->config->git->encodings; - if($encodings or $encodings != 'utf-8') $code = helper::convertEncoding($code, $encodings); + $encoding = isset($repo->encoding) ? $repo->encoding : 'utf-8'; + if($encoding and $encoding != 'utf-8') $code = helper::convertEncoding($code, $encoding); return $code; } diff --git a/module/svn/config.php b/module/svn/config.php index dc4fcd29b9..6f6cded6a5 100644 --- a/module/svn/config.php +++ b/module/svn/config.php @@ -21,6 +21,7 @@ $config->svn->client = ''; $i = 1; $config->svn->repos[$i]['path'] = ''; +$config->svn->repos[$i]['encoding'] = 'utf-8'; $config->svn->repos[$i]['username'] = ''; $config->svn->repos[$i]['password'] = ''; diff --git a/module/svn/model.php b/module/svn/model.php index 9d7d15a3f9..2848f83c30 100644 --- a/module/svn/model.php +++ b/module/svn/model.php @@ -388,7 +388,7 @@ class svnModel extends model foreach($encodings as $encoding) { if($encoding == 'utf-8') continue; - $result = @iconv($encoding, 'utf-8', $comment); + $result = helper::convertEncoding($comment, $encoding) if($result) return $result; } @@ -417,11 +417,11 @@ class svnModel extends model $url = str_replace('%2F', '/', urlencode($url)); $url = str_replace('%3A', ':', $url); - $cmd = $this->client . " diff -r $oldRevision:$revision $url"; + $cmd = $this->client . " diff -r $oldRevision:$revision $url 2>&1"; $diff = `$cmd`; - $encodings = isset($repo->encodings) ? $repo->encodings : $this->config->svn->encodings; - if($encodings or $encodings != 'utf-8') $diff = helper::convertEncoding($diff, $encodings); + $encoding = isset($repo->encoding) ? $repo->encoding : 'utf-8'; + if($encoding and $encoding != 'utf-8') $diff = helper::convertEncoding($diff, $encoding); return $diff; } @@ -447,11 +447,11 @@ class svnModel extends model $url = str_replace('%2F', '/', urlencode($url)); $url = str_replace('%3A', ':', $url); - $cmd = $this->client . " cat $url@$revision"; + $cmd = $this->client . " cat $url@$revision 2>&1"; $code = `$cmd`; - $encodings = isset($repo->encodings) ? $repo->encodings : $this->config->svn->encodings; - if($encodings or $encodings != 'utf-8') $code = helper::convertEncoding($code, $encodings); + $encoding = isset($repo->encoding) ? $repo->encoding : 'utf-8'; + if($encoding and $encoding != 'utf-8') $code = helper::convertEncoding($code, $encoding); return $code; } From 624950cfc9bc094d7038a8f0decd02546f7998ab Mon Sep 17 00:00:00 2001 From: pengjiangxiu Date: Mon, 21 Aug 2017 16:04:00 +0800 Subject: [PATCH 02/29] * Finish task #3187. --- module/group/model.php | 13 +++++++------ module/group/view/privbygroup.html.php | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/module/group/model.php b/module/group/model.php index fb9bea9cc4..6535165593 100644 --- a/module/group/model.php +++ b/module/group/model.php @@ -375,16 +375,17 @@ class groupModel extends model } /** - * Check menu have module - * - * @param string $menu - * @param string $moduleName + * Check menu have module + * + * @param string $menu + * @param string $moduleName * @access public * @return void */ public function checkMenuModule($menu, $moduleName) { if(empty($menu)) return true; + if($menu == 'caselib' and $moduleName == 'testsuite') return true; if($menu == 'other' and (isset($this->lang->menugroup->$moduleName) or isset($this->lang->menu->$moduleName))) return false; if($menu != 'other' and !($moduleName == $menu or (isset($this->lang->menugroup->$moduleName) and $this->lang->menugroup->$moduleName == $menu))) return false; return true; @@ -392,8 +393,8 @@ class groupModel extends model /** * Get modules in menu - * - * @param string $menu + * + * @param string $menu * @access public * @return void */ diff --git a/module/group/view/privbygroup.html.php b/module/group/view/privbygroup.html.php index b70ee3578d..fd1b618c26 100644 --- a/module/group/view/privbygroup.html.php +++ b/module/group/view/privbygroup.html.php @@ -60,7 +60,7 @@ } ?> '> - lang->$moduleName->common;?> + $moduleName->common;?> @@ -77,7 +77,7 @@ selectAll . html::selectAll('', 'checkbox')?> - save, "onclick='setNoChecked()'"); echo html::linkButton($lang->goback, $this->createLink('group', 'browse')); echo html::hidden('foo'); // Just a hidden var, to make sure $_POST is not empty. From 9194c158b8508c892d3ab3fe5c36ee578ad7decb Mon Sep 17 00:00:00 2001 From: Catouse Date: Mon, 21 Aug 2017 18:53:33 +0800 Subject: [PATCH 03/29] * finish task #3194. --- www/js/my.full.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/www/js/my.full.js b/www/js/my.full.js index f7beb4b2da..554411a61b 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -546,27 +546,20 @@ function setFormAction(actionLink, hiddenwin, obj) $form.attr('action', actionLink); - // Check safari is for bug #1000, see http://pms.zentao.net/bug-view-1000.html + // Check safari for bug #1000, see http://pms.zentao.net/bug-view-1000.html var isSafari = navigator.userAgent.indexOf('AppleWebKit') > -1; if(isSafari) { var idPreffix = 'checkbox-fix-' + $.zui.uuid(); - $form.find('input[type="checkbox"]').each(function() + $form.find('[data-fix-checkbox]').remove(); + $form.find('input[type="checkbox"]:not(.rows-selector)').each(function() { var $checkbox = $(this); var checkboxId = idPreffix + $checkbox.val(); - $checkbox.attr('data-fix-checkbox', checkboxId).after('
').appendTo($form); + $checkbox.clone().attr('data-fix-checkbox', checkboxId).css('display', 'none').after('
').appendTo($form); }); } $form.submit(); - if(isSafari) - { - $form.find('[data-fix-checkbox]').each(function() - { - var $checkbox = $(this); - $('#' + $checkbox.data('fixCheckbox')).after($checkbox).remove(); - }); - } } /** From 27c423399d5ade3629385bc9e3ba240b7ab4a73d Mon Sep 17 00:00:00 2001 From: Catouse Date: Mon, 21 Aug 2017 19:15:19 +0800 Subject: [PATCH 04/29] * finish task #3721. --- module/project/css/kanban.css | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/module/project/css/kanban.css b/module/project/css/kanban.css index 5839875868..5a13b4fbe6 100644 --- a/module/project/css/kanban.css +++ b/module/project/css/kanban.css @@ -18,7 +18,7 @@ table th.col-closed {width:15%} #kanbanWrapper tbody tr.dragging td.col-droppable.drop-to .board-task + .board-shadow {margin-top: 6px;} #kanbanWrapper tbody tr.dragging td.col-droppable.drop-to .board-shadow {height: 28px; background: #999; background: rgba(0,0,0,0.35); opacity: 1;} #kanbanWrapper tbody tr.dragging td.col-droppable.drop-to.drag-from .board-shadow {display: none} -#kanbanWrapper .board.drag-from {opacity: 0.8} +#kanbanWrapper .board.drag-from.dragging {opacity: 0.8;} #kanban.dragging, .drag-shadow {cursor: move!important;} @@ -34,10 +34,11 @@ table th.col-closed {width:15%} .board-actions .btn:active, .board-actions .btn:focus, .board-actions .btn:hover {background: #999; color: inherit; background: rgba(255,255,255,.2);} .ie-8 .board-actions .btn {min-width: 10px} .board-actions > .dropdown {display: inline-block; margin-left: -5px;} -.dropdown .caret {border-top-color: #999} -.dropdown-menu > a {display: block; padding: 3px 15px; color: #333; font-size: 12px} -.dropdown-menu > a:hover {background: #f1f1f1; color: #1a53ff; text-decoration: none} -.dropdown-menu > a.disabled, .dropdown-menu > a.disabled:hover, .dropdown-menu > a.active {color: #aaa; background: none} +.board .dropdown-menu {min-width: 60px;} +.board .dropdown .caret {border-top-color: #999} +.board .dropdown-menu > a {display: block; padding: 3px 15px; color: #333; font-size: 12px} +.board .dropdown-menu > a:hover {background: #f1f1f1; color: #1a53ff; text-decoration: none} +.board .dropdown-menu > a.disabled, .board .dropdown-menu > a.disabled:hover, .board .dropdown-menu > a.active {color: #aaa; background: none} .board .board-footer {display: none; opacity: 0.9} .board.show-info .board-footer {display: block; margin: 0 -6px -3px -6px; padding: 5px; background: rgba(0,0,0,0.07);} .board-footer .board-id {display: inline-block; border: 1px solid #aaa; font-weight: normal; padding: 0px 4px; text-align: center; min-width: 20px; line-height: 16px; height: 17px; margin-right: 10px; font-size: 12px;} From 1ee4465a04c60db662fdabe37e2e87c32cac124f Mon Sep 17 00:00:00 2001 From: pengjiangxiu Date: Tue, 22 Aug 2017 09:52:16 +0800 Subject: [PATCH 05/29] * Fix dev bug. --- module/dev/control.php | 12 ++++++------ module/dev/lang/en.php | 1 - module/dev/lang/zh-cn.php | 1 - module/dev/lang/zh-tw.php | 1 - module/project/view/taskdata.html.php | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/module/dev/control.php b/module/dev/control.php index 30753cf929..073a09d75d 100644 --- a/module/dev/control.php +++ b/module/dev/control.php @@ -1,10 +1,10 @@ - * @package + * @package * @uses control * @license LGPL * @version $Id$ @@ -14,7 +14,7 @@ class dev extends control { /** * Get API of system. - * + * * @access public * @return void */ @@ -31,11 +31,11 @@ class dev extends control $this->view->modules = $this->dev->getModules(); $this->display(); } - + /** * Get schema of database. - * - * @param string $table + * + * @param string $table * @access public * @return void */ diff --git a/module/dev/lang/en.php b/module/dev/lang/en.php index 9b8769b823..75511c7722 100644 --- a/module/dev/lang/en.php +++ b/module/dev/lang/en.php @@ -95,7 +95,6 @@ $lang->dev->groupList['product'] = $lang->productCommon; $lang->dev->groupList['project'] = $lang->projectCommon; $lang->dev->groupList['qa'] = 'Testing'; $lang->dev->groupList['doc'] = 'Document'; -$lang->dev->groupList['report'] = 'Report'; $lang->dev->groupList['company'] = 'Company'; $lang->dev->groupList['admin'] = 'Admin'; $lang->dev->groupList['other'] = 'Others'; diff --git a/module/dev/lang/zh-cn.php b/module/dev/lang/zh-cn.php index c208809244..3649d63a02 100644 --- a/module/dev/lang/zh-cn.php +++ b/module/dev/lang/zh-cn.php @@ -95,7 +95,6 @@ $lang->dev->groupList['product'] = $lang->productCommon; $lang->dev->groupList['project'] = $lang->projectCommon; $lang->dev->groupList['qa'] = '测试'; $lang->dev->groupList['doc'] = '文档'; -$lang->dev->groupList['report'] = '统计'; $lang->dev->groupList['company'] = '组织'; $lang->dev->groupList['admin'] = '后台'; $lang->dev->groupList['other'] = '其他模块'; diff --git a/module/dev/lang/zh-tw.php b/module/dev/lang/zh-tw.php index 5fd23d1596..7ba3c4f3a7 100644 --- a/module/dev/lang/zh-tw.php +++ b/module/dev/lang/zh-tw.php @@ -95,7 +95,6 @@ $lang->dev->groupList['product'] = $lang->productCommon; $lang->dev->groupList['project'] = $lang->projectCommon; $lang->dev->groupList['qa'] = '測試'; $lang->dev->groupList['doc'] = '文檔'; -$lang->dev->groupList['report'] = '統計'; $lang->dev->groupList['company'] = '組織'; $lang->dev->groupList['admin'] = '後台'; $lang->dev->groupList['other'] = '其他模組'; diff --git a/module/project/view/taskdata.html.php b/module/project/view/taskdata.html.php index 413850e91c..1ab663d6cb 100644 --- a/module/project/view/taskdata.html.php +++ b/module/project/view/taskdata.html.php @@ -60,7 +60,7 @@ product][$task->branch])) echo "" . $branchGroups[$task->product][$task->branch] . '';?> module) echo "" . $modulePairs[$task->module] . '';?> - id", $task->name, null, "style='color: $task->color'")) echo $task->name; if($task->fromBug) echo html::a($this->createLink('bug', 'view', "id=$task->fromBug"), "[BUG#$task->fromBug]", '_blank', "class='bug'"); ?> From f33cca51e551c4e5a257c8b63eea948db294be1c Mon Sep 17 00:00:00 2001 From: pengjiangxiu Date: Tue, 22 Aug 2017 10:06:25 +0800 Subject: [PATCH 06/29] * Fix bug for dev api. --- module/dev/model.php | 6 +++--- module/dev/view/api.html.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/module/dev/model.php b/module/dev/model.php index 959db50767..3f4cec0c36 100644 --- a/module/dev/model.php +++ b/module/dev/model.php @@ -226,18 +226,18 @@ class devModel extends model /** * Get all modules. - * + * * @access public * @return void */ public function getModules() - { + { $moduleList = glob($this->app->getModuleRoot() . '*'); $modules = array(); foreach($moduleList as $module) { $module = basename($module); - if($module == 'editor' or $module == 'help' or $module == 'setting') continue; + if($module == 'editor' or $module == 'help' or $module == 'setting' or $module == 'common') continue; $group = zget($this->config->dev->group, $module, 'other'); $modules[$group][] = $module; } diff --git a/module/dev/view/api.html.php b/module/dev/view/api.html.php index b01cfe142c..942d1f72b7 100644 --- a/module/dev/view/api.html.php +++ b/module/dev/view/api.html.php @@ -5,7 +5,7 @@ dev->groupList as $group => $groupName):?>
- dev->tableList, $module, $module); ?> @@ -18,7 +18,7 @@ -
- createLink($selectedModule, $api['name'], $params, 'json'); ?> From 8ea15d424fa90aeb128649ecb2ca9e60d5cdf914 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 22 Aug 2017 10:20:24 +0800 Subject: [PATCH 07/29] * finish task #3198. --- module/build/control.php | 3 +++ module/build/js/view.js | 23 +++++++++++++---------- module/build/model.php | 1 + module/build/view/view.html.php | 1 + module/product/view/build.html.php | 2 +- module/testtask/control.php | 1 + module/testtask/js/create.js | 2 +- module/testtask/view/create.html.php | 2 +- 8 files changed, 22 insertions(+), 13 deletions(-) diff --git a/module/build/control.php b/module/build/control.php index f4ec632ba7..cd9828f6b3 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -39,6 +39,7 @@ class build extends control $product = $this->loadModel('product')->getByID($projectID); $products = $this->product->getPairs(); $this->product->setMenu($products, $projectID); + $this->lang->build->menu = $this->lang->product->menu; $productGroups = array(); $product->branch = 0; @@ -112,6 +113,7 @@ class build extends control $product = $this->loadModel('product')->getById($build->product); $products = $this->product->getPairs(); $this->product->setMenu($products, $build->product); + $this->lang->build->menu = $this->lang->product->menu; $productGroups = array(); $product->branch = 0; @@ -193,6 +195,7 @@ class build extends control { $products = $this->loadModel('product')->getPairs(); $this->product->setMenu($products, $build->product); + $this->lang->build->menu = $this->lang->product->menu; $this->view->title = "BUILD #$build->id $build->name - " . $build->productName; $this->view->position[] = html::a($this->createLink('product', 'build', "productID=$build->product"), $build->productName); diff --git a/module/build/js/view.js b/module/build/js/view.js index f587ae6909..bb88ba4864 100644 --- a/module/build/js/view.js +++ b/module/build/js/view.js @@ -14,15 +14,18 @@ function showLink(buildID, type, param) } $(function() { - if(link == 'true') showLink(buildID, type, param); - fixedTfootAction($('#' + type + 'List').closest('form')); - $('.nav.nav-tabs a[data-toggle="tab"]').on('shown.zui.tab', function(e) + if(flow != 'onlyTest') { - var href = $(e.target).attr('href'); - var tabPane = $(href + '.tab-pane'); - if(tabPane.size() == 0) return; - var formID = tabPane.find('.linkBox').find('form:last'); - if(formID.size() == 0) formID = tabPane.find('form:last'); - setTimeout(function(){fixedTfootAction(formID)}, 100); - }); + if(link == 'true') showLink(buildID, type, param); + fixedTfootAction($('#' + type + 'List').closest('form')); + $('.nav.nav-tabs a[data-toggle="tab"]').on('shown.zui.tab', function(e) + { + var href = $(e.target).attr('href'); + var tabPane = $(href + '.tab-pane'); + if(tabPane.size() == 0) return; + var formID = tabPane.find('.linkBox').find('form:last'); + if(formID.size() == 0) formID = tabPane.find('form:last'); + setTimeout(function(){fixedTfootAction(formID)}, 100); + }); + } }) diff --git a/module/build/model.php b/module/build/model.php index 2d0c382285..c61c3cb791 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -200,6 +200,7 @@ class buildModel extends model ->stripTags($this->config->build->editor->create['id'], $this->config->allowedTags) ->remove('resolvedBy,allchecker,files,labels,uid') ->get(); + if($this->config->global->flow == 'onlyTest') $build->project = 0; $build = $this->loadModel('file')->processImgURL($build, $this->config->build->editor->create['id'], $this->post->uid); $this->dao->insert(TABLE_BUILD)->data($build) diff --git a/module/build/view/view.html.php b/module/build/view/view.html.php index e3c18e2d2b..c0a4059f57 100644 --- a/module/build/view/view.html.php +++ b/module/build/view/view.html.php @@ -13,6 +13,7 @@ build->confirmUnlinkStory)?> build->confirmUnlinkBug)?> +config->global->flow)?>