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/extension/lite/project/ext/view/create.html.php b/extension/lite/project/ext/view/create.html.php index dcaead759c..a105f7a5b7 100644 --- a/extension/lite/project/ext/view/create.html.php +++ b/extension/lite/project/ext/view/create.html.php @@ -40,10 +40,12 @@ project->name;?> + setCode) or $config->setCode == 1):?> project->code;?> + project->PM;?> diff --git a/module/action/model.php b/module/action/model.php index 843eab0388..8aec1a5db1 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -984,13 +984,16 @@ 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) 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') { - $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) : ''; } @@ -999,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)); } @@ -1014,7 +1019,7 @@ class actionModel extends model $executionCondition = "execution " . helper::dbIN(array_keys($executions)); } - $condition = "((product =',0,' or product=0) AND project = '0' AND execution = 0)"; + $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; @@ -1086,6 +1091,7 @@ class actionModel extends model foreach($this->app->user->rights['acls']['actions'] as $moduleName => $actions) { + 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 '); @@ -1258,11 +1264,7 @@ class actionModel extends model if(empty($action->objectName) and (substr($objectType, 0, 6) == 'gitlab' or substr($objectType, 0, 5) == 'gitea')) $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 +1439,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 +1537,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/bug/model.php b/module/bug/model.php index 0835194d51..80ff5ef43c 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -740,6 +740,24 @@ class bugModel extends model $this->linkBugToBuild($bugID, $bug->resolvedBuild); } + $linkBugs = explode(',', $bug->linkBug); + $oldLinkBugs = explode(',', $oldBug->linkBug); + $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(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)]); + $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'); 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); } diff --git a/module/common/view/header.html.php b/module/common/view/header.html.php index 5e3a344972..6d67bb95e8 100755 --- a/module/common/view/header.html.php +++ b/module/common/view/header.html.php @@ -7,6 +7,7 @@ include 'chosen.html.php'; app->loadConfig('sso');?> sso->redirect)) js::set('ssoRedirect', $config->sso->redirect);?> +showMainMenu):?> + + + - - + + - - - -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..4192310850 --- /dev/null +++ b/module/doc/view/createtexttype.html.php @@ -0,0 +1,169 @@ + + * @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..2ccac715c4 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' and !isonlybody()):?> + + + + 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..1a9b167c60 --- /dev/null +++ b/module/doc/view/edittexttype.html.php @@ -0,0 +1,168 @@ + + * @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/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/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..6e7f73ff5d 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -156,6 +156,13 @@ 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 +1024,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 void + */ + 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..9fe52f0126 100644 --- a/module/mr/js/create.js +++ b/module/mr/js/create.js @@ -13,6 +13,23 @@ 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 +83,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,6 +108,7 @@ $(function() { alert(response.message); $this.val('').trigger('chosen:updated'); + if($this.attr('id') == 'sourceBranch') $('#removeSourceBranch').removeAttr('disabled'); return false; } }); 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/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; } 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 @@
    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'"); } ?> 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/program/model.php b/module/program/model.php index caf71c1072..12e5614b57 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -547,6 +547,24 @@ 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'); + } + $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..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' => ''); -$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' => ''); 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/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); diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 450dd6afd5..fd58531ebe 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; @@ -6267,7 +6269,7 @@ class upgradeModel extends model foreach($stories as $storyID => $story) { - if(!empty($story->assingnedTo)) + if(!empty($story->assignedTo)) { $story->reviewer = $story->assingnedTo; } @@ -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(); + } } 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) . '';?> 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');
    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">