From d73346c395460e2081ccecb580b22f8d72a1f527 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 19 Jul 2022 15:22:38 +0800 Subject: [PATCH 01/23] * Finish task #61171, #61170. --- module/action/model.php | 24 +++++++++++------------- module/block/view/dynamic.html.php | 2 +- module/execution/view/dynamic.html.php | 2 +- module/product/view/dynamic.html.php | 2 +- module/project/view/dynamic.html.php | 2 +- module/user/view/dynamic.html.php | 2 +- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/module/action/model.php b/module/action/model.php index 56cbf24af1..09b25109c0 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -984,9 +984,10 @@ class actionModel extends model $executions = array(); if(!$this->app->user->admin) { - if($productID == 'all') $authedProducts = $this->app->user->view->products; - if($projectID == 'all') $authedProjects = $this->app->user->view->projects; - if($executionID == 'all') $authedExecutions = $this->app->user->view->sprints; + $aclViews = isset($this->app->user->rights['acls']['views']) ? $this->app->user->rights['acls']['views'] : array(); + if($productID == 'all') $authedProducts = (!empty($aclViews) and isset($aclViews['product'])) ? $this->app->user->view->products : '0'; + if($projectID == 'all') $authedProjects = (!empty($aclViews) and isset($aclViews['project'])) ? $this->app->user->view->projects : '0'; + if($executionID == 'all') $authedExecutions = (!empty($aclViews) and isset($aclViews['execution'])) ? $this->app->user->view->sprints : '0'; if($productID == 'all' and $projectID == 'all') { @@ -1014,10 +1015,10 @@ class actionModel extends model $executionCondition = "execution " . helper::dbIN(array_keys($executions)); } - $condition = "((product =',0,' or product=0) AND project = '0' AND execution = 0)"; - if(!empty($productCondition)) $condition .= ' OR ' . $productCondition; - if(!empty($projectCondition)) $condition .= ' OR ' . $projectCondition; - if(!empty($executionCondition)) $condition .= ' OR ' . $executionCondition; + $condition = "((product =',0,' or product = '0') AND project = '0' AND execution = '0')"; + if(!empty($productCondition) and isset($aclViews['product'])) $condition .= ' OR ' . $productCondition; + if(!empty($projectCondition) and isset($aclViews['project'])) $condition .= ' OR ' . $projectCondition; + if(!empty($executionCondition) and isset($aclViews['execution'])) $condition .= ' OR ' . $executionCondition; } $actionCondition = $this->getActionCondition(); @@ -1086,6 +1087,7 @@ class actionModel extends model foreach($this->app->user->rights['acls']['actions'] as $moduleName => $actions) { + if(isset($this->lang->mainNav->$moduleName) and !isset($this->app->user->rights['acls']['views'][$moduleName])) continue; $actionCondition .= "(`objectType` = '$moduleName' and `action` " . helper::dbIN($actions) . ") or "; } $actionCondition = trim($actionCondition, 'or '); @@ -1258,11 +1260,7 @@ class actionModel extends model if(empty($action->objectName) and substr($objectType, 0, 6) == 'gitlab') $action->objectName = $action->extra; /* Other actions, create a link. */ - if(!$this->setObjectLink($action, $deptUsers)) - { - unset($actions[$i]); - continue; - } + $this->setObjectLink($action, $deptUsers); /* Set merge request link. */ if(empty($action->objectName) and $action->objectType == 'mr') $action->objectLink = ''; @@ -1437,7 +1435,6 @@ class actionModel extends model /* Fix bug #2961. */ $isLoginOrLogout = $action->objectType == 'user' and ($action->action == 'login' or $action->action == 'logout'); - if(!common::hasPriv($moduleName, $methodName) and !$isLoginOrLogout) return false; $action->objectLabel = $objectLabel; $action->product = trim($action->product, ','); @@ -1536,6 +1533,7 @@ class actionModel extends model $action->objectLink = !isset($deptUsers[$action->objectID]) ? 'javascript:void(0)' : helper::createLink($moduleName, $methodName, sprintf($vars, $action->objectID)); } } + if(!common::hasPriv($moduleName, $methodName) and !$isLoginOrLogout) $action->objectLink = ''; } elseif($action->objectType == 'team') { diff --git a/module/block/view/dynamic.html.php b/module/block/view/dynamic.html.php index e2e44aac2d..6e0102b36c 100644 --- a/module/block/view/dynamic.html.php +++ b/module/block/view/dynamic.html.php @@ -25,7 +25,7 @@ $class = $action->major ? "class='active'" : ''; echo "
  • "; if($action->objectLink) printf($lang->block->dynamicInfo, $action->date, $user, $action->actionLabel, $action->objectLabel, $action->objectLink, $action->objectName, $action->objectName); - if(!$action->objectLink) printf($lang->block->noLinkDynamic, $action->date, $action->objectName, $user, $action->actionLabel, $action->objectLabel, $action->objectName); + if(!$action->objectLink) printf($lang->block->noLinkDynamic, $action->date, $action->objectName, $user, $action->actionLabel, $action->objectLabel, ' ' . $action->objectName); echo "
  • "; $i++; } diff --git a/module/execution/view/dynamic.html.php b/module/execution/view/dynamic.html.php index bb597e2819..ed80260a74 100755 --- a/module/execution/view/dynamic.html.php +++ b/module/execution/view/dynamic.html.php @@ -88,7 +88,7 @@ actionLabel;?> objectLabel;?> objectID;?> - objectName) echo html::a($action->objectLink, $action->objectName);?> + objectName) echo !empty($action->objectLink) ? html::a($action->objectLink, $action->objectName) : $action->objectName;?> diff --git a/module/product/view/dynamic.html.php b/module/product/view/dynamic.html.php index c1737d9ea1..0e1c9f3341 100755 --- a/module/product/view/dynamic.html.php +++ b/module/product/view/dynamic.html.php @@ -86,7 +86,7 @@ actionLabel;?> objectLabel;?> objectType == 'module' and strpos(',created,edited,moved,', "$action->action") !== false) ? trim($action->extra, ',') : $action->objectID;?> - objectName) echo html::a($action->objectLink, $action->objectName);?> + objectName) echo !empty($action->objectLink) ? html::a($action->objectLink, $action->objectName) : $action->objectName;?> diff --git a/module/project/view/dynamic.html.php b/module/project/view/dynamic.html.php index 69531bc782..c93898fb56 100755 --- a/module/project/view/dynamic.html.php +++ b/module/project/view/dynamic.html.php @@ -87,7 +87,7 @@ actionLabel;?> objectLabel;?> objectID;?> - objectName) echo html::a($action->objectLink, $action->objectName);?> + objectName) echo !empty($action->objectLink) ? html::a($action->objectLink, $action->objectName) : $action->objectName;?> diff --git a/module/user/view/dynamic.html.php b/module/user/view/dynamic.html.php index e01b4e7e55..e7ba8a6975 100644 --- a/module/user/view/dynamic.html.php +++ b/module/user/view/dynamic.html.php @@ -55,7 +55,7 @@ actionLabel;?> objectLabel;?> objectID;?> - objectName) echo "" . html::a($action->objectLink, $action->objectName) . '';?> + objectName) echo "" . (!empty($action->objectLink) ? html::a($action->objectLink, $action->objectName) : $action->objectName) . '';?> From 809f321445cb5d0d47a554e5546f7b96d9abc967 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 20 Jul 2022 09:59:14 +0800 Subject: [PATCH 02/23] * Modify delete branch after merge. --- module/mr/model.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/module/mr/model.php b/module/mr/model.php index e468a31015..fc75d69952 100644 --- a/module/mr/model.php +++ b/module/mr/model.php @@ -976,8 +976,12 @@ class mrModel extends model { $apiRoot = $this->loadModel('gitea')->getApiRoot($hostID); $url = sprintf($apiRoot, "/repos/$projectID/pulls/$MRID/merge"); - $merege = ($MR and $MR->squash == '1') ? 'squash' : 'merge'; - $rowMR = json_decode(commonModel::http($url, array('Do' => $merge), array(), array(), 'json', 'POST')); + + $merege = ($MR and $MR->squash == '1') ? 'squash' : 'merge'; + $data = array('Do' => $merge); + if($MR and $MR->removeSourceBranch == '1') $data['delete_branch_after_merge'] = true; + + $rowMR = json_decode(commonModel::http($url, $data, array(), array(), 'json', 'POST')); if(!isset($rowMR->massage)) { $rowMR = $this->apiGetSingleMR($hostID, $projectID, $MRID); @@ -986,12 +990,6 @@ class mrModel extends model ->where('id')->eq($MRID) ->autoCheck() ->exec(); - - if($MR and $MR->removeSourceBranch == '1') - { - $url = sprintf($apiRoot, "/repos/$projectID/branches/{$MR->sourceBranch}"); - json_decode(commonModel::http($url, null, array(CURLOPT_CUSTOMREQUEST => 'DELETE'))); - } } return $rowMR; } From 1dcf2dcb2ca08a244b93f09d35951521620dc353 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Wed, 20 Jul 2022 10:13:21 +0800 Subject: [PATCH 03/23] * Code for task #59750. --- module/common/view/header.html.php | 9 ++ module/common/view/kindeditor.html.php | 11 +- module/doc/config.php | 4 +- module/doc/control.php | 30 ++++- module/doc/js/create.js | 4 +- module/doc/js/selectlibtype.js | 33 ++++- module/doc/lang/zh-cn.php | 33 ++--- module/doc/view/create.html.php | 133 +------------------ module/doc/view/createothertype.html.php | 137 +++++++++++++++++++ module/doc/view/createtexttype.html.php | 161 +++++++++++++++++++++++ module/doc/view/edit.html.php | 111 +--------------- module/doc/view/editothertype.html.php | 118 +++++++++++++++++ module/doc/view/edittexttype.html.php | 158 ++++++++++++++++++++++ module/doc/view/selectlibtype.html.php | 19 ++- module/upgrade/model.php | 2 +- 15 files changed, 695 insertions(+), 268 deletions(-) create mode 100644 module/doc/view/createothertype.html.php create mode 100644 module/doc/view/createtexttype.html.php create mode 100644 module/doc/view/editothertype.html.php create mode 100644 module/doc/view/edittexttype.html.php diff --git a/module/common/view/header.html.php b/module/common/view/header.html.php index 5e3a344972..cb9e3eb983 100755 --- a/module/common/view/header.html.php +++ b/module/common/view/header.html.php @@ -7,6 +7,10 @@ include 'chosen.html.php'; app->loadConfig('sso');?> sso->redirect)) js::set('ssoRedirect', $config->sso->redirect);?> +getModuleName() == 'doc';?> +getMethodName()},") !== false;?> + + + + + - - + + - - - -doc->placeholder);?> - -
    -
    -
    -

    doc->create;?>

    -
    - - ' . $lang->doc->createLib, '', 'class="iframe hidden createCustomLib"');?> - -
    - - - - - - - - - - - - - - - - - - - - - doc->types as $typeKey => $typeName) $typeKeyList[$typeKey] = $typeKey; - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    doc->lib;?>
    doc->module;?> - -
    doc->title;?>
    doc->keywords;?>doc->keywordsTips}'");?>
    doc->type;?>doc->types, zget($typeKeyList, $docType, 'text'));?>
    doc->content;?> -
    - - -
    doc->files;?>fetch('file', 'buildform');?>
    doc->mailto;?> -
    - fetch('my', 'buildContactLists'); - ?> -
    -
    doclib->control;?> - acl == 'default' ? 'open' : $lib->acl;?> - type == 'project' and $acl == 'private') ? 'open' : $acl;?> - doc->aclList, $acl, "onchange='toggleAcl(this.value, \"doc\")'");?> - doc->noticeAcl['doc'][$acl];?> -
    - - goback, "data-app='{$app->tab}'");?> - goback, '', "class='btn btn-back btn-wide'");?> -
    -
    -
    -
    - -doc->noticeAcl['doc']);?> - + diff --git a/module/doc/view/createothertype.html.php b/module/doc/view/createothertype.html.php new file mode 100644 index 0000000000..06cb9cc168 --- /dev/null +++ b/module/doc/view/createothertype.html.php @@ -0,0 +1,137 @@ + + * @package doc + * @version $Id: create.html.php 975 2010-07-29 03:30:25Z jajacn@126.com $ + * @link http://www.zentao.net + */ +?> +doc->officeTypes, $docType) !== false):?> + +
    +
    +
    +

    doc->create;?>

    +
    + config->edition != 'open'):?> +
    + doc->notSetOffice, zget($lang->doc->typeList, $docType), common::hasPriv('custom', 'libreoffice') ? $this->createLink('custom', 'libreoffice', '', '', true) : '###');?> +
    + +
    doc->cannotCreateOffice, zget($lang->doc->typeList, $docType));?>
    + +
    +
    + + + + + + + +doc->placeholder);?> + +
    +
    +
    +

    doc->create;?>

    +
    + + ' . $lang->doc->createLib, '', 'class="iframe hidden createCustomLib"');?> + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    doc->lib;?>
    doc->module;?> + +
    doc->title;?>
    doc->keywords;?>doc->keywordsTips}'");?>
    doc->content;?> +
    + + + +
    doc->files;?>fetch('file', 'buildform');?>
    doc->mailto;?> +
    + fetch('my', 'buildContactLists'); + ?> +
    +
    doclib->control;?> + acl == 'default' ? 'open' : $lib->acl;?> + type == 'project' and $acl == 'private') ? 'open' : $acl;?> + doc->aclList, $acl, "onchange='toggleAcl(this.value, \"doc\")'");?> + doc->noticeAcl['doc'][$acl];?> +
    + + goback, "data-app='{$app->tab}'");?> + goback, '', "class='btn btn-back btn-wide'");?> +
    +
    +
    +
    + +doc->noticeAcl['doc']);?> + + diff --git a/module/doc/view/createtexttype.html.php b/module/doc/view/createtexttype.html.php new file mode 100644 index 0000000000..b143d76f8d --- /dev/null +++ b/module/doc/view/createtexttype.html.php @@ -0,0 +1,161 @@ + + * @package doc + * @version $Id: createtext.html.php 975 2022-07-14 13:49:25Z $ + * @link http://www.zentao.net + */ +?> + + + +doc->placeholder);?> + + + + ' . $lang->doc->createLib, '', 'class="iframe hidden createCustomLib"');?> + +
    +
    + + + + + + + + + + +
    doc->titlePlaceholder}' class='form-control' required");?>
    +
    +
    +
    + + + +
    + +
    +
    +
    +
    + + +doc->noticeAcl['doc']);?> + diff --git a/module/doc/view/edit.html.php b/module/doc/view/edit.html.php index 3569041e5c..1f6d3b8382 100644 --- a/module/doc/view/edit.html.php +++ b/module/doc/view/edit.html.php @@ -10,109 +10,8 @@ * @link http://www.zentao.net */ ?> - -contentType == 'html') include '../../common/view/kindeditor.html.php';?> -contentType == 'markdown') include '../../common/view/markdown.html.php';?> -content != $doc->draft);?> -doc->confirmUpdateContent);?> -id);?> -draft);?> -
    -
    -
    -

    - id;?> - createLink('doc', 'view', "docID=$doc->id"), $doc->title, '', "title='$doc->title'");?> - arrow . ' ' . $lang->doc->edit;?> -

    -
    save, '', 'id="top-submit" class="btn btn-primary"');?>
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - type == 'url') echo "class='hidden'"?>> - - - - type != 'url') echo "class='hidden'"?>> - - - - - - - - - - - - - - - - - - - - - - -
    doc->lib;?> lib, "class='form-control chosen' onchange=loadDocModule(this.value)");?>
    doc->module;?> - module, "class='form-control chosen'");?> -
    doc->title;?>title, "class='form-control' required");?>
    doc->keywords;?>keywords, "class='form-control' placeholder='{$lang->doc->keywordsTips}'");?>
    doc->type;?> - doc->types; - if(!isset($lang->doc->types[$doc->type])) $typeList = $lang->doc->typeList; - echo html::radio('type', array($doc->type => zget($typeList, $doc->type)), $doc->type); - ?> -
    doc->content;?>type == 'url' ? '' : htmlSpecialString($doc->content), "style='width:100%; height:200px'") . html::hidden('contentType', $doc->contentType);?>
    doc->url;?>type == 'url' ? $doc->content : '', "class='form-control'");?>
    doc->files;?>fetch('file', 'buildform');?>
    doc->mailto;?> -
    - mailto, "multiple class='form-control picker-select' data-drop-direction='top'"); - echo $this->fetch('my', 'buildContactLists'); - ?> -
    -
    doclib->control;?> - acl == 'private' ? 'private' : $doc->acl;?> - doc->aclList, $acl, "onchange='toggleAcl(this.value, \"doc\")'")?> - doc->noticeAcl['doc'][$acl];?> -
    - editedDate); - echo html::submitButton(); - echo html::backButton($lang->goback, "data-app='{$app->tab}'"); - ?> -
    -
    -
    -
    -doc->noticeAcl['doc']);?> - +type == 'text'):?> + + + + diff --git a/module/doc/view/editothertype.html.php b/module/doc/view/editothertype.html.php new file mode 100644 index 0000000000..3569041e5c --- /dev/null +++ b/module/doc/view/editothertype.html.php @@ -0,0 +1,118 @@ + + * @package doc + * @version $Id: edit.html.php 975 2010-07-29 03:30:25Z jajacn@126.com $ + * @link http://www.zentao.net + */ +?> + +contentType == 'html') include '../../common/view/kindeditor.html.php';?> +contentType == 'markdown') include '../../common/view/markdown.html.php';?> +content != $doc->draft);?> +doc->confirmUpdateContent);?> +id);?> +draft);?> +
    +
    +
    +

    + id;?> + createLink('doc', 'view', "docID=$doc->id"), $doc->title, '', "title='$doc->title'");?> + arrow . ' ' . $lang->doc->edit;?> +

    +
    save, '', 'id="top-submit" class="btn btn-primary"');?>
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + type == 'url') echo "class='hidden'"?>> + + + + type != 'url') echo "class='hidden'"?>> + + + + + + + + + + + + + + + + + + + + + + +
    doc->lib;?> lib, "class='form-control chosen' onchange=loadDocModule(this.value)");?>
    doc->module;?> + module, "class='form-control chosen'");?> +
    doc->title;?>title, "class='form-control' required");?>
    doc->keywords;?>keywords, "class='form-control' placeholder='{$lang->doc->keywordsTips}'");?>
    doc->type;?> + doc->types; + if(!isset($lang->doc->types[$doc->type])) $typeList = $lang->doc->typeList; + echo html::radio('type', array($doc->type => zget($typeList, $doc->type)), $doc->type); + ?> +
    doc->content;?>type == 'url' ? '' : htmlSpecialString($doc->content), "style='width:100%; height:200px'") . html::hidden('contentType', $doc->contentType);?>
    doc->url;?>type == 'url' ? $doc->content : '', "class='form-control'");?>
    doc->files;?>fetch('file', 'buildform');?>
    doc->mailto;?> +
    + mailto, "multiple class='form-control picker-select' data-drop-direction='top'"); + echo $this->fetch('my', 'buildContactLists'); + ?> +
    +
    doclib->control;?> + acl == 'private' ? 'private' : $doc->acl;?> + doc->aclList, $acl, "onchange='toggleAcl(this.value, \"doc\")'")?> + doc->noticeAcl['doc'][$acl];?> +
    + editedDate); + echo html::submitButton(); + echo html::backButton($lang->goback, "data-app='{$app->tab}'"); + ?> +
    +
    +
    +
    +doc->noticeAcl['doc']);?> + diff --git a/module/doc/view/edittexttype.html.php b/module/doc/view/edittexttype.html.php new file mode 100644 index 0000000000..8cc0af0a7c --- /dev/null +++ b/module/doc/view/edittexttype.html.php @@ -0,0 +1,158 @@ + + * @package doc + * @version $Id: create.html.php 975 2010-07-29 03:30:25Z jajacn@126.com $ + * @link http://www.zentao.net + */ +?> + +contentType == 'html') include '../../common/view/kindeditor.html.php';?> +contentType == 'markdown') include '../../common/view/markdown.html.php';?> +content != $doc->draft);?> +doc->confirmUpdateContent);?> +id);?> +draft);?> +doc->placeholder);?> + + +
    +
    + + + + + + + + + + +
    title, "placeholder='{$lang->doc->titlePlaceholder}' class='form-control' required");?>
    +
    +
    +
    content), "style='width:100%;'");?>
    + contentType);?> + + editedDate);?> +
    + +
    +
    +
    +
    + +doc->noticeAcl['doc']);?> + diff --git a/module/doc/view/selectlibtype.html.php b/module/doc/view/selectlibtype.html.php index 8c92315749..aa1057648c 100644 --- a/module/doc/view/selectlibtype.html.php +++ b/module/doc/view/selectlibtype.html.php @@ -21,12 +21,19 @@ - vision == 'lite'):?> - doc->libTypeList;?> - - doc->libTypeList + $lang->doc->libGlobalList;?> - - + + + + + + + + + doc->types as $typeKey => $typeName) $typeKeyList[$typeKey] = $typeKey; + ?> + diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 450dd6afd5..40c2d6b7cc 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -6267,7 +6267,7 @@ class upgradeModel extends model foreach($stories as $storyID => $story) { - if(!empty($story->assingnedTo)) + if(!empty($story->assignedTo)) { $story->reviewer = $story->assingnedTo; } From d7c33d2859505cc4c4a9a71ade78b01ea3e8e64b Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Wed, 20 Jul 2022 10:27:37 +0800 Subject: [PATCH 04/23] * Adjust the height of basic info box. --- module/doc/view/createtexttype.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/doc/view/createtexttype.html.php b/module/doc/view/createtexttype.html.php index b143d76f8d..cd2d354f0b 100644 --- a/module/doc/view/createtexttype.html.php +++ b/module/doc/view/createtexttype.html.php @@ -149,7 +149,7 @@ $(function() { $('.doc-title input').focus(); - $('#sidebar').height($(document).height() - $('#headerBox').height() - $('.ke-toolbar').height()); + $('#sidebar').height($(document).height() - 120); setTimeout(function(){$('.ke-edit-iframe, .ke-edit').height($(document).height() - 120);}, 100); setTimeout(function(){$('.CodeMirror').height($(document).height() - 120);}, 100); From 13eda1d63152b86ee57ac7b3c63ccad799191348 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 20 Jul 2022 10:28:01 +0800 Subject: [PATCH 05/23] * Finish task #61173. --- module/bug/model.php | 5 +++++ module/upgrade/model.php | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/module/bug/model.php b/module/bug/model.php index 0835194d51..525e430141 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -740,6 +740,11 @@ class bugModel extends model $this->linkBugToBuild($bugID, $bug->resolvedBuild); } + $linkBugs = explode(',', $bug->linkBug); + $oldLinkBugs = explode(',', $oldBug->linkBug); + foreach(array_diff($linkBugs, $oldLinkBugs) as $addBug) $this->dao->update(TABLE_BUG)->set("linkBug = CONCAT(linkbug, ',$bugID')")->where('id')->eq((int)$addBug)->exec(); + foreach(array_diff($oldLinkBugs, $linkBugs) as $removeBug) $this->dao->update(TABLE_BUG)->set("linkBug = TRIM(BOTH ',' from REPLACE(CONCAT(',', linkbug, ','), ',$bugID,', ''))")->where('id')->eq((int)$removeBug)->exec(); + if(!empty($bug->resolvedBy)) $this->loadModel('score')->create('bug', 'resolve', $bugID); $this->file->updateObjectID($this->post->uid, $bugID, 'bug'); diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 450dd6afd5..346a2e43a7 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -974,6 +974,8 @@ class upgradeModel extends model $confirmContent .= file_get_contents($xuanxuanSql); case '17_2': $confirmContent .= file_get_contents($this->getUpgradeFile('17.2')); + case '17_3': + $this->processBugLinkBug(); } return $confirmContent; @@ -6709,4 +6711,22 @@ class upgradeModel extends model return !dao::isError(); } + + /** + * Process bug link bug. + * + * @access public + * @return void + */ + public function processBugLinkBug() + { + $bugs = $this->dao->select('id,linkBug')->from(TABLE_BUG)->where('linkBug')->ne('')->fetchPairs(); + foreach($bugs as $bugID => $linkBugs) + { + $linkBugs = explode(',', $linkBugs); + $this->dao->update(TABLE_BUG)->set("linkBug = TRIM(BOTH ',' from CONCAT(linkbug, ',$bugID'))")->where('id')->in($linkBugs)->andWhere('id')->ne($bugID)->andWhere("CONCAT(',', linkBug, ',')")->notlike("%,$bugID,%")->exec(); + } + + return !dao::isError(); + } } From b59b8b1c394c90d1d4ea8e4dc181ceee3c3fe4e8 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 20 Jul 2022 11:25:11 +0800 Subject: [PATCH 06/23] * Fix bug #25478. --- module/company/control.php | 1 - 1 file changed, 1 deletion(-) diff --git a/module/company/control.php b/module/company/control.php index e47f29c356..641876ccf0 100644 --- a/module/company/control.php +++ b/module/company/control.php @@ -191,7 +191,6 @@ class company extends control $this->session->set('riskList', $uri, 'project'); $this->session->set('opportunityList', $uri, 'project'); $this->session->set('trainplanList', $uri, 'project'); - $this->session->set('executionList', $uri, 'execution'); $this->session->set('taskList', $uri, 'execution'); $this->session->set('buildList', $uri, 'execution'); $this->session->set('bugList', $uri, 'qa'); From f8a54287090f68f339baced8fd36196ede4784e3 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 20 Jul 2022 12:07:32 +0800 Subject: [PATCH 07/23] * Modify protect branch tips. --- module/gitea/model.php | 27 +++++++++++++++++++++++++++ module/mr/control.php | 28 ++++++++++++++++++++++++++++ module/mr/js/create.js | 33 +++++++++++++++++++++++++++++---- module/mr/lang/de.php | 1 + module/mr/lang/en.php | 1 + module/mr/lang/fr.php | 1 + module/mr/lang/vi.php | 1 + module/mr/lang/zh-cn.php | 1 + module/mr/view/create.html.php | 3 ++- module/mr/view/edit.html.php | 6 +++--- 10 files changed, 94 insertions(+), 8 deletions(-) diff --git a/module/gitea/model.php b/module/gitea/model.php index 7a8f6ff69b..0930573c47 100644 --- a/module/gitea/model.php +++ b/module/gitea/model.php @@ -566,4 +566,31 @@ class giteaModel extends model $url = sprintf($this->getApiRoot($giteaID), "/repos/$projectID/branches/$branch"); return json_decode(commonModel::http($url)); } + + /** + * Get protect branches of one project. + * + * @param int $giteaID + * @param string $project + * @param string $keyword + * @access public + * @return array + */ + public function apiGetBranchPrivs($giteaID, $project, $keyword = '') + { + $keyword = urlencode($keyword); + $url = sprintf($this->getApiRoot($giteaID), "/repos/$project/branch_protections"); + $branches = json_decode(commonModel::http($url)); + + if(!is_array($branches)) return $branches; + + $newBranches = array(); + foreach($branches as $branch) + { + $branch->name = $branch->branch_name; + if(empty($keyword) || stristr($branch->name, $keyword)) $newBranches[] = $branch; + } + + return $newBranches; + } } diff --git a/module/mr/control.php b/module/mr/control.php index 8245ac4031..e830ab1a08 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -156,6 +156,14 @@ class mr extends control $scm = $host->type; $branchList = $this->loadModel($scm)->getBranches($MR->hostID, $MR->targetProject); + $MR->canDeleteBranch = true; + $branchPrivs = $this->loadModel($scm)->apiGetBranchPrivs($MR->hostID, $MR->sourceProject); + foreach($branchPrivs as $priv) + { + if($MR->canDeleteBranch and $priv->name == $MR->sourceBranch) $MR->canDeleteBranch = false; + } + + $targetBranchList = array(); foreach($branchList as $branch) $targetBranchList[$branch] = $branch; @@ -1017,4 +1025,24 @@ class mr extends control $result = $this->mr->checkSameOpened($hostID, $sourceProject, $sourceBranch, $targetProject, $targetBranch); echo json_encode($result); } + + /** + * Ajax get branch pivs. + * + * @param int $hostID + * @param int|string $project + * @access public + * @return array + */ + public function ajaxGetBranchPivs($hostID, $project) + { + $host = $this->loadModel('pipeline')->getByID($hostID); + $scm = $host->type; + if($scm == 'gitea') $project = urldecode(base64_decode($project)); + + $branches = $this->loadModel($scm)->apiGetBranchPrivs($hostID, $project); + $branchPrivs = array(); + foreach($branches as $branch) $branchPrivs[$branch->name] = $branch->name; + echo json_encode($branchPrivs); + } } diff --git a/module/mr/js/create.js b/module/mr/js/create.js index f4c4f75262..1b4e30197e 100644 --- a/module/mr/js/create.js +++ b/module/mr/js/create.js @@ -13,6 +13,24 @@ function urlencode(param) return param; } +/** + * Get branch priv. + * + * @param int|string $project + * @access public + * @return void + */ +function getBranchPriv(project) +{ + var hostID = $('#hostID').val(); + var branchUrl = createLink('mr', 'ajaxGetBranchPivs', "hostID=" + hostID + "&project=" + project); + $.get(branchUrl, function(response) + { + branchPrivs = eval('(' + response + ')'); + }); + +} + $(function() { $('#hostID').change(function() @@ -66,14 +84,19 @@ $(function() $('#repoID').html('').append(response); $('#repoID').chosen().trigger("chosen:updated");; }); + + if(sourceProject) getBranchPriv(sourceProject); }); $('#sourceBranch,#targetBranch').change(function() { - var sourceProject = urlencode($('#sourceProject').val()); - var sourceBranch = urlencode($('#sourceBranch').val()); - var targetProject = urlencode($('#targetProject').val()); - var targetBranch = urlencode($('#targetBranch').val()); + $('#removeSourceBranch').removeAttr('disabled'); + + var sourceProject = $('#sourceProject').val(); + var sourceBranch = $('#sourceBranch').val(); + var targetProject = $('#targetProject').val(); + var targetBranch = $('#targetBranch').val(); + if(branchPrivs[sourceBranch]) $('#removeSourceBranch').attr('disabled', 'true'); if(!sourceProject || !sourceBranch || !targetProject || !targetBranch) return false; var $this = $(this); @@ -86,9 +109,11 @@ $(function() { alert(response.message); $this.val('').trigger('chosen:updated'); + if($this.attr('id') == 'sourceBranch') $('#removeSourceBranch').removeAttr('disabled'); return false; } }); + }); $('#repoID').change(function() diff --git a/module/mr/lang/de.php b/module/mr/lang/de.php index 166c55c36d..f0046ebdd7 100644 --- a/module/mr/lang/de.php +++ b/module/mr/lang/de.php @@ -196,3 +196,4 @@ $lang->mr->linkedTasks = 'Task'; $lang->mr->unlinkedTasks = 'Task not linked'; $lang->mr->confirmUnlinkTask = "Are you sure to remove this task?"; $lang->mr->taskSummary = "There are %s tasks on this page"; +$lang->mr->notDelbranch = "The source branch cannot be deleted when it is a protected branch"; diff --git a/module/mr/lang/en.php b/module/mr/lang/en.php index 166c55c36d..f0046ebdd7 100644 --- a/module/mr/lang/en.php +++ b/module/mr/lang/en.php @@ -196,3 +196,4 @@ $lang->mr->linkedTasks = 'Task'; $lang->mr->unlinkedTasks = 'Task not linked'; $lang->mr->confirmUnlinkTask = "Are you sure to remove this task?"; $lang->mr->taskSummary = "There are %s tasks on this page"; +$lang->mr->notDelbranch = "The source branch cannot be deleted when it is a protected branch"; diff --git a/module/mr/lang/fr.php b/module/mr/lang/fr.php index 166c55c36d..f0046ebdd7 100644 --- a/module/mr/lang/fr.php +++ b/module/mr/lang/fr.php @@ -196,3 +196,4 @@ $lang->mr->linkedTasks = 'Task'; $lang->mr->unlinkedTasks = 'Task not linked'; $lang->mr->confirmUnlinkTask = "Are you sure to remove this task?"; $lang->mr->taskSummary = "There are %s tasks on this page"; +$lang->mr->notDelbranch = "The source branch cannot be deleted when it is a protected branch"; diff --git a/module/mr/lang/vi.php b/module/mr/lang/vi.php index 166c55c36d..f0046ebdd7 100644 --- a/module/mr/lang/vi.php +++ b/module/mr/lang/vi.php @@ -196,3 +196,4 @@ $lang->mr->linkedTasks = 'Task'; $lang->mr->unlinkedTasks = 'Task not linked'; $lang->mr->confirmUnlinkTask = "Are you sure to remove this task?"; $lang->mr->taskSummary = "There are %s tasks on this page"; +$lang->mr->notDelbranch = "The source branch cannot be deleted when it is a protected branch"; diff --git a/module/mr/lang/zh-cn.php b/module/mr/lang/zh-cn.php index d9fc6b5770..cb129a2da4 100644 --- a/module/mr/lang/zh-cn.php +++ b/module/mr/lang/zh-cn.php @@ -196,3 +196,4 @@ $lang->mr->linkedTasks = '任务'; $lang->mr->unlinkedTasks = '未关联任务'; $lang->mr->confirmUnlinkTask = "您确认移除该任务吗?"; $lang->mr->taskSummary = "本页共 %s 个任务"; +$lang->mr->notDelbranch = "源分支为受保护分支时不可删除"; diff --git a/module/mr/view/create.html.php b/module/mr/view/create.html.php index 9175d19c17..7e7aca7bf9 100644 --- a/module/mr/view/create.html.php +++ b/module/mr/view/create.html.php @@ -12,6 +12,7 @@ +
    @@ -59,7 +60,7 @@
    From ecada98f89454065f3149da7dc231f76f2c96a4f Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 20 Jul 2022 13:15:34 +0800 Subject: [PATCH 08/23] * Fix bug for task #61171. --- module/action/model.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/module/action/model.php b/module/action/model.php index 09b25109c0..bd242aad0b 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -985,9 +985,9 @@ class actionModel extends model if(!$this->app->user->admin) { $aclViews = isset($this->app->user->rights['acls']['views']) ? $this->app->user->rights['acls']['views'] : array(); - if($productID == 'all') $authedProducts = (!empty($aclViews) and isset($aclViews['product'])) ? $this->app->user->view->products : '0'; - if($projectID == 'all') $authedProjects = (!empty($aclViews) and isset($aclViews['project'])) ? $this->app->user->view->projects : '0'; - if($executionID == 'all') $authedExecutions = (!empty($aclViews) and isset($aclViews['execution'])) ? $this->app->user->view->sprints : '0'; + if($productID == 'all') $authedProducts = (empty($aclViews) or (!empty($aclViews) and !empty($aclViews['product']))) ? $this->app->user->view->products : '0'; + if($projectID == 'all') $authedProjects = (empty($aclViews) or (!empty($aclViews) and !empty($aclViews['project']))) ? $this->app->user->view->projects : '0'; + if($executionID == 'all') $authedExecutions = (empty($aclViews) or (!empty($aclViews) and !empty($aclViews['execution']))) ? $this->app->user->view->sprints : '0'; if($productID == 'all' and $projectID == 'all') { @@ -1016,9 +1016,9 @@ class actionModel extends model } $condition = "((product =',0,' or product = '0') AND project = '0' AND execution = '0')"; - if(!empty($productCondition) and isset($aclViews['product'])) $condition .= ' OR ' . $productCondition; - if(!empty($projectCondition) and isset($aclViews['project'])) $condition .= ' OR ' . $projectCondition; - if(!empty($executionCondition) and isset($aclViews['execution'])) $condition .= ' OR ' . $executionCondition; + if(!empty($productCondition)) $condition .= ' OR ' . $productCondition; + if(!empty($projectCondition)) $condition .= ' OR ' . $projectCondition; + if(!empty($executionCondition)) $condition .= ' OR ' . $executionCondition; } $actionCondition = $this->getActionCondition(); @@ -1087,7 +1087,7 @@ class actionModel extends model foreach($this->app->user->rights['acls']['actions'] as $moduleName => $actions) { - if(isset($this->lang->mainNav->$moduleName) and !isset($this->app->user->rights['acls']['views'][$moduleName])) continue; + if(isset($this->lang->mainNav->$moduleName) and !empty($this->app->user->rights['acls']['views']) and !isset($this->app->user->rights['acls']['views'][$moduleName])) continue; $actionCondition .= "(`objectType` = '$moduleName' and `action` " . helper::dbIN($actions) . ") or "; } $actionCondition = trim($actionCondition, 'or '); From 1085813b49286c6e08b19cf44148b3db1b9db581 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Wed, 20 Jul 2022 13:33:52 +0800 Subject: [PATCH 09/23] * Adjust the tips of required fields. --- module/doc/css/selectlibtype.css | 1 + module/doc/lang/de.php | 33 +++++++++++++------------ module/doc/lang/en.php | 33 +++++++++++++------------ module/doc/lang/fr.php | 33 +++++++++++++------------ module/doc/view/createtexttype.html.php | 6 +++++ module/doc/view/edittexttype.html.php | 9 +++++++ 6 files changed, 67 insertions(+), 48 deletions(-) create mode 100644 module/doc/css/selectlibtype.css diff --git a/module/doc/css/selectlibtype.css b/module/doc/css/selectlibtype.css new file mode 100644 index 0000000000..cbffff4aec --- /dev/null +++ b/module/doc/css/selectlibtype.css @@ -0,0 +1 @@ +#lib_chosen.chosen-container .chosen-results {max-height: 100px;} diff --git a/module/doc/lang/de.php b/module/doc/lang/de.php index 90e77680b5..d0cec076ed 100644 --- a/module/doc/lang/de.php +++ b/module/doc/lang/de.php @@ -136,22 +136,23 @@ $lang->doc->menuTitle = 'Menu'; $lang->doc->collectAction = 'Add Favorite'; -$lang->doc->libName = 'Name'; -$lang->doc->libType = 'Kategorie'; -$lang->doc->custom = 'Eigene Dok Bibliothek'; -$lang->doc->customAB = 'Eigene Bibliothek'; -$lang->doc->createLib = 'Document Library'; -$lang->doc->allLibs = 'Bibliothek'; -$lang->doc->objectLibs = "{$lang->productCommon}/{$lang->executionCommon} Bibliothek Liste"; -$lang->doc->showFiles = 'Dok Bibliothek'; -$lang->doc->editLib = 'Edit Document Library'; -$lang->doc->deleteLib = 'Bibliothek löschen'; -$lang->doc->fixedMenu = 'Im Menü fixieren'; -$lang->doc->removeMenu = 'Vom Menü entfernen'; -$lang->doc->search = 'Suche'; -$lang->doc->allCollections = 'All Collections'; -$lang->doc->keywordsTips = 'Please use commas to separate multiple keywords.'; -$lang->doc->sortLibs = 'Sort Libs'; +$lang->doc->libName = 'Name'; +$lang->doc->libType = 'Kategorie'; +$lang->doc->custom = 'Eigene Dok Bibliothek'; +$lang->doc->customAB = 'Eigene Bibliothek'; +$lang->doc->createLib = 'Document Library'; +$lang->doc->allLibs = 'Bibliothek'; +$lang->doc->objectLibs = "{$lang->productCommon}/{$lang->executionCommon} Bibliothek Liste"; +$lang->doc->showFiles = 'Dok Bibliothek'; +$lang->doc->editLib = 'Edit Document Library'; +$lang->doc->deleteLib = 'Bibliothek löschen'; +$lang->doc->fixedMenu = 'Im Menü fixieren'; +$lang->doc->removeMenu = 'Vom Menü entfernen'; +$lang->doc->search = 'Suche'; +$lang->doc->allCollections = 'All Collections'; +$lang->doc->keywordsTips = 'Please use commas to separate multiple keywords.'; +$lang->doc->sortLibs = 'Sort Libs'; +$lang->doc->titlePlaceholder = 'Please enter the title'; global $config; /* Query condition list. */ diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index 22ffeedc54..89bbf20472 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -136,22 +136,23 @@ $lang->doc->menuTitle = 'Direcotory'; $lang->doc->collectAction = 'Add Favorite'; -$lang->doc->libName = 'Document Library'; -$lang->doc->libType = 'Category'; -$lang->doc->custom = 'Custom Document Library'; -$lang->doc->customAB = 'Custom Doc Lib'; -$lang->doc->createLib = 'Document Library'; -$lang->doc->allLibs = 'Library List'; -$lang->doc->objectLibs = "Document View of Library"; -$lang->doc->showFiles = 'Attachments'; -$lang->doc->editLib = 'Edit Document Library'; -$lang->doc->deleteLib = 'Delete Document Library'; -$lang->doc->fixedMenu = 'Fix to Menu'; -$lang->doc->removeMenu = 'Remove from Menu'; -$lang->doc->search = 'Search'; -$lang->doc->allCollections = 'All Collections'; -$lang->doc->keywordsTips = 'Please use commas to separate keywords.'; -$lang->doc->sortLibs = 'Sort Libs'; +$lang->doc->libName = 'Document Library'; +$lang->doc->libType = 'Category'; +$lang->doc->custom = 'Custom Document Library'; +$lang->doc->customAB = 'Custom Doc Lib'; +$lang->doc->createLib = 'Document Library'; +$lang->doc->allLibs = 'Library List'; +$lang->doc->objectLibs = "Document View of Library"; +$lang->doc->showFiles = 'Attachments'; +$lang->doc->editLib = 'Edit Document Library'; +$lang->doc->deleteLib = 'Delete Document Library'; +$lang->doc->fixedMenu = 'Fix to Menu'; +$lang->doc->removeMenu = 'Remove from Menu'; +$lang->doc->search = 'Search'; +$lang->doc->allCollections = 'All Collections'; +$lang->doc->keywordsTips = 'Please use commas to separate keywords.'; +$lang->doc->sortLibs = 'Sort Libs'; +$lang->doc->titlePlaceholder = 'Please enter the title'; global $config; /* Query condition list. */ diff --git a/module/doc/lang/fr.php b/module/doc/lang/fr.php index e7f59b7b84..bddd310eb6 100644 --- a/module/doc/lang/fr.php +++ b/module/doc/lang/fr.php @@ -136,22 +136,23 @@ $lang->doc->menuTitle = 'Menu'; $lang->doc->collectAction = 'Add Favorite'; -$lang->doc->libName = 'Bibliothèque de Documents'; -$lang->doc->libType = 'Catégorie'; -$lang->doc->custom = 'Personnaliser Bibliothèque de Documents'; -$lang->doc->customAB = 'Person. Bib Doc'; -$lang->doc->createLib = 'Document Library'; -$lang->doc->allLibs = 'Liste des Bibliothèque'; -$lang->doc->objectLibs = "{$lang->productCommon}/{$lang->executionCommon} Bibliothèque"; -$lang->doc->showFiles = 'Pièces Jointes'; -$lang->doc->editLib = 'Edit Document Library'; -$lang->doc->deleteLib = 'Supprimer Bibliothèque'; -$lang->doc->fixedMenu = 'Coller au Menu'; -$lang->doc->removeMenu = 'Décoller du Menu'; -$lang->doc->search = 'Rechercher'; -$lang->doc->allCollections = 'All Collections'; -$lang->doc->keywordsTips = 'Please use commas to separate multiple keywords.'; -$lang->doc->sortLibs = 'Sort Libs'; +$lang->doc->libName = 'Bibliothèque de Documents'; +$lang->doc->libType = 'Catégorie'; +$lang->doc->custom = 'Personnaliser Bibliothèque de Documents'; +$lang->doc->customAB = 'Person. Bib Doc'; +$lang->doc->createLib = 'Document Library'; +$lang->doc->allLibs = 'Liste des Bibliothèque'; +$lang->doc->objectLibs = "{$lang->productCommon}/{$lang->executionCommon} Bibliothèque"; +$lang->doc->showFiles = 'Pièces Jointes'; +$lang->doc->editLib = 'Edit Document Library'; +$lang->doc->deleteLib = 'Supprimer Bibliothèque'; +$lang->doc->fixedMenu = 'Coller au Menu'; +$lang->doc->removeMenu = 'Décoller du Menu'; +$lang->doc->search = 'Rechercher'; +$lang->doc->allCollections = 'All Collections'; +$lang->doc->keywordsTips = 'Please use commas to separate multiple keywords.'; +$lang->doc->sortLibs = 'Sort Libs'; +$lang->doc->titlePlaceholder = 'Veuillez saisir le titre'; global $config; /* Query condition list. */ diff --git a/module/doc/view/createtexttype.html.php b/module/doc/view/createtexttype.html.php index cd2d354f0b..d23f98889a 100644 --- a/module/doc/view/createtexttype.html.php +++ b/module/doc/view/createtexttype.html.php @@ -51,6 +51,7 @@ .hide-sidebar #sidebar > .sidebar-toggle {left: -20px; z-index: 9;} #sidebar .cell {border-top: 1px solid rgb(220, 220, 220); border-radius: 0px;} #sidebar > .sidebar-toggle > .icon.icon-angle-right {left: 4px;} +.file-title {max-width: 130px !important;} .th-control {vertical-align: top !important;} @@ -149,6 +150,11 @@ $(function() { $('.doc-title input').focus(); + $('#dataform').submit(function() + { + setTimeout(function(){$('#dataform').scrollTop(0)}, 100); + }); + $('#sidebar').height($(document).height() - 120); setTimeout(function(){$('.ke-edit-iframe, .ke-edit').height($(document).height() - 120);}, 100); setTimeout(function(){$('.CodeMirror').height($(document).height() - 120);}, 100); diff --git a/module/doc/view/edittexttype.html.php b/module/doc/view/edittexttype.html.php index 8cc0af0a7c..d942e21f56 100644 --- a/module/doc/view/edittexttype.html.php +++ b/module/doc/view/edittexttype.html.php @@ -56,6 +56,8 @@ #sidebar .cell {border-top: 1px solid rgb(220, 220, 220); border-radius: 0px;} #sidebar>.sidebar-toggle>.icon.icon-angle-right {left: 4px;} +.file-title {max-width: 130px !important;} + .th-control {vertical-align: top !important;} #noticeAcl {margin: 0;} @@ -149,9 +151,16 @@ $(function() { $('.doc-title input').focus(); + $('#dataform').submit(function() + { + setTimeout(function(){$('#dataform').scrollTop(0)}, 100); + }); + $('#sidebar').height($(document).height() - 120); setTimeout(function(){$('.ke-edit-iframe, .ke-edit').height($(document).height() - 120);}, 100); setTimeout(function(){$('.CodeMirror').height($(document).height() - 120);}, 100); + + $('#editorContent .icon.icon-angle-right').css('top', '50%'); }) doc->noticeAcl['doc']);?> From fc8be7e0377966f40503247d298bd52ca43b50e1 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 20 Jul 2022 13:35:49 +0800 Subject: [PATCH 10/23] * Modify lang error. --- module/ci/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/ci/model.php b/module/ci/model.php index e9b06fd86c..0d27513edc 100644 --- a/module/ci/model.php +++ b/module/ci/model.php @@ -29,7 +29,7 @@ class ciModel extends model if($this->session->repoID) { $repo = $this->loadModel('repo')->getRepoByID($this->session->repoID); - if(!in_array(strtolower($repo->SCM), $this->config->mr->gitServiceList)) unset($this->lang->devops->menu->mr); + if(!in_array(strtolower($repo->SCM), $this->config->repo->gitServiceList)) unset($this->lang->devops->menu->mr); $this->lang->switcherMenu = $this->loadModel('repo')->getSwitcher($this->session->repoID); } From c5529b23ee631e40719082db2c4c07bf8b866888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Wed, 20 Jul 2022 13:44:39 +0800 Subject: [PATCH 11/23] * Fix bug #25494. --- module/webhook/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/webhook/config.php b/module/webhook/config.php index 1962854a63..ced1977ab8 100644 --- a/module/webhook/config.php +++ b/module/webhook/config.php @@ -21,4 +21,4 @@ $config->webhook->objectTypes['case'] = array('opened', 'edited', 'commen $config->webhook->objectTypes['testtask'] = array('opened', 'edited', 'started', 'blocked', 'closed', 'activated'); $config->webhook->objectTypes['todo'] = array('opened', 'edited'); -$config->webhook->needAssignTypes = array('story', 'task', 'bug', 'todo'); +$config->webhook->needAssignTypes = array('story', 'task', 'bug', 'todo', 'feedback'); From e8cedee6bbb2e37966a4c4e59adcf729064f6628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Wed, 20 Jul 2022 13:49:10 +0800 Subject: [PATCH 12/23] * Code for code error. --- module/tree/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/tree/model.php b/module/tree/model.php index f1c2a3db9f..2013764297 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -1691,7 +1691,7 @@ class treeModel extends model $this->dao->update(TABLE_MODULE)->data($data)->autoCheck()->where('id')->eq($moduleID)->limit(1)->exec(); $newModule = $this->getByID($moduleID); - if(!empty(common::createChanges($oldModule, $newModule))) + if(common::createChanges($oldModule, $newModule)) { $editIdList[] = $moduleID; $moduleChanges[$moduleID] = common::createChanges($oldModule, $newModule); From 45eb1e2f9955d5a9f835fc9e5341f9390570d86a Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 20 Jul 2022 13:54:23 +0800 Subject: [PATCH 13/23] * Fix bug for task #61171. --- module/action/model.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/module/action/model.php b/module/action/model.php index bd242aad0b..a9aab862ec 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -991,7 +991,9 @@ class actionModel extends model if($productID == 'all' and $projectID == 'all') { - $productCondition = "product " . helper::dbIN($authedProducts); + $productCondition = ''; + foreach(explode(',', $authedProducts) as $product) $productCondition = empty($productCondition) ? "product LIKE '%,$product,%'" : "$productCondition OR product LIKE '%,$product,%'"; + $projectCondition = "project " . helper::dbIN($authedProjects); $executionCondition = isset($authedExecutions) ? "execution " . helper::dbIN($authedExecutions) : ''; } @@ -1000,7 +1002,9 @@ class actionModel extends model $products = $this->loadModel('product')->getProductPairsByProject($projectID); $executions = $this->loadModel('execution')->getPairs($projectID) + array(0 => 0); - $productCondition = "product " . helper::dbIN(array_keys($products)); + $productCondition = ''; + foreach(array_keys($products) as $product) $productCondition = empty($productCondition) ? "product LIKE '%,$product,%'" : "$productCondition OR product LIKE '%,$product,%'"; + $projectCondition = "project = $projectID"; $executionCondition = "execution " . helper::dbIN(array_keys($executions)); } From fab8fedf103acb0e6697128704ef40dc9bb06a8d Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Wed, 20 Jul 2022 14:15:43 +0800 Subject: [PATCH 14/23] * Adjust the judgment condition to a configuration item. --- config/zentaopms.php | 2 ++ module/common/view/header.html.php | 5 +---- module/doc/control.php | 5 ++++- module/doc/view/createtexttype.html.php | 7 ++++--- module/doc/view/edittexttype.html.php | 18 +++++++++--------- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/config/zentaopms.php b/config/zentaopms.php index 3ecf24e31e..646f396d0a 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -389,3 +389,5 @@ $config->programPriv->scrum = array('story', 'projectstory', 'projectrelease $config->programPriv->waterfall = array_merge($config->programPriv->scrum, array('task', 'workestimation', 'durationestimation', 'budget', 'programplan', 'review', 'reviewissue', 'weekly', 'cm', 'milestone', 'design', 'issue', 'risk', 'opportunity', 'measrecord', 'auditplan', 'trainplan', 'gapanalysis', 'pssp', 'researchplan', 'researchreport')); $config->waterfallModules = array('workestimation', 'durationestimation', 'budget', 'programplan', 'review', 'reviewissue', 'weekly', 'cm', 'milestone', 'design', 'opportunity', 'auditplan', 'trainplan', 'gapanalysis', 'pssp', 'researchplan', 'researchreport'); + +$config->showMainMenu = true; diff --git a/module/common/view/header.html.php b/module/common/view/header.html.php index cb9e3eb983..6d67bb95e8 100755 --- a/module/common/view/header.html.php +++ b/module/common/view/header.html.php @@ -7,10 +7,7 @@ include 'chosen.html.php'; app->loadConfig('sso');?> sso->redirect)) js::set('ssoRedirect', $config->sso->redirect);?> -getModuleName() == 'doc';?> -getMethodName()},") !== false;?> - - +showMainMenu):?> + setCode) or $config->setCode == 1):?> + From 9e54c0b55c2db010c7840ee0ed1ec0adb746693e Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Wed, 20 Jul 2022 14:27:08 +0800 Subject: [PATCH 16/23] * Change the if statement to toggleClass. --- module/doc/js/selectlibtype.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/module/doc/js/selectlibtype.js b/module/doc/js/selectlibtype.js index 6e339e2df5..b3711fee8e 100644 --- a/module/doc/js/selectlibtype.js +++ b/module/doc/js/selectlibtype.js @@ -36,12 +36,5 @@ function loadDocLibs(type) $('#lib').chosen(); }) - if(type == 'api') - { - $('#docType').addClass('hidden'); - } - else - { - $('#docType').removeClass('hidden'); - } + $('#docType').toggleClass('hidden', type == 'api'); } From dcf20546ca2b73d51fb63a2f5cce810b41252853 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 20 Jul 2022 14:28:07 +0800 Subject: [PATCH 17/23] * Adjust codes. --- module/mr/control.php | 3 +-- module/mr/js/create.js | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/module/mr/control.php b/module/mr/control.php index e830ab1a08..6e7f73ff5d 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -163,7 +163,6 @@ class mr extends control if($MR->canDeleteBranch and $priv->name == $MR->sourceBranch) $MR->canDeleteBranch = false; } - $targetBranchList = array(); foreach($branchList as $branch) $targetBranchList[$branch] = $branch; @@ -1032,7 +1031,7 @@ class mr extends control * @param int $hostID * @param int|string $project * @access public - * @return array + * @return void */ public function ajaxGetBranchPivs($hostID, $project) { diff --git a/module/mr/js/create.js b/module/mr/js/create.js index 1b4e30197e..9fe52f0126 100644 --- a/module/mr/js/create.js +++ b/module/mr/js/create.js @@ -28,7 +28,6 @@ function getBranchPriv(project) { branchPrivs = eval('(' + response + ')'); }); - } $(function() @@ -113,7 +112,6 @@ $(function() return false; } }); - }); $('#repoID').change(function() From d1618174415bd0b7d20f7d31b46ec1019f9ae1a0 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 20 Jul 2022 15:56:59 +0800 Subject: [PATCH 18/23] * Optimize code for task #61173. --- module/bug/model.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index 525e430141..358946a772 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -742,8 +742,21 @@ class bugModel extends model $linkBugs = explode(',', $bug->linkBug); $oldLinkBugs = explode(',', $oldBug->linkBug); - foreach(array_diff($linkBugs, $oldLinkBugs) as $addBug) $this->dao->update(TABLE_BUG)->set("linkBug = CONCAT(linkbug, ',$bugID')")->where('id')->eq((int)$addBug)->exec(); - foreach(array_diff($oldLinkBugs, $linkBugs) as $removeBug) $this->dao->update(TABLE_BUG)->set("linkBug = TRIM(BOTH ',' from REPLACE(CONCAT(',', linkbug, ','), ',$bugID,', ''))")->where('id')->eq((int)$removeBug)->exec(); + $addBugs = array_diff($linkBugs, $oldLinkBugs); + $removeBugs = array_diff($oldLinkBugs, $linkBugs); + $changeBugs = array_merge($addBugs, $removeBugs); + $changeBugs = $this->dao->select('id,linkbug')->from(TABLE_BUG)->where('id')->in(array_filter($changeBugs))->fetchPairs(); + foreach($changeBugs as $changeBugID => $changeBug) + { + if(array_search($changeBugID, $addBugs) !== false and empty($changeBug)) $this->dao->update(TABLE_BUG)->set('linkBug')->eq($bugID)->where('id')->eq((int)$changeBugID)->exec(); + if(array_search($changeBugID, $addBugs) !== false and !empty($changeBug)) $this->dao->update(TABLE_BUG)->set('linkBug')->eq("$changeBug,$bugID")->where('id')->eq((int)$changeBugID)->exec(); + if(array_search($changeBugID, $removeBugs) !== false) + { + $linkBugs = explode(',', $changeBug); + unset($linkBugs[array_search($bugID, $linkBugs)]); + $this->dao->update(TABLE_BUG)->set('linkBug')->eq(implode(',', $linkBugs))->where('id')->eq((int)$changeBugID)->exec(); + } + } if(!empty($bug->resolvedBy)) $this->loadModel('score')->create('bug', 'resolve', $bugID); $this->file->updateObjectID($this->post->uid, $bugID, 'bug'); From 05eb3a54227b129b3875e733a1786d8b433e266a Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 20 Jul 2022 15:59:28 +0800 Subject: [PATCH 19/23] * Fix bug #25454. --- module/my/view/managecontacts.html.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/my/view/managecontacts.html.php b/module/my/view/managecontacts.html.php index 939ba5691a..ce0e107594 100644 --- a/module/my/view/managecontacts.html.php +++ b/module/my/view/managecontacts.html.php @@ -20,8 +20,7 @@ foreach($lists as $id => $listName) { $listClass = ($id == $listID and $mode == 'edit') ? 'btn btn-block active' : 'btn btn-block'; - $shareIcon = in_array($id, $globalContacts) ? ' ' : ''; - echo html::a(inlink('managecontacts', "listID=$id&mode=edit"), $shareIcon . $listName, '', "class='{$listClass}' title='$listName'"); + echo html::a(inlink('managecontacts', "listID=$id&mode=edit"), $listName, '', "class='{$listClass}' title='$listName'"); } ?> From 9ed05fad25366d43a565add0ad47a8046bc23f65 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 20 Jul 2022 15:59:50 +0800 Subject: [PATCH 20/23] * Optimize code for task #61173. --- module/bug/model.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index 358946a772..80ff5ef43c 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -748,9 +748,9 @@ class bugModel extends model $changeBugs = $this->dao->select('id,linkbug')->from(TABLE_BUG)->where('id')->in(array_filter($changeBugs))->fetchPairs(); foreach($changeBugs as $changeBugID => $changeBug) { - if(array_search($changeBugID, $addBugs) !== false and empty($changeBug)) $this->dao->update(TABLE_BUG)->set('linkBug')->eq($bugID)->where('id')->eq((int)$changeBugID)->exec(); - if(array_search($changeBugID, $addBugs) !== false and !empty($changeBug)) $this->dao->update(TABLE_BUG)->set('linkBug')->eq("$changeBug,$bugID")->where('id')->eq((int)$changeBugID)->exec(); - if(array_search($changeBugID, $removeBugs) !== false) + if(in_array($changeBugID, $addBugs) and empty($changeBug)) $this->dao->update(TABLE_BUG)->set('linkBug')->eq($bugID)->where('id')->eq((int)$changeBugID)->exec(); + if(in_array($changeBugID, $addBugs) and !empty($changeBug)) $this->dao->update(TABLE_BUG)->set('linkBug')->eq("$changeBug,$bugID")->where('id')->eq((int)$changeBugID)->exec(); + if(in_array($changeBugID, $removeBugs)) { $linkBugs = explode(',', $changeBug); unset($linkBugs[array_search($bugID, $linkBugs)]); From c4ab5588af29365874a561d76a2898ca448450a1 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 20 Jul 2022 15:59:50 +0800 Subject: [PATCH 21/23] * Fix bug #25483. --- module/program/model.php | 23 +++++++++++++++++++++++ module/project/config.php | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/module/program/model.php b/module/program/model.php index caf71c1072..93c3935060 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -547,6 +547,29 @@ class programModel extends model $path = $program->path; } + if($queryID) + { + $query = $this->loadModel('search')->getQuery($queryID); + if($query) + { + $this->session->set('projectQuery', $query->sql); + $this->session->set('projectForm', $query->form); + } + else + { + $this->session->set('projectQuery', ' 1 = 1'); + } + } + else + { + if($this->session->projectQuery == false) $this->session->set('projectQuery', ' 1 = 1'); + } + + if(isset($this->config->setCode) and $this->config->setCode == 0) + { + $this->session->projectQuery = preg_replace("/`code`.*' [)] (AND|OR) \( 1 AND `/", '1 ) $1 ( 1 AND `', $this->session->projectQuery); + } + $query = str_replace('`id`','t1.id', $this->session->projectQuery); $projectList = $this->dao->select('distinct t1.*')->from(TABLE_PROJECT)->alias('t1') ->leftJoin(TABLE_TEAM)->alias('t2')->on('t1.id=t2.root') diff --git a/module/project/config.php b/module/project/config.php index c75ee66c9e..2e7a9498b8 100644 --- a/module/project/config.php +++ b/module/project/config.php @@ -155,7 +155,7 @@ $config->project->search['fields']['lastEditedDate'] = $lang->project->lastEdite $config->project->search['fields']['closedDate'] = $lang->project->closedDate; $config->project->search['params']['name'] = array('operator' => 'include', 'control' => 'input' , 'values' => ''); -$config->project->search['params']['code'] = array('operator' => '=' , 'control' => 'input' , 'values' => ''); +if(!isset($config->setCode) or $config->setCode == 1) $config->project->search['params']['code'] = array('operator' => '=' , 'control' => 'input' , 'values' => ''); $config->project->search['params']['id'] = array('operator' => '=' , 'control' => 'input' , 'values' => ''); $config->project->search['params']['model'] = array('operator' => '=' , 'control' => 'select', 'values' => $lang->project->modelList); $config->project->search['params']['parent'] = array('operator' => '=' , 'control' => 'select', 'values' => ''); From 68eecb775e2ad032d1bc26114ecf531f7e2585bf Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 20 Jul 2022 16:07:50 +0800 Subject: [PATCH 22/23] * Fix bug #25483. --- module/program/model.php | 5 ----- module/project/config.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/module/program/model.php b/module/program/model.php index 93c3935060..12e5614b57 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -565,11 +565,6 @@ class programModel extends model if($this->session->projectQuery == false) $this->session->set('projectQuery', ' 1 = 1'); } - if(isset($this->config->setCode) and $this->config->setCode == 0) - { - $this->session->projectQuery = preg_replace("/`code`.*' [)] (AND|OR) \( 1 AND `/", '1 ) $1 ( 1 AND `', $this->session->projectQuery); - } - $query = str_replace('`id`','t1.id', $this->session->projectQuery); $projectList = $this->dao->select('distinct t1.*')->from(TABLE_PROJECT)->alias('t1') ->leftJoin(TABLE_TEAM)->alias('t2')->on('t1.id=t2.root') diff --git a/module/project/config.php b/module/project/config.php index 2e7a9498b8..c90e9b5f05 100644 --- a/module/project/config.php +++ b/module/project/config.php @@ -155,7 +155,7 @@ $config->project->search['fields']['lastEditedDate'] = $lang->project->lastEdite $config->project->search['fields']['closedDate'] = $lang->project->closedDate; $config->project->search['params']['name'] = array('operator' => 'include', 'control' => 'input' , 'values' => ''); -if(!isset($config->setCode) or $config->setCode == 1) $config->project->search['params']['code'] = array('operator' => '=' , 'control' => 'input' , 'values' => ''); +if(!isset($config->setCode) or $config->setCode == 1) $config->project->search['params']['code'] = array('operator' => '=', 'control' => 'input' , 'values' => ''); $config->project->search['params']['id'] = array('operator' => '=' , 'control' => 'input' , 'values' => ''); $config->project->search['params']['model'] = array('operator' => '=' , 'control' => 'select', 'values' => $lang->project->modelList); $config->project->search['params']['parent'] = array('operator' => '=' , 'control' => 'select', 'values' => ''); From e5d4bf2ef08ae142453c63b75d887dcf35fd1251 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Wed, 20 Jul 2022 16:36:26 +0800 Subject: [PATCH 23/23] * Adjust the style for document height. --- module/doc/view/createtexttype.html.php | 5 +++-- module/doc/view/edit.html.php | 2 +- module/doc/view/edittexttype.html.php | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/module/doc/view/createtexttype.html.php b/module/doc/view/createtexttype.html.php index 9c97f6d3c5..4192310850 100644 --- a/module/doc/view/createtexttype.html.php +++ b/module/doc/view/createtexttype.html.php @@ -40,6 +40,7 @@ .hide-sidebar .ke-edit {padding-right: 20px;} .hide-sidebar .CodeMirror {padding-right: 50px;} .CodeMirror.CodeMirror-wrap {border-left: 0; border-right: 0; border-bottom: 0;} +.ke-statusbar {display: none;} #sidebar {top: 30px;} #sidebar .sidebar-toggle {right: 0; left: 0px; background: #efefef; border-radius: 0px; width: 20px; border-top: 1px solid rgb(220, 220, 220);} @@ -49,7 +50,7 @@ #sidebar table th {font-weight: 400 !important;} .hide-sidebar #sidebar > .sidebar-toggle > .icon:before {content: "\e314";} .hide-sidebar #sidebar > .sidebar-toggle {left: -20px; z-index: 9;} -#sidebar .cell {border-top: 1px solid rgb(220, 220, 220); border-radius: 0px;} +#sidebar .cell {border-top: 1px solid rgb(220, 220, 220); border-radius: 0px; height: 100%;} #sidebar > .sidebar-toggle > .icon.icon-angle-right {left: 4px;} .file-title {max-width: 130px !important;} @@ -152,7 +153,7 @@ $(function() $('#dataform').submit(function() { - setTimeout(function(){$('#dataform').scrollTop(0)}, 100); + setTimeout(function(){$('#dataform').scrollTop(0)}, 300); }); var contentHeight = $(document).height() - 120; diff --git a/module/doc/view/edit.html.php b/module/doc/view/edit.html.php index 1f6d3b8382..2ccac715c4 100644 --- a/module/doc/view/edit.html.php +++ b/module/doc/view/edit.html.php @@ -10,7 +10,7 @@ * @link http://www.zentao.net */ ?> -type == 'text'):?> +type == 'text' and !isonlybody()):?> diff --git a/module/doc/view/edittexttype.html.php b/module/doc/view/edittexttype.html.php index 67bf6c18a6..1a9b167c60 100644 --- a/module/doc/view/edittexttype.html.php +++ b/module/doc/view/edittexttype.html.php @@ -44,6 +44,7 @@ .hide-sidebar .ke-edit {padding-right: 20px;} .hide-sidebar .CodeMirror {padding-right: 50px;} .CodeMirror.CodeMirror-wrap {border-left: 0; border-right: 0; border-bottom: 0;} +.ke-statusbar {display: none;} #sidebar {top: 30px;} #sidebar .sidebar-toggle {right: 0; left: 0px; background: #efefef; border-radius: 0px; width: 20px; border-top: 1px solid rgb(220, 220, 220);} @@ -53,7 +54,7 @@ #sidebar table th {font-weight: 400 !important;} .hide-sidebar #sidebar > .sidebar-toggle > .icon:before {content: "\e314";} .hide-sidebar #sidebar > .sidebar-toggle {left: -20px; z-index: 9;} -#sidebar .cell {border-top: 1px solid rgb(220, 220, 220); border-radius: 0px;} +#sidebar .cell {border-top: 1px solid rgb(220, 220, 220); border-radius: 0px; height: 100%;} #sidebar > .sidebar-toggle > .icon.icon-angle-right {left: 4px;} .file-title {max-width: 130px !important;}
    doc->libType;?>
    doc->lib;?>
    doc->type;?>doc->types, 'text');?>
    confirm);?>
    mr->removeSourceBranch;?> -
    +
    diff --git a/module/mr/view/edit.html.php b/module/mr/view/edit.html.php index 02c7894d17..f25de0ee27 100644 --- a/module/mr/view/edit.html.php +++ b/module/mr/view/edit.html.php @@ -79,9 +79,9 @@
    mr->removeSourceBranch;?> -
    - removeSourceBranch== '1' ? 'checked' : '' ?> - name="removeSourceBranch" value="1" id="removeSourceBranch"> +
    + canDeleteBranch and $MR->removeSourceBranch== '1' ? 'checked' : '' ?> + canDeleteBranch) echo 'disabled';?> name="removeSourceBranch" value="1" id="removeSourceBranch">
    project->name;?>
    project->code;?>
    project->PM;?>