From 37252fbc473cdce9156579cea81e4acc42a05a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Mon, 30 Aug 2021 13:19:56 +0800 Subject: [PATCH] * adjust for tid. --- framework/base/helper.class.php | 1 + lib/base/front/front.class.php | 2 +- module/bug/js/common.js | 4 ++-- module/execution/js/kanban.js | 4 ++-- module/my/js/common.js | 5 +++-- module/task/control.php | 5 +++-- module/task/js/batchcreate.js | 2 +- module/task/js/create.js | 6 +++--- module/testcase/js/create.js | 4 ++-- module/user/control.php | 6 +++--- 10 files changed, 21 insertions(+), 18 deletions(-) diff --git a/framework/base/helper.class.php b/framework/base/helper.class.php index 33141d1ab7..9ef6a04521 100644 --- a/framework/base/helper.class.php +++ b/framework/base/helper.class.php @@ -189,6 +189,7 @@ class baseHelper */ public static function isWithTID() { + global $config; return (!empty($config->tabSession) and isset($_GET['tid'])); } diff --git a/lib/base/front/front.class.php b/lib/base/front/front.class.php index a25afa7015..b0f6f89bc1 100644 --- a/lib/base/front/front.class.php +++ b/lib/base/front/front.class.php @@ -1168,7 +1168,7 @@ EOT; $jsConfig->pingInterval = isset($config->pingInterval) ? $config->pingInterval : ''; $jsConfig->onlybody = zget($_GET, 'onlybody', 'no'); $jsConfig->tabSession = $config->tabSession; - if($config->tabSession and helper::inTabIDMode()) $jsConfig->tid = zget($_GET, 'tid', ''); + if($config->tabSession and helper::isWithTID()) $jsConfig->tid = zget($_GET, 'tid', ''); $jsLang = new stdclass(); $jsLang->submitting = isset($lang->loading) ? $lang->loading : ''; diff --git a/module/bug/js/common.js b/module/bug/js/common.js index 232bdc991e..38c75809ff 100644 --- a/module/bug/js/common.js +++ b/module/bug/js/common.js @@ -577,7 +577,7 @@ function notice() var branch = $('#branch').val(); if(typeof(branch) == 'undefined') branch = 0; var link = createLink('release', 'create', 'productID=' + $('#product').val() + '&branch=' + branch); - if(config.onlybody != 'yes') link += config.requestType == 'GET' ? '&onlybody=yes' : '?onlybody=yes'; + if(config.onlybody != 'yes') link += link.indexOf('?') >= 0 ? '&onlybody=yes' : '?onlybody=yes'; html += '' + createBuild + ' '; html += '' + refresh + ''; } @@ -587,7 +587,7 @@ function notice() productID = $('#product').val(); projectID = $('#project').val(); link = createLink('build', 'create','executionID=' + executionID + '&productID=' + productID + '&projectID=' + projectID); - link += config.requestType == 'GET' ? '&onlybody=yes' : '?onlybody=yes'; + link += link.indexOf('?') >= 0 ? '&onlybody=yes' : '?onlybody=yes'; html += '' + createBuild + ' '; html += '' + refresh + ''; } diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 001ec4c5df..bd143f3280 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -34,7 +34,7 @@ $(function() adjustBoardsHeight(); var boardID = ''; - var onlybody = config.requestType == 'GET' ? "&onlybody=yes" : "?onlybody=yes"; + var onlybody = "onlybody=yes"; $.cookie('selfClose', 0, {expires:config.cookieLife, path:config.webRoot}); var $kanban = $('#kanban'); @@ -124,7 +124,7 @@ $(function() { kanbanModalTrigger.show( { - url: link + onlybody, + url: link + (link.indexOf('?') >= 0 ? '&' : '?') + onlybody, shown: function(){$('.modal-iframe').addClass('with-titlebar').data('cancel-reload', true)}, width: 900, hidden: refresh diff --git a/module/my/js/common.js b/module/my/js/common.js index 60242230cc..4fe6837834 100644 --- a/module/my/js/common.js +++ b/module/my/js/common.js @@ -6,6 +6,7 @@ $(function() if(typeof rawMethod === 'string' && rawMethod == 'work') $('#subNavbar li[data-id=' + mode + '] a').append('' + total + ''); } var scp = $('[data-id="changePassword"] a'); - var sign = config.requestType == 'GET' ? '&' : '?'; - scp.attr('href', scp.attr('href') + sign + 'onlybody=yes').modalTrigger({width:500, type:'iframe'}); + var link = scp.attr('href'); + var sign = link.indexOf('?') >= 0 ? '&' : '?'; + scp.attr('href', link + sign + 'onlybody=yes').modalTrigger({width:500, type:'iframe'}); }); diff --git a/module/task/control.php b/module/task/control.php index 15fc428e99..1f2dcd71b9 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -834,8 +834,9 @@ class task extends control die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } - $this->session->set('estimateList', $this->app->getURI(true), 'execution'); - if(isonlybody() && $this->config->requestType != 'GET') $this->session->set('estimateList', $this->app->getURI(true) . '?onlybody=yes', 'execution'); + $uri = $this->app->getURI(true); + $this->session->set('estimateList', $uri, 'execution'); + if(isonlybody()) $this->session->set('estimateList', $uri . (substr($uri, '?') === false ? '?' : '&') . 'onlybody=yes', 'execution'); $this->view->task = $this->task->getById($taskID); $this->view->estimates = $this->task->getTaskEstimate($taskID); diff --git a/module/task/js/batchcreate.js b/module/task/js/batchcreate.js index e7ee7788cc..3d2ad85b65 100755 --- a/module/task/js/batchcreate.js +++ b/module/task/js/batchcreate.js @@ -101,7 +101,7 @@ function setStoryRelated(num) }); storyLink = createLink('story', 'view', "storyID=" + storyID); - var concat = config.requestType != 'GET' ? '?' : '&'; + var concat = storyLink.indexOf('?') >= 0 ? '&' : '?'; storyLink = storyLink + concat + 'onlybody=yes'; $('#preview' + num).removeAttr('disabled'); $('#preview' + num).attr('href', storyLink); diff --git a/module/task/js/create.js b/module/task/js/create.js index a0e2460ed1..7bf82e1e92 100644 --- a/module/task/js/create.js +++ b/module/task/js/create.js @@ -62,7 +62,7 @@ function loadExecutionStories(executionID) $('#story').next('.picker').remove(); $('#story').replaceWith(data); $('#story').addClass('filled').chosen(); - + /* If there is no story option, select will be hidden and text will be displayed; otherwise, the opposite is true */ if($('#story option').length > 1) { @@ -70,7 +70,7 @@ function loadExecutionStories(executionID) $('#storyBox').addClass('hidden'); } else - { + { $('#storyBox').removeClass('hidden'); $('#story').parent().addClass('hidden'); } @@ -199,7 +199,7 @@ function setPreview() else { storyLink = createLink('story', 'view', "storyID=" + $('#story').val()); - var concat = config.requestType != 'GET' ? '?' : '&'; + var concat = storyLink.indexOf('?') < 0 ? '?' : '&'; if(storyLink.indexOf("onlybody=yes") < 0) storyLink = storyLink + concat + 'onlybody=yes'; diff --git a/module/testcase/js/create.js b/module/testcase/js/create.js index be6f5d6183..38cc157e5c 100644 --- a/module/testcase/js/create.js +++ b/module/testcase/js/create.js @@ -7,8 +7,8 @@ function setPreview() } else { - storyLink = createLink('story', 'view', "storyID=" + $('#story').val()); - var concat = config.requestType != 'GET' ? '?' : '&'; + storyLink = createLink('story', 'view', "storyID=" + $('#story').val()); + var concat = storyLink.indexOf('?') < 0 ? '?' : '&'; storyLink = storyLink + concat + 'onlybody=yes'; $('#preview').removeClass('hidden'); $('#preview').attr('href', storyLink); diff --git a/module/user/control.php b/module/user/control.php index 848d057ac1..0782d019c2 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -827,7 +827,7 @@ class user extends control } else { - $response['locate'] = $this->config->webRoot . (helper::inTabIDMode() ? "?tid={$this->get->tid}" : ''); + $response['locate'] = $this->config->webRoot . (helper::isWithTID() ? "?tid={$this->get->tid}" : ''); return $this->send($response); } } @@ -902,7 +902,7 @@ class user extends control } else { - $response['locate'] = $this->config->webRoot . (helper::inTabIDMode() ? "?tid={$this->get->tid}" : ''); + $response['locate'] = $this->config->webRoot . (helper::isWithTID() ? "?tid={$this->get->tid}" : ''); return $this->send($response); } } @@ -914,7 +914,7 @@ class user extends control die(helper::removeUTF8Bom(json_encode(array('status' => 'success') + $data))); } - $response['locate'] = $this->config->webRoot . (helper::inTabIDMode() ? "?tid={$this->get->tid}" : ''); + $response['locate'] = $this->config->webRoot . (helper::isWithTID() ? "?tid={$this->get->tid}" : ''); $response['result'] = 'success'; return $this->send($response); }